예제 #1
0
        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
            });

        }
예제 #2
0
        public void DeleteEntity(NewsModel clientModel)
        {
            _currentDeleteModel = clientModel;
            publicWS.DeleteContentAsync(_currentDeleteModel.NEWSID);

        }
예제 #3
0
        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;
        }
예제 #4
0
        /// <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;
        }
예제 #5
0
        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;
        }
예제 #6
0
        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;
        }
예제 #7
0
파일: NewsViewModel.cs 프로젝트: JuRogn/OA
        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;
        }
예제 #8
0
파일: NewsServices.cs 프로젝트: JuRogn/OA
        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
            });
        }
예제 #9
0
파일: NewsServices.cs 프로젝트: JuRogn/OA
        /// <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);
        }