protected void btnSave_Click(object sender, EventArgs e) { M_Style mStyle = new M_Style(); mStyle.StyleCategoryId = int.Parse(ddlStyleType.SelectedValue.ToString()); mStyle.StyleCategoryId = 1; mStyle.Name = txtTypeName.Text.Trim(); B_KyCommon bllCom = new B_KyCommon(); bool flag = bllCom.CheckHas(mStyle.Name, "Name", "KyStyle"); mStyle.Content = test.Value.Trim(); mStyle.Type = modelId; B_Style bllStyle = new B_Style(); if (btnSave.Text == "添加样式") { if (!flag) { bllStyle.AddStyle(mStyle); StyleBind(); } else { Response.Write("<script>alert('己存在此样式')</script>"); StyleBind(); } } }
public void AddStyle(M_Style mStyle) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@StyleCategoryId", SqlDbType.Int), new SqlParameter("@Name", SqlDbType.NVarChar), new SqlParameter("@Content", SqlDbType.NVarChar), new SqlParameter("@Type", SqlDbType.Int) }; commandParameters[0].Value = mStyle.StyleCategoryId; commandParameters[1].Value = mStyle.Name; commandParameters[2].Value = mStyle.Content; commandParameters[3].Value = mStyle.Type; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "UP_Style_ADD", commandParameters); }
public M_Style GetStyle(int styleId) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@StyleID", SqlDbType.Int) }; commandParameters[0].Value = styleId; DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "UP_Style_GetId", commandParameters); M_Style style = new M_Style(); if (table.Rows.Count > 0) { style.StyleCategoryId = int.Parse(table.Rows[0]["StyleCategoryId"].ToString()); style.Name = table.Rows[0]["Name"].ToString(); style.Content = table.Rows[0]["Content"].ToString(); style.Type = int.Parse(table.Rows[0]["Type"].ToString()); } else { return null; } return style; }
public void UpadteStyle(M_Style mStyle) { this.iStyle.UpdateStyle(mStyle); }
public void AddStyle(M_Style mStyle) { this.iStyle.AddStyle(mStyle); }
protected void btnSave_Click(object sender, EventArgs e) { string id; if (Request.QueryString["id"] == null) { id = Request.QueryString["modelId"].ToString(); } else { id = Request.QueryString["id"].ToString(); } M_Style mStyle = new M_Style(); mStyle.StyleCategoryId = int.Parse(ddlStyleType.SelectedValue.ToString()); mStyle.Name = txtTypeName.Text.Trim(); B_KyCommon bllCom = new B_KyCommon(); bool flag = bllCom.CheckHas(mStyle.Name, "Name", "KyStyle"); mStyle.Content = test.Value.Trim(); mStyle.Type = int.Parse(id); B_Style bllStyle = new B_Style(); if (btnSave.Text == "添加样式") { if (!flag) { bllStyle.AddStyle(mStyle); Response.Redirect(SkipPageUrl); } else Response.Write("<script>alert('此样式已存在')</script>"); } else { mStyle.StyleID = int.Parse(Request.QueryString["StyleId"].ToString()); bllStyle.UpadteStyle(mStyle); Response.Redirect(SkipPageUrl); } }