public void UpdateEntity(NewsModel clientModel) { _currentUpdateModel = clientModel; publicWS.UpdateContentAsync(_currentUpdateModel.NEWSID, _currentUpdateModel.NEWSCONTENT, new Saas.Tools.PublicInterfaceWS.UserInfo() { COMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID, DEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID, POSTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID, USERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID, USERNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserName }); }
public void DeleteEntity(NewsModel clientModel) { _currentDeleteModel = clientModel; publicWS.DeleteContentAsync(_currentDeleteModel.NEWSID); }
private SMT.Saas.Tools.PlatformWS.T_PF_NEWS ModelToEntity(NewsModel clientModel) { DateTime dt = new DateTime(clientModel.UPDATEDATE.Year, clientModel.UPDATEDATE.Month, clientModel.UPDATEDATE.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); SMT.Saas.Tools.PlatformWS.T_PF_NEWS model = new SMT.Saas.Tools.PlatformWS.T_PF_NEWS() { CREATECOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID, CREATEDATE = DateTime.Now, CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID, CREATEPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID, CREATEUSERID = Common.CurrentLoginUserInfo.EmployeeID, CREATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName, OWNERCOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID, OWNERDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID, OWNERID = Common.CurrentLoginUserInfo.EmployeeID, OWNERNAME = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName, OWNERPOSTID = Common.CurrentLoginUserInfo.EmployeeID, UPDATEUSERID = Common.CurrentLoginUserInfo.EmployeeID, UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName, UPDATEDATE = dt, NEWSID = clientModel.NEWSID, NEWSCONTENT = clientModel.NEWSCONTENT, NEWSSTATE = clientModel.NEWSSTATE, NEWSTITEL = clientModel.NEWSTITEL, COMMENTCOUNT = "0", READCOUNT = "0", ISIMAGE = clientModel.ISIMAGE ? "1" : "0", ISPOPUP = clientModel.ISPOPUP ? "1" : "0", ENDDATE=clientModel.ENDDATE, NEWSTYPEID = clientModel.NEWSTYPEID, PUTDEPTID=clientModel.PUTDEPTID, PUTDEPTNAME=clientModel.PUTDEPTNAME }; NewsId = model.NEWSID.ToString(); return model; }
/// <summary> /// 实体类NewsModel值添加到List<T_PF_DISTRIBUTEUSER> /// </summary> /// <param name="cilientModel"></param> /// <returns></returns> private ObservableCollection<T_PF_DISTRIBUTEUSER> ModelEntity(NewsModel cilientModel) { ObservableCollection<T_PF_DISTRIBUTEUSER> ButeUserModel = new ObservableCollection<T_PF_DISTRIBUTEUSER>(); // NewsId = cilientModel.NEWSID.Length > 0 ? cilientModel.NEWSID : Guid.NewGuid().ToString(); foreach (var item in cilientModel.VIEWER) { T_PF_DISTRIBUTEUSER model = new T_PF_DISTRIBUTEUSER() { CREATECOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID, CREATEDATE = DateTime.Now, CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID, CREATEPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID, CREATEUSERID = Common.CurrentLoginUserInfo.EmployeeID, CREATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName, OWNERCOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID, OWNERDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID, OWNERID = Common.CurrentLoginUserInfo.EmployeeID, OWNERNAME = Common.CurrentLoginUserInfo.EmployeeName, OWNERPOSTID = Common.CurrentLoginUserInfo.EmployeeID, UPDATEUSERID = Common.CurrentLoginUserInfo.EmployeeID, UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName, UPDATEDATE = DateTime.Now, //新闻关联表ID赋值 DISTRIBUTEUSERID = Guid.NewGuid().ToString(), MODELNAME = item.MODELNAMES, //新闻ID赋值 FORMID = NewsId,//cilientModel.NEWSID.Length > 0 ? cilientModel.NEWSID : Guid.NewGuid().ToString(), VIEWTYPE = "3", //用户权限赋值 VIEWER = item.VIEWERS }; ButeUserModel.Add(model); } return ButeUserModel; }
private NewsModel EntityToModel(SMT.Saas.Tools.PlatformWS.T_PF_NEWS entity, ObservableCollection<T_PF_DISTRIBUTEUSER> disentity) { ObservableCollection<Model.DISTR> _viewer = new ObservableCollection<Model.DISTR>(); if (disentity != null) { foreach (var item in disentity) { //_viewer.Add(new Model.DISTR() { MODELNAMES = item.MODELNAME, VIEWERS = item.FORMID });//我去,这种事情会发生 _viewer.Add(new Model.DISTR() { MODELNAMES = item.MODELNAME, VIEWERS = item.VIEWER }); } } NewsModel vm = new NewsModel() { NEWSTITEL = entity.NEWSTITEL, NEWSID = entity.NEWSID, ISRELEASE = true, NEWSCONTENT = entity.NEWSCONTENT, NEWSSTATE = entity.NEWSSTATE, NEWSTYPEID = entity.NEWSTYPEID, UPDATEDATE = Convert.ToDateTime(entity.UPDATEDATE), ISIMAGE = entity.ISIMAGE == "0" ? false : true, ISPOPUP = entity.ISPOPUP==null?false:( entity.ISPOPUP == "0" ? false : true), ENDDATE=entity.ENDDATE==null?DateTime.Now:(DateTime)entity.ENDDATE, PUTDEPTID=entity.PUTDEPTID, PUTDEPTNAME=entity.PUTDEPTNAME, VIEWER = _viewer }; return vm; }
private NewsViewModel ConventToViewModel(NewsModel model) { int state = model.NEWSSTATE.IsNotNull() ? int.Parse(model.NEWSSTATE) : 0; int type = model.NEWSTYPEID.IsNotNull() ? int.Parse(model.NEWSTYPEID) : 0; var vmodel = new NewsViewModel() { NEWSTITEL = model.NEWSTITEL, NEWSID = model.NEWSID, UPDATEDATE = model.UPDATEDATE, IsAdd = false }; vmodel.NEWSSTATE = vmodel.NEWSSTATELIST[state]; vmodel.NEWSTYPE = vmodel.NEWSTYPELIST[type]; return vmodel; }
private NewsViewModel ConventToViewModel(NewsModel model) { int state = model.NEWSSTATE.IsNotNull() ? int.Parse(model.NEWSSTATE) : 0; int type = model.NEWSTYPEID.IsNotNull() ? int.Parse(model.NEWSTYPEID) : 0; ObservableCollection<DISTR> distrs = new ObservableCollection<DISTR>(); foreach (var item in model.VIEWER) { distrs.Add(new DISTR() { VIEWERS = item.VIEWERS, MODELNAMES = item.MODELNAMES }); } var vmodel = new NewsViewModel() { NEWSTITEL = model.NEWSTITEL, NEWSID = model.NEWSID, ISRELEASE = model.ISRELEASE, NEWSCONTENT = model.NEWSCONTENT, ISIMAGE = model.ISIMAGE, ISPOPUP=model.ISPOPUP, ENDDATE=model.ENDDATE, UPDATEDATE = model.UPDATEDATE, DISTRS = distrs }; vmodel.NEWSSTATE = vmodel.NEWSSTATELIST[state]; vmodel.NEWSTYPE = vmodel.NEWSTYPELIST[type]; return vmodel; }
public void AddEntityByViewer(NewsModel clientModel) { _currentAddModel = clientModel; publicWS.AddContentAsync(_currentAddModel.NEWSID, _currentAddModel.NEWSCONTENT, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID, "Platform", "News", new Saas.Tools.PublicInterfaceWS.UserInfo() { COMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID, DEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID, POSTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID, USERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID, USERNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserName }); }
/// <summary> /// 新增数据到数据库 /// </summary> /// <param name="clientModel">数据实体</param> public void AddEntity(NewsModel clientModel) { _currentAddModel = clientModel; SMT.SAAS.Platform.WebParts.NewsWS.T_PF_NEWS _entity = ModelToEntity(clientModel); publicWS.AddContentAsync(_entity.NEWSID, _entity.NEWSCONTENT, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID, "Platform", "News", new Saas.Tools.PublicInterfaceWS.UserInfo() { COMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID, DEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID, POSTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID, USERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID, USERNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserName }); //client.AddNewsAsync(_entity); }