private void HyperlinkButton_Click(object sender, RoutedEventArgs e) { SMT.SAAS.Platform.WebParts.NewsWS.T_PF_NEWS source = (sender as HyperlinkButton).DataContext as SMT.SAAS.Platform.WebParts.NewsWS.T_PF_NEWS; ShowNewsInfo(source.NEWSID); //try //{ // HyperlinkButton bybutton = sender as HyperlinkButton; // bybutton.Foreground = new SolidColorBrush(Color.FromArgb(255, 63, 40, 92)); // SMT.SAAS.Platform.WebParts.NewsWS.T_PF_NEWS source = // (sender as HyperlinkButton).DataContext as SMT.SAAS.Platform.WebParts.NewsWS.T_PF_NEWS; // NewsShow newsview = new NewsShow(); // newsview.LoadNewsDetails(source.NEWSID); // string titel = ""; // switch (source.NEWSTYPEID) // { // case "0": titel = "新 闻"; break; // case "1": titel = "动 态"; break; // case "2": titel = "公 告"; break; // case "3": titel = "通 知"; break; // default: // break; // } // var host = ProgramManager.ShowProgram(titel, string.Empty, source.NEWSID, newsview, true, true, null); //} //catch (Exception ex) //{ //} }
private NewsModel EntityToModel(SMT.SAAS.Platform.WebParts.NewsWS.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); }
/// <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); }
void publicWS_AddContentCompleted(object sender, Saas.Tools.PublicInterfaceWS.AddContentCompletedEventArgs e) { SMT.SAAS.Platform.WebParts.NewsWS.T_PF_NEWS _entity = ModelToEntity(_currentAddModel); ObservableCollection <T_PF_DISTRIBUTEUSER> _buteuser = ModelEntity(_currentAddModel); _entity.NEWSCONTENT = new byte[0]; client.AddNewsByViewerAsync(_entity, _buteuser); client.AddNewsByViewerCompleted += (obj, args) => { bool result = false; if (args.Error.IsNull()) { result = args.Result; } if (OnExectNoQueryCompleted != null) { OnExectNoQueryCompleted(this, new ExectNoQueryEventArgs(result, args.Error)); } if (result) { callBackClient.TalkNewsAsync(new SMT.SAAS.Platform.WebParts.NewsCallBackWS.T_PF_NEWS() { COMMENTCOUNT = _entity.COMMENTCOUNT, CREATECOMPANYID = _entity.CREATECOMPANYID, CREATEDATE = _entity.CREATEDATE, CREATEDEPARTMENTID = _entity.CREATEDEPARTMENTID, CREATEPOSTID = _entity.CREATEPOSTID, CREATEUSERID = _entity.CREATEPOSTID, CREATEUSERNAME = _entity.CREATEUSERNAME, NEWSCONTENT = new byte[0], NEWSID = _entity.NEWSID, NEWSSTATE = _entity.NEWSSTATE, NEWSTITEL = _entity.NEWSTITEL, NEWSTYPEID = _entity.NEWSTYPEID, OWNERCOMPANYID = _entity.OWNERCOMPANYID, OWNERDEPARTMENTID = _entity.OWNERDEPARTMENTID, OWNERID = _entity.OWNERID, OWNERNAME = _entity.OWNERNAME, OWNERPOSTID = _entity.OWNERPOSTID, READCOUNT = _entity.READCOUNT, UPDATEDATE = _entity.UPDATEDATE, UPDATEUSERID = _entity.UPDATEUSERID, UPDATEUSERNAME = _entity.UPDATEUSERNAME }); } }; }
private SMT.SAAS.Platform.WebParts.NewsWS.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.Platform.WebParts.NewsWS.T_PF_NEWS model = new SMT.SAAS.Platform.WebParts.NewsWS.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.Length > 0 ? clientModel.NEWSID : Guid.NewGuid().ToString(), 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); }
private SMT.SAAS.Platform.WebParts.NewsWS.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.Platform.WebParts.NewsWS.T_PF_NEWS model = new SMT.SAAS.Platform.WebParts.NewsWS.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.Length > 0 ? clientModel.NEWSID : Guid.NewGuid().ToString(), 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; }