コード例 #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        M_LabelContent model = new M_LabelContent();
        B_LabelContent bll = new B_LabelContent();
        B_KyCommon bllCom = new B_KyCommon();
        bool flag = false;
        if (txtLabelName.Text.Length==1 || !(txtLabelName.Text.ToString().Substring(0, 2).ToLower() == "s_"))
        {
            model.Name = lblPrefix.Text.ToString() + txtLabelName.Text.Trim() + lblPostfix.Text.ToString();
            model.LbCategoryId = int.Parse(dllLbCategory.SelectedValue.ToString());
            model.Content = lblContent.Value;
            model.AnomalyStyle = string.Empty;
            model.ModeType = int.Parse(hidModelId.Value.ToString());

            flag = bllCom.CheckHas(model.Name, "Name", "KyLabelContent");
            if (btnSave.Text == "修改标签")
            {
                model.LabelCategoryID = int.Parse(Request.QueryString["labelCategoryId"]);
                model.AnomalyStyle = string.Empty;
                bll.Update(model);
                Response.Redirect(SkipPageUrl);
            }
            else
            {
                if (!flag)
                {
                    bll.Add(model);
                    Response.Redirect(SkipPageUrl);
                }
                else
                    Response.Write("<script>alert('此标签已存在');</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('此标签与超级标签冲突');</script>");
        }
    }
コード例 #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     M_LabelContent model = new M_LabelContent();
     B_LabelContent bll = new B_LabelContent();
     B_KyCommon bllCom = new B_KyCommon();
     bool flag = false;
     if (!(txtName.Text.ToString().Substring(0, 2).ToLower() == "s_"))
     {
         model.Name = lblPrefix.Text.ToString() + txtName.Text.Trim() + lblPostfix.Text.ToString();
         model.LbCategoryId = 1;
         model.Content = GetContent(txtContent.Value);
         model.AnomalyStyle = txtContent.Value;
         ChannelM = ChannelBll.GetChannel(Chid);
         int modelId = ChannelM.ModelType;
         model.ModeType = modelId;
         flag = bllCom.CheckHas(model.Name, "Name", "KyLabelContent");
         if (btnSave.Text == "修改标签")
         {
             model.LabelCategoryID = int.Parse(Request.QueryString["labelCategoryId"]);
             bll.Update(model);
             Response.Redirect(SkipPageUrl);
         }
         else
         {
             if (!flag)
             {
                 bll.Add(model);
                 Response.Redirect(SkipPageUrl);
             }
             else
                 Response.Write("<script>alert('此标签己存在');</script>");
         }
     }
     else
     {
         Response.Write("<script>alert('此标签与超级标签冲突');</script>");
     }
 }