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(); db.Users.Add(new Users() { Id = int.Parse(jsonObj["id"].ToString()), ParentUserId = int.Parse(jsonObj["pid"].ToString()), ParentNav = jsonObj["pidPath"].ToString(), CreateDate = DateTime.Parse(jsonObj["create_time"].ToString()), MakerCode = jsonObj["userCode"].ToString(), Mobile = jsonObj["phone"].ToString(), UserLevel = int.Parse(jsonObj["userLevel"].ToString()), }); db.SaveChanges(); db.Dispose(); return true; } catch (Exception ex) { function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "同步创客信息异常"); return false; } } } }