Exemple #1
0
    private bool DoAdd()
    {
        string strErr = "";

        if (this.txtreqKeywords.Text.Trim().Length == 0)
        {
            strErr += "关键词不能为空!";
        }
        if (this.txtrContent.Text.Trim().Length == 0)
        {
            strErr += "内容或简介不能为空!";
        }
        if (strErr != "")
        {
            JscriptMsg(strErr, "back", "Error");
            return(false);
        }

        Cms.Model.C_admin admin = adminUser.GetLoginState();


        Cms.Model.wx_requestRule rule = new Cms.Model.wx_requestRule();
        rule.uId          = admin.id;
        rule.wId          = 1;
        rule.ruleName     = "纯文本回复";
        rule.reqKeywords  = txtreqKeywords.Text.Trim();
        rule.reqestType   = 1;
        rule.responseType = 1;
        string radoValue = rblisLikeSearch.SelectedItem.Value;

        if (radoValue == "0")
        {
            rule.isLikeSearch = false;
        }
        else
        {
            rule.isLikeSearch = true;
        }
        rule.createDate = DateTime.Now;
        int rId = rBll.Add(rule);

        Cms.Model.wx_requestRuleContent rc = new Cms.Model.wx_requestRuleContent();
        rc.uId        = admin.id;
        rc.rId        = rId;
        rc.rContent   = txtrContent.Text.Trim();
        rc.createDate = DateTime.Now;
        int rcId = rcBll.Add(rc);


        if (rcId > 0)
        {
            adminUser.AddAdminLog(Enums.ActionEnum.Add.ToString(), "添加纯文本回复,主键为:" + rId + ",关键词为:" + txtreqKeywords.Text.Trim()); //记录日志
            return(true);
        }
        return(false);
    }
Exemple #2
0
    private void ShowInfo(int id)
    {
        Cms.Model.wx_requestRuleContent rc = rcBll.GetModel(id);
        txtTitle.Value = rc.rContent;
        txtImgUrl.Text = rc.picUrl;

        txtContent.Value = rc.rContent2;
        txtUrl.Value     = rc.detailUrl;
        txtSortId.Text   = rc.seq.Value.ToString();
    }
Exemple #3
0
    private bool DoEdit(int _id)
    {
        string strErr = "";

        if (this.txtreqKeywords.Text.Trim().Length == 0)
        {
            strErr += "关键词不能为空!";
        }
        if (this.txtrContent.Text.Trim().Length == 0)
        {
            strErr += "内容或简介不能为空!";
        }
        if (strErr != "")
        {
            JscriptMsg(strErr, "back", "Error");
            return(false);
        }


        Cms.Model.wx_requestRule rule = rBll.GetModel(id);
        rule.reqKeywords = txtreqKeywords.Text.Trim();
        string radoValue = rblisLikeSearch.SelectedItem.Value;

        if (radoValue == "0")
        {
            rule.isLikeSearch = false;
        }
        else
        {
            rule.isLikeSearch = true;
        }
        bool ret = rBll.Update(rule);
        IList <Cms.Model.wx_requestRuleContent> ruleContentList = rcBll.GetModelList("rId=" + id);

        if (ruleContentList != null && ruleContentList.Count > 0)
        {
            Cms.Model.wx_requestRuleContent ruleContent = ruleContentList[0];

            ruleContent.rContent = txtrContent.Text;
            ret = rcBll.Update(ruleContent);
        }
        if (ret)
        {
            adminUser.AddAdminLog(Enums.ActionEnum.Edit.ToString(), "修改纯文本回复,主键为:" + rule.id); //记录日志
            return(true);
        }
        return(false);
    }
Exemple #4
0
 //保存
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     Cms.Model.C_admin admin            = adminUser.GetLoginState();
     Cms.Model.wx_requestRuleContent rc = new Cms.Model.wx_requestRuleContent();
     if (id != 0)
     {
         rc = rcBll.GetModel(id);
     }
     if (id == 0)
     {
         rc.rId        = rid;
         rc.uId        = admin.id;
         rc.createDate = DateTime.Now;
     }
     rc.rContent  = txtTitle.Value.Trim();
     rc.picUrl    = txtImgUrl.Text;
     rc.rContent2 = txtContent.Value.Trim();
     rc.detailUrl = txtUrl.Value.Trim();
     rc.seq       = int.Parse(txtSortId.Text.Trim());
     if (id == 0)
     {
         int ret = rcBll.Add(rc);
         if (ret > 0)
         {
             JscriptMsg("修改图文回复内容信息成功!", "tuwenMgr.aspx?rid=" + rid, "Success");
         }
         else
         {
             JscriptMsg("保存过程中发生错误!", "", "Error");
             return;
         }
     }
     else
     {
         bool ret = rcBll.Update(rc);
         if (ret)
         {
             JscriptMsg("添加图文回复内容信息成功!", "tuwenMgr.aspx?rid=" + rid, "Success");
         }
         else
         {
             JscriptMsg("保存过程中发生错误!", "", "Error");
             return;
         }
     }
 }
Exemple #5
0
    //保存
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ////Cms.Model.C_user weixin = GetWeiXinCode();

        Cms.Model.wx_requestRuleContent rc = new Cms.Model.wx_requestRuleContent();
        int id = MyCommFun.Str2Int(hidid.Value);

        #region  //先判断
        string strErr = "";
        if (this.txtKW.Text.Trim().Length == 0)
        {
            strErr += "关键词不能为空!";
        }
        if (this.txtactName.Text.Trim().Length == 0)
        {
            strErr += "活动名称不能为空!";
        }
        if (this.txtbeginDate.Text.Trim().Length == 0 || !MyCommFun.isDateTime(txtbeginDate.Text))
        {
            strErr += "开始时间不能为空!";
        }
        if (this.txtendDate.Text.Trim().Length == 0 || !MyCommFun.isDateTime(txtendDate.Text))
        {
            strErr += "结束时间不能为空!";
        }
        if (txt1JXName.Text.Trim().Length == 0 || txt1JPName.Text.Trim().Length == 0 || txt1Num.Text.Trim().Length == 0 || txt1RealNum.Text.Trim().Length == 0)
        {
            strErr += "第一个奖项不能为空!";
        }
        if (txt2JXName.Text.Trim().Length == 0 || txt2JPName.Text.Trim().Length == 0 || txt2Num.Text.Trim().Length == 0 || txt2RealNum.Text.Trim().Length == 0)
        {
            strErr += "第二个奖项不能为空!";
        }

        if (strErr != "")
        {
            JscriptMsg(strErr, "back", "Error");
            return;
        }
        DateTime begin = DateTime.Parse(txtbeginDate.Text.Trim());
        DateTime end   = DateTime.Parse(txtendDate.Text.Trim());
        if (begin >= end)
        {
            JscriptMsg("开始时间必须小于结束时间", "back", "Error");
            return;
        }
        #endregion

        #region 赋值
        Cms.Model.wx_dzpActionInfo dzp  = new Cms.Model.wx_dzpActionInfo();
        Cms.Model.wx_requestRule   rule = new Cms.Model.wx_requestRule();

        string beginPic = imgbeginPic.ImageUrl;
        if (txtImgUrl.Text.Trim() != "")
        {
            beginPic = txtImgUrl.Text.Trim();
        }
        string endPic = imgEndPic.ImageUrl;
        if (txtEndPic.Text.Trim() != "")
        {
            endPic = txtEndPic.Text.Trim();
        }

        if (id > 0)
        {
            dzp = dzpBll.GetModel(id);
        }

        dzp.actName      = txtactName.Text.Trim();
        dzp.contractInfo = txtcontractInfo.Text.Trim();
        dzp.brief        = txtbrief.Value.Trim();
        dzp.beginDate    = begin;
        dzp.endDate      = end;
        dzp.actContent   = txtactContent.Value.Trim();
        dzp.cfcjhf       = txtcfcjhf.Text.Trim();
        dzp.endNotice    = txtendNotice.Text.Trim();
        dzp.endContent   = txtendContent.Text.Trim();
        dzp.djPwd        = txtdjPwd.Text.Trim();

        dzp.beginPic       = beginPic;
        dzp.endPic         = endPic;
        dzp.personNum      = MyCommFun.Str2Int(txtpersonNum.Text);
        dzp.personMaxTimes = MyCommFun.Str2Int(txtpersonMaxTimes.Text);
        dzp.dayMaxTimes    = MyCommFun.Str2Int(txtdayMaxTimes.Text);

        #endregion

        if (id <= 0)
        {  //新增
            dzp.wid        = 1;
            dzp.createDate = DateTime.Now;
            //1新增主表
            id = dzpBll.Add(dzp);

            //2新增奖项表
            EditAwardItem(id);
            //3 新增回复规则表
            AddRule(1, id);
            adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加大转盘活动,主键为" + id); //记录日志
            JscriptMsg("添加大转盘活动成功!", "dzplist.aspx", "Success");
        }
        else
        {   //修改
            //1修改主表
            dzpBll.Update(dzp);
            //2删除,且新增奖项表
            EditAwardItem(id);
            //3 修改回复规则表
            IList <Cms.Model.wx_requestRule> rlist = rBll.GetModelList("modelFunctionName = '大转盘' and modelFunctionId=" + id);

            if (rlist != null && rlist.Count > 0)
            {
                rule             = rlist[0];
                rule.reqKeywords = txtKW.Text.Trim();
                rBll.Update(rule);
            }
            else
            {
                AddRule(1, id);
            }

            adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改大转盘活动,主键为" + id); //记录日志
            JscriptMsg("修改大转盘活动成功!", "dzplist.aspx", "Success");
        }
    }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Cms.Model.wx_requestRuleContent model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Cms.Model.wx_requestRuleContent model)
 {
     return(dal.Add(model));
 }