public void SaveActivitySubject(HttpContext context) { try { string id = context.Request.Form["ctl00$cphMain$hId"].Trim(); string sTitle = context.Request.Form["ctl00$cphMain$txtTitle"].Trim(); string sContent = context.Request.Form["content"].Trim(); string sPictureId = context.Request.Form["pictureId"].Trim(); string startDate = context.Request.Form["ctl00$cphMain$startDate"].Trim(); string endDate = context.Request.Form["ctl00$cphMain$endDate"].Trim(); string sSort = context.Request.Form["ctl00$cphMain$txtSort"].Trim(); string sMaxVoteCount = context.Request.Form["ctl00$cphMain$txtMaxVoteCount"].Trim(); sMaxVoteCount = sMaxVoteCount == "" ? "0" : sMaxVoteCount; string sMaxSignUpCount = context.Request.Form["ctl00$cphMain$txtMaxSignUpCount"].Trim(); sMaxSignUpCount = sMaxSignUpCount == "" ? "0" : sMaxSignUpCount; string sActualSignUpCount = context.Request.Form["ctl00$cphMain$txtActualSignUpCount"].Trim(); sActualSignUpCount = sActualSignUpCount == "" ? "0" : sActualSignUpCount; string sUpdateSignUpCount = context.Request.Form["ctl00$cphMain$txtUpdateSignUpCount"].Trim(); sUpdateSignUpCount = sUpdateSignUpCount == "" ? "0" : sUpdateSignUpCount; string sViewCount = context.Request.Form["ctl00$cphMain$txtViewCount"].Trim(); sViewCount = sViewCount == "" ? "0" : sViewCount; string sSignUpRule = context.Request.Form["signUpRule"].Trim(); string sHideAttr = context.Request.Form["hideAttr"].Trim(); string sIsPrize = context.Request.Form["isPrize"].Trim(); string sPrizeProbability = context.Request.Form["ctl00$cphMain$txtPrizeProbability"].Trim(); sPrizeProbability = sPrizeProbability == "" ? "0" : sPrizeProbability; string sPrizeRule = context.Request.Form["PrizeRule"].Trim(); string sIsDisable = context.Request.Form["isDisable"].Trim(); bool isPush = bool.Parse(context.Request.Form["isPush"].Trim()); sContent = HttpUtility.HtmlDecode(sContent); sSignUpRule = HttpUtility.HtmlDecode(sSignUpRule); sPrizeRule = HttpUtility.HtmlDecode(sPrizeRule); Guid gId = Guid.Empty; if (id != "") { Guid.TryParse(id, out gId); } Guid pictureId = Guid.Empty; Guid.TryParse(sPictureId, out pictureId); ActivitySubjectNewInfo model = new ActivitySubjectNewInfo(); model.LastUpdatedDate = DateTime.Now; model.Remark = ""; model.Id = gId; model.Title = sTitle; model.ContentText = sContent; model.StartDate = DateTime.Parse(startDate); model.EndDate = DateTime.Parse(endDate); model.Sort = int.Parse(sSort); model.MaxVoteCount = int.Parse(sMaxVoteCount); model.MaxSignUpCount = int.Parse(sMaxSignUpCount); model.SignUpCount = int.Parse(sActualSignUpCount); model.VirtualSignUpCount = int.Parse(sUpdateSignUpCount); model.ViewCount = int.Parse(sViewCount); model.SignUpRule = sSignUpRule; model.HiddenAttribute = sHideAttr.Length > 0 ? sHideAttr.TrimEnd(',') : sHideAttr; model.IsPrize = bool.Parse(sIsPrize); model.PrizeProbability = int.Parse(sPrizeProbability); model.PrizeRule = sPrizeRule; model.IsDisable = bool.Parse(sIsDisable); if (string.IsNullOrWhiteSpace(model.ContentText)) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Params_InvalidError + "\"}"); return; } if (string.IsNullOrWhiteSpace(model.SignUpRule)) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Params_InvalidError + "\"}"); return; } ActivitySubjectNew bll = new ActivitySubjectNew(); ActivityPictureNew bllAP = new ActivityPictureNew(); ActivityPictureNewInfo infoAP = new ActivityPictureNewInfo(); int effect = -1; if (!gId.Equals(Guid.Empty)) { effect = bll.Update(model); if (effect > 0) { infoAP.ActivityId = model.Id; infoAP.PictureId = pictureId; bllAP.Delete(model.Id); bllAP.Insert(infoAP); } } else { model.InsertDate = DateTime.Now; Guid activityId = bll.InsertByOutput(model); if (!activityId.Equals(Guid.Empty)) { effect = 1; if (!pictureId.Equals(Guid.Empty)) { infoAP.ActivityId = activityId; infoAP.PictureId = pictureId; bllAP.Insert(infoAP); } } } if (effect == 110) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Exist + "\"}"); return; } if (effect < 1) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Error + "\"}"); return; } if (isPush) { #region 推送信息到推送服务系统 try { PushContentService pushProxy = new PushContentService(); if (System.Configuration.ConfigurationManager.AppSettings["PushServiceUrl"] != null) { pushProxy.Url = System.Configuration.ConfigurationManager.AppSettings["PushServiceUrl"].ToString(); } string sxml = ""; sxml = string.Format(@"<XmlParameters><ReceivePushContent><PushType>{0}</PushType><PushContent>{1}</PushContent><Title>{2}</Title><PushParam>{3}</PushParam></ReceivePushContent></XmlParameters>", "hd", "", model.Title, "1##" + model.Id); //string rt = pushProxy.ReceivePushContent(sxml); pushProxy.ReceivePushContentAsync(sxml); } catch { } #endregion } context.Response.Write("{\"success\": true,\"message\": \"" + MessageContent.Submit_Success + "\"}"); } catch (Exception ex) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.AlertTitle_Ex_Error + ":" + ex.Message + "\"}"); } }
public void SaveInformation(HttpContext context) { try { string id = context.Request.Form["ctl00$cphMain$hId"].Trim(); string sTitle = context.Request.Form["ctl00$cphMain$txtTitle"].Trim(); string sSummary = context.Request.Form["ctl00$cphMain$txtSummary"].Trim(); string sSource = context.Request.Form["ctl00$cphMain$txtSource"].Trim(); string sRemark = context.Request.Form["ctl00$cphMain$txtRemark"].Trim(); string sContent = context.Request.Form["content"].Trim(); string sIsDisable = context.Request.Form["isDisable"].Trim(); string sViewType = context.Request.Form["rdViewType"].Trim(); string sSort = context.Request.Form["ctl00$cphMain$txtSort"].Trim(); sSort = sSort == "" ? "0" : sSort; string sViewCount = context.Request.Form["ctl00$cphMain$txtViewCount"].Trim(); sViewCount = sViewCount == "" ? "0" : sViewCount; string sPictureIdList = context.Request.Form["pictureId"].TrimEnd(','); string sIsPush = context.Request.Form["isPush"].Trim(); sContent = HttpUtility.HtmlDecode(sContent); Guid gId = Guid.Empty; if (id != "") { Guid.TryParse(id, out gId); } InformationInfo model = new InformationInfo(); model.LastUpdatedDate = DateTime.Now; model.Remark = sRemark; model.Id = gId; model.Title = sTitle; model.Summary = sSummary; model.Source = sSource; model.ContentText = sContent; model.Sort = int.Parse(sSort); model.ViewCount = int.Parse(sViewCount); model.ViewType = byte.Parse(sViewType); model.IsDisable = bool.Parse(sIsDisable); model.IsPush = bool.Parse(sIsPush); if (string.IsNullOrWhiteSpace(model.ContentText)) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Params_InvalidError + "\"}"); return; } Information bll = new Information(); InformationPicture bllPP = new InformationPicture(); int effect = -1; if (!gId.Equals(Guid.Empty)) { effect = bll.Update(model); if (effect > 0) { bllPP.Delete(model.Id); if (!string.IsNullOrWhiteSpace(sPictureIdList)) { foreach (string sPictureId in sPictureIdList.Split(',')) { InformationPictureInfo infoPP = new InformationPictureInfo(); Guid pictureId = Guid.Empty; Guid.TryParse(sPictureId, out pictureId); infoPP.InformationId = model.Id; infoPP.PictureId = pictureId; bllPP.InsertModel(infoPP); } } } } else { model.LastUpdatedDate = DateTime.Now; Guid anformationId = bll.InsertByOutput(model); if (!anformationId.Equals(Guid.Empty)) { effect = 1; if (!string.IsNullOrWhiteSpace(sPictureIdList)) { foreach (string sPictureId in sPictureIdList.Split(',')) { InformationPictureInfo infoPP = new InformationPictureInfo(); Guid pictureId = Guid.Empty; Guid.TryParse(sPictureId, out pictureId); infoPP.InformationId = anformationId; infoPP.PictureId = pictureId; bllPP.InsertModel(infoPP); } } } } if (effect == 110) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Exist + "\"}"); return; } if (effect < 1) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Error + "\"}"); return; } if (model.IsPush) { #region 推送信息到推送服务系统 try { PushContentService pushProxy = new PushContentService(); if (System.Configuration.ConfigurationManager.AppSettings["PushServiceUrl"] != null) { pushProxy.Url = System.Configuration.ConfigurationManager.AppSettings["PushServiceUrl"].ToString(); } string sxml = ""; sxml = string.Format(@"<XmlParameters><ReceivePushContent><PushType>{0}</PushType><PushContent>{1}</PushContent><Title>{2}</Title><PushParam>{3}</PushParam></ReceivePushContent></XmlParameters>", "xwfb", "", model.Title, "1"); pushProxy.ReceivePushContentAsync(sxml); } catch { } #endregion } context.Response.Write("{\"success\": true,\"message\": \"" + MessageContent.Submit_Success + "\"}"); } catch (Exception ex) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.AlertTitle_Ex_Error + ":" + ex.Message + "\"}"); } }
public void SavePushMsg(HttpContext context) { try { string id = context.Request.Form["ctl00$cphMain$hId"].Trim(); string sTitle = context.Request.Form["ctl00$cphMain$txtTitle"].Trim(); string sPushContent = context.Request.Form["ctl00$cphMain$txtPushContent"].Trim(); string sSendRange = context.Request.Form["ctl00$cphMain$txtSendRange"].Trim(); string sckAll = context.Request.Form["ctl00$cphMain$ckAll"]; Guid gId = Guid.Empty; PushMsgInfo model = new PushMsgInfo(); model.LastUpdatedDate = DateTime.Now; model.Id = gId; model.Title = sTitle; model.PushContent = sPushContent; string PushParam = "1"; if (null != sckAll) { model.SendRange = "全部"; } else { model.SendRange = "个人"; if (-1 == sSendRange.IndexOf(',')) { PushParam = "2@@" + sSendRange; } else { PushParam = "3@@" + sSendRange; } } model.PushType = "zdy"; if (string.IsNullOrWhiteSpace(model.Title) || string.IsNullOrWhiteSpace(model.PushContent)) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Params_InvalidError + "\"}"); return; } PushMsg bll = new PushMsg(); int effect = -1; model.LastUpdatedDate = DateTime.Now; Guid pushMsgId = bll.InsertByOutput(model); if (!pushMsgId.Equals(Guid.Empty)) { effect = 1; if (!PushParam.Equals("1")) { PushUser bllPushUser = new PushUser(); PushUserInfo pushUserInfo = new PushUserInfo(); pushUserInfo.PushId = pushMsgId; pushUserInfo.PushUser = sSendRange; bllPushUser.InsertOW(pushUserInfo); } } if (effect == 110) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Exist + "\"}"); return; } if (effect < 1) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.Submit_Error + "\"}"); return; } #region 推送信息到推送服务系统 try { PushContentService pushProxy = new PushContentService(); if (System.Configuration.ConfigurationManager.AppSettings["PushServiceUrl"] != null) { pushProxy.Url = System.Configuration.ConfigurationManager.AppSettings["PushServiceUrl"].ToString(); } string sxml = ""; sxml = string.Format(@"<XmlParameters><ReceivePushContent><PushType>{0}</PushType><PushContent>{1}</PushContent><Title>{2}</Title><PushParam>{3}</PushParam></ReceivePushContent></XmlParameters>", "zdy", model.PushContent, model.Title, PushParam); pushProxy.ReceivePushContentAsync(sxml); } catch { } #endregion context.Response.Write("{\"success\": true,\"message\": \"" + MessageContent.Submit_Success + "\"}"); } catch (Exception ex) { context.Response.Write("{\"success\": false,\"message\": \"" + MessageContent.AlertTitle_Ex_Error + ":" + ex.Message + "\"}"); } }