| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using MySystem.PxcModels;
- using Library;
- using LitJson;
- using System.Threading;
- namespace MySystem
- {
- public class SycnJavaUsersService
- {
- public readonly static SycnJavaUsersService Instance = new SycnJavaUsersService();
- private SycnJavaUsersService()
- { }
- public bool Add(string content)
- {
- try
- {
- JsonData jsonObj = JsonMapper.ToObject(content);
- WebCMSEntities db = new WebCMSEntities();
- int id = int.Parse(jsonObj["id"].ToString());
- string pidPath = jsonObj["pidPath"].ToString();
- pidPath = "," + pidPath.Substring(1).Replace(",",",,").Trim(',') + ",";
- int pid = int.Parse(jsonObj["pid"].ToString());
- DateTime CreateDate = DateTime.Parse(jsonObj["createTime"].ToString());
- string MakerCode = jsonObj["userCode"].ToString();
- string Mobile = jsonObj["phone"].ToString();
- Users add = db.Users.Add(new Users()
- {
- Id = id,
- ParentUserId = pid,
- ParentNav = pidPath,
- CreateDate = CreateDate,
- MakerCode = MakerCode,
- Mobile = Mobile,
- }).Entity;
- db.SaveChanges();
- db.UserForMobile.Add(new UserForMobile()
- {
- Mobile = Mobile,
- UserId = add.Id
- });
- db.UserForMakerCode.Add(new UserForMakerCode()
- {
- MakerCode = MakerCode,
- UserId = add.Id
- });
- db.SaveChanges();
- db.Dispose();
- return true;
- }
- catch (Exception ex)
- {
- function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "同步创客信息异常");
- return false;
- }
- }
- }
- }
|