public void UpdateApplyPromotion(SWfsSubjectApplyPromotion model) { DapperUtil.Update <SWfsSubjectApplyPromotion>(model); }
public JsonResult AddApply(SWfsSubjectApplyPromotion model) { if (Request.Form["flag"] == null) { return(Json(new { rs = "error", msg = "flag参数错误" })); } string flag = Request.Form["flag"].Trim(); if (string.IsNullOrWhiteSpace(flag)) { return(Json(new { rs = "error", msg = "flag参数错误" })); } if (string.IsNullOrWhiteSpace(model.SubjectNo)) { return(Json(new { rs = "error", msg = "subjectNo参数错误" })); } MarketOptionService service = new MarketOptionService(); SWfsSubjectApplyPromotion tempmodel = service.GetModelBySubjectNo(model.SubjectNo); flag = flag.ToLower(); #region 添加活动推广申请 if (flag.Equals("addapply")) { int rs = 0; model.ApplyUserId = PresentationHelper.GetPassport().UserName; if (tempmodel != null && tempmodel.APID > 0)//存在,则更新 { try { model.APID = tempmodel.APID; model.PromotionConfirmTime = tempmodel.PromotionConfirmTime; model.CreateDateTime = tempmodel.CreateDateTime; model.ConfirmEditDateTime = tempmodel.ConfirmEditDateTime; model.PromotionApplyTime = tempmodel.PromotionApplyTime; service.UpdateApplyPromotion(model); return(Json(1)); } catch (Exception e) { return(Json(e.Message)); } } else //添加 { model.PromotionConfirmTime = new DateTime(1900, 1, 1); model.CreateDateTime = DateTime.Now; model.ConfirmEditDateTime = new DateTime(1900, 1, 1); model.PromotionApplyTime = DateTime.Now;//推广申请时间目前默认是该条记录创建时间--后期也可以填写控制 try { rs = service.AddApply(model); return(Json(rs)); } catch (Exception e) { return(Json(e.Message)); } } } #endregion #region 确认活动推广信息 if (flag.Equals("checkapply")) { if (model.PromotionConfirmTime == new DateTime(0001, 1, 1) || model.PromotionConfirmTime == new DateTime(1900, 1, 1)) { return(Json(new { rs = "error", msg = "推广确认时间填写有误" })); } if (string.IsNullOrWhiteSpace(model.PromotionChannelNo)) { return(Json(new { rs = "error", msg = "推广渠道填写有误" })); } tempmodel.PromotionConfirmTime = model.PromotionConfirmTime;//推广时间 tempmodel.PromotionChannelNo = Request.Form["PromotionChannelNo"]; tempmodel.IsChecked = 1; tempmodel.ConfirmUserId = PresentationHelper.GetPassport().UserName; //确认推广的操作人 tempmodel.ConfirmEditDateTime = DateTime.Now; //确认这个操作的执行时间 try { service.UpdateApplyPromotion(tempmodel); return(Json(new { rs = "ok", msg = "确认成功" })); } catch (Exception e) { return(Json(new { rs = "error", msg = e.Message })); } } #endregion #region 修改SEO信息 if (flag.Equals("addseo")) { if (string.IsNullOrWhiteSpace(model.SeoTitle)) { return(Json(new { rs = "error", msg = "活动标题不能为空" })); } if (string.IsNullOrWhiteSpace(model.SeoKeyWords)) { return(Json(new { rs = "error", msg = "活动关键词不能为空" })); } if (string.IsNullOrWhiteSpace(model.SeoDescription)) { return(Json(new { rs = "error", msg = "活动描述不能为空" })); } tempmodel.SeoTitle = model.SeoTitle; tempmodel.SeoKeyWords = model.SeoKeyWords; tempmodel.SeoDescription = model.SeoDescription; try { service.UpdateApplyPromotion(tempmodel); return(Json(new { rs = "ok", msg = "确认成功" })); } catch (Exception e) { return(Json(new { rs = "error", msg = e.Message })); } } #endregion return(Json(new { rs = "error", msg = "flag参数错误" })); }
public int AddApply(SWfsSubjectApplyPromotion model) { return(DapperUtil.Insert <SWfsSubjectApplyPromotion>(model, true)); }