Exemple #1
0
 public void Add(M_LabelContent model)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Name", SqlDbType.NVarChar), new SqlParameter("@Content", SqlDbType.Text), new SqlParameter("@LbCategoryId", SqlDbType.Int), new SqlParameter("@ModeType", SqlDbType.Int), new SqlParameter("@LabelCategoryID", SqlDbType.Int), new SqlParameter("@AnomalyStyle", SqlDbType.Text) };
     commandParameters[0].Value = model.Name;
     commandParameters[1].Value = model.Content;
     commandParameters[2].Value = model.LbCategoryId;
     commandParameters[3].Value = model.ModeType;
     commandParameters[4].Value = 0;
     commandParameters[5].Value = model.AnomalyStyle;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_LabelContent_Set", commandParameters);
 }
Exemple #2
0
 public M_LabelContent GetLabelContentId(int labelCagegoryId)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@LabelCategoryID", SqlDbType.Int) };
     commandParameters[0].Value = labelCagegoryId;
     DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_LabelContent_GetInfo", commandParameters);
     if (table.Rows.Count > 0)
     {
         DataRow row = table.Rows[0];
         M_LabelContent content = new M_LabelContent();
         content.Name = row["Name"].ToString();
         content.Content = row["Content"].ToString();
         content.LbCategoryId = int.Parse(row["LbCategoryId"].ToString());
         content.AnomalyStyle = row["AnomalyStyle"].ToString();
         return content;
     }
     return null;
 }
    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>");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        AdminGroupBll.Power_Judge(6);
        if(!IsPostBack)
        {
            SkipPageUrl = Request.ServerVariables["HTTP_REFERER"].ToString();

            ModelBind();  //绑定模型列表
            lblInfo.Text = "创建标签";
            BindStyleCategory();
            if (Request.QueryString["labelCategoryId"]!=null)
            {
                lblInfo.Text = "修改标签";
                btnSave.Text = "修改标签";
                btnReset.Visible = false;
                M_LabelContent model = new M_LabelContent();
                B_LabelContent bll = new B_LabelContent();
                model = bll.GetLabelContentId(int.Parse(Request.QueryString["labelCategoryId"]));
                txtLabelName.Text = model.Name.Replace("{Ky_", "").Replace("}", "");
                lblContent.Value = model.Content;
                for (int i = 0; i < dllLbCategory.Items.Count;i++ )
                {
                    if (dllLbCategory.Items[i].Value==model.LbCategoryId.ToString())
                    {
                        dllLbCategory.Items[i].Selected = true;
                    }
                }
            }

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        AdminGroupBll.Power_Judge(10);
        AjaxPro.Utility.RegisterTypeForAjax(typeof(system_label_AnomalyContent));
        if(!IsPostBack)
        {
            SkipPageUrl = Request.ServerVariables["HTTP_REFERER"].ToString();

            ChannelBind();
            RepChannelBind(Chid);
            if (Request.QueryString["labelCategoryId"] != null)
            {
                btnSave.Text = "修改标签";
                btnReset.Visible = false;
                M_LabelContent model = new M_LabelContent();
                B_LabelContent bll = new B_LabelContent();
                model = bll.GetLabelContentId(int.Parse(Request.QueryString["labelCategoryId"]));
                txtName.Text = model.Name.Replace("{Ky_", "").Replace("}", "");
                txtContent.Value = model.AnomalyStyle;
            }
        }
    }
 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>");
     }
 }
Exemple #7
0
 public void Update(M_LabelContent model)
 {
     this.iLabelContent.Update(model);
 }
Exemple #8
0
 public void Add(M_LabelContent model)
 {
     this.iLabelContent.Add(model);
 }