protected void btnSave_Click(object sender, EventArgs e) { string id = Request["id"]; try { var eventSolicitation = CreateNewPrefer(); if (!string.IsNullOrEmpty(id)) { eeSerivce.GenericService.Update(eventSolicitation); } else { eeSerivce.GenericService.Add(eventSolicitation); UMS_Message um = CreateUMS_Message(eventSolicitation); umsSercice.AddMessage(um); } eeSerivce.GenericService.Save(); Fxm.Utility.Page.JsHelper.CloseWindow(false, "数据保存成功!", "refresh();"); } catch (Exception ex) { Fxm.Utility.Page.MessageBox.Show("保存过程发生错误,请重试!"); //记录错误日志 NySoftland.Core.Log4.LogHelper.Error("活动召集添加异常[PreferentActionAdd.aspx]", ex); } }
protected void btnSave_Click(object sender, EventArgs e) { string id = Request["id"]; try { var auction = CreateNewPrefer(); if (!string.IsNullOrEmpty(id)) { auctionService.GenericService.Update(auction); } else { auctionService.GenericService.Add(auction); UMS_Message um = CreateUMS_Message(auction); umsSercice.AddMessage(um); } auctionService.GenericService.Save(); //Fxm.Utility.Page.MessageBox.Show("保存成功!"); //ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>RefreshParent();</script>"); Fxm.Utility.Page.JsHelper.CloseWindow(false, "数据保存成功!", "refresh();"); } catch (Exception ex) { Fxm.Utility.Page.MessageBox.Show("保存过程发生错误,请重试!"); //记录错误日志 NySoftland.Core.Log4.LogHelper.Error("活动召集添加异常[PreferentActionAdd.aspx]", ex); } }
private void Save() { try { if (!String.IsNullOrEmpty(Request["ID"])) { var item = GetEditItem(dropType.SelectedValue); dynamicService.GenericService.Update(item); //保存附件 UploadAttach.SaveAttach(item.ID); } else { var item2 = GetNewItem(dropType.SelectedValue); dynamicService.GenericService.Add(item2); UMS_Message um = CreateUMS_Message(item2); if (um != null) { umsSercice.AddMessage(um); } //保存附件 UploadAttach.SaveAttach(item2.ID); for (int i = 0; i < checkboxType.Items.Count; i++) { if (checkboxType.Items[i].Selected) { var item = GetNewItem(checkboxType.Items[i].Value); dynamicService.GenericService.Add(item); //保存附件 UploadAttach.SaveAttach(item.ID); } } } dynamicService.GenericService.Save(); Fxm.Utility.Page.JsHelper.CloseWindow(false, "数据保存成功!", "refresh();"); } catch (Exception ex) { Fxm.Utility.Page.MessageBox.Show("发生未处理异常,请重试!"); NySoftland.Core.Log4.LogHelper.Error("保存行内动态异常!", ex); } }
private UMS_Message CreateUMS_Message(Activities es) { Navigator nv = ns.GenericService.First(p => p.Title.Equals("活动召集")); UMS_Message um = new UMS_Message(); um.EngineType = EngineTypeEnum.WeChat.ToString(); um.To = "@all";//默认为向关注微信的全部成员发送 um.Subject = es.Name; um.Body = es.Summary; um.State = MessageStateEnum.Waiting.ToString(); um.ErrorCount = 0; um.CreateTime = DateTime.Now; um.Url = "/StaffHome/WxNY_Home_eventDetail.aspx?TopNavId=" + nv.ParentID + "&CurNavId=" + nv.ID + "&id=" + es.ID; um.EstimateTime = DateTime.Now; um.Source = ApplicationEnum.职工之家.ToString(); um.Images = es.ImageURL; return(um); }
protected void btnSave_Click(object sender, EventArgs e) { string id = Request["id"]; try { var eventSolicitation = CreateNewPrefer(); if (!string.IsNullOrEmpty(id)) { onlineService.GenericService.Update(eventSolicitation); onlineService.GenericService.Save(); var ee = onlineService.GenericService.GetModel(id); if (DateTime.Now < ee.BeginTime) { DeleteOteOptions(id); VoteAdd(eventSolicitation); } //保存附件 UploadAttach.SaveAttach(eventSolicitation.ID); } else { onlineService.GenericService.Add(eventSolicitation); onlineService.GenericService.Save(); VoteAdd(eventSolicitation); //保存附件 UploadAttach.SaveAttach(eventSolicitation.ID); UMS_Message um = CreateUMS_Message(eventSolicitation); umsSercice.AddMessage(um); } //Fxm.Utility.Page.MessageBox.Show("保存成功!"); //ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>RefreshParent();</script>"); Fxm.Utility.Page.JsHelper.CloseWindow(false, "数据保存成功!", "refresh();"); } catch (Exception ex) { Fxm.Utility.Page.MessageBox.Show("保存过程发生错误,请重试!"); //记录错误日志 NySoftland.Core.Log4.LogHelper.Error("在线评选添加异常[PreferentActionAdd.aspx]", ex); } }
private UMS_Message CreateUMS_Message(DZAFCPortal.Entity.News es) { NewsCategory ny = nc.GenericService.First(p => p.ID == es.CategoryID); Navigator nv = ns.GenericService.First(p => p.Title.Equals(ny.Name)); UMS_Message um = new UMS_Message(); //if (!ny.Name.Equals("培训信息") && !ny.Name.Equals("HR通知") && !ny.Name.Equals("职场氧吧")) //{ um.EngineType = EngineTypeEnum.WeChat.ToString(); um.To = "@all";//默认为向关注微信的全部成员发送 um.Subject = es.Title; //um.Body = es.Content; um.State = MessageStateEnum.Waiting.ToString(); um.ErrorCount = 0; um.CreateTime = DateTime.Now; um.Url = "/Pages/Content.aspx?TopNavId=" + nv.ParentID + "&CurNavId=" + nv.ID + "&ContentId=" + es.ID; DateTime dt = DateTime.Now; if (txtPulishTime.Text != null) { dt = DateTime.Parse(txtPulishTime.Text); } um.EstimateTime = dt; um.Source = ApplicationEnum.公司动态.ToString(); if (!string.IsNullOrEmpty(es.IndexImgUrl)) { um.Images = es.IndexImgUrl; } else { um.Images = ny.IndexImgUrl; } //} //else //{ // um = null; //} return(um); }
public void AddMessage(UMS_Message m) { context.UMS_Message.Add(m); context.SaveChanges(); }