public int UpdateChargeFreeType(ChargeFreeTypeModel chargeFeeType) { SqlParameter[] param = { new SqlParameter("@TypeID", SqlDbType.Int), new SqlParameter("@Price", SqlDbType.Float) }; param[0].Value = chargeFeeType.TypeID; param[1].Value = chargeFeeType.Price; int result = SqlHelp.ExecuteNonQuery("prc_UpdateChargeFreeType", CommandType.StoredProcedure, param); return result; }
public int InsertChargeFeeType(ChargeFreeTypeModel chargeFeeType) { SqlParameter[] param = { new SqlParameter("@Name", SqlDbType.VarChar, 20), new SqlParameter("@Price", SqlDbType.Float), new SqlParameter("@Format",SqlDbType.VarChar,20) }; param[0].Value = chargeFeeType.TypeName; param[1].Value = chargeFeeType.Price; param[2].Value = chargeFeeType.Format; int result = SqlHelp.ExecuteNonQuery("prc_InsertChargeFeeType", CommandType.StoredProcedure, param); return result; }
protected void Add_Click(object sender, EventArgs e) { ChargeFreeTypeModel chargefeeType = new ChargeFreeTypeModel(); chargefeeType.TypeName = txtFeeName.Text.Trim(); chargefeeType.Price = Convert.ToDouble(txtPrice.Text.Trim()); chargefeeType.Format = txtFormat.Text.Trim(); bool flag = bll.InsertChargeFeeType(chargefeeType); if (flag) { Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('添加成功');location.href='ChargeFeeTypeInfo.aspx';</script>"); } else { Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('添加失败');</script>"); } }
public ChargeFreeTypeModel GetChargeFreeTypeByID(int typeID) { SqlParameter param = new SqlParameter("@TypeID", SqlDbType.Int); param.Value = typeID; SqlDataReader dr = SqlHelp.ExecuteReader("prc_GetChargeFreeTypeByID", CommandType.StoredProcedure, param); dr.Read(); ChargeFreeTypeModel chargefree = new ChargeFreeTypeModel(); if (dr.HasRows) { chargefree.TypeName = dr[0].ToString(); chargefree.Price = Convert.ToDouble(dr[1]); chargefree.Format = dr[2].ToString(); } dr.Close(); return chargefree; }
public List<ChargeFreeTypeModel> GetChargeFreeType() { SqlDataReader dr = SqlHelp.ExecuteReader("prc_GetChargeFreeType", CommandType.StoredProcedure); List<ChargeFreeTypeModel> list = new List<ChargeFreeTypeModel>(); while (dr.Read()) { ChargeFreeTypeModel chargefree = new ChargeFreeTypeModel(); chargefree.TypeID = Convert.ToInt32(dr[0]); chargefree.TypeName = dr[1].ToString(); chargefree.Price = Convert.ToDouble(dr[2]); chargefree.Format = dr[3].ToString(); list.Add(chargefree); } dr.Close(); return list; }
protected void Page_Load(object sender, EventArgs e) { user = (UserModel)Session["User"]; if (Session["User"] == null || Session["User"].ToString() == "" || user.UserType != 1) Response.Redirect("../Login.aspx"); else { if (!IsPostBack) { int typeID = Convert.ToInt32(Request.QueryString["ID"].ToString()); chargeFeeType = bll.GetChargeFreeTypeByID(typeID); lbName.Text = chargeFeeType.TypeName; lbFormat.Text = chargeFeeType.Format; txtPrice.Text = chargeFeeType.Price.ToString(); } } }
public bool InsertChargeFeeType(ChargeFreeTypeModel chargeFreeType) { int result = dal.InsertChargeFeeType(chargeFreeType); return result == 0 ? false : true; }
public bool UpdateChargeFreeType(ChargeFreeTypeModel chargeFeeType) { int result = dal.UpdateChargeFreeType(chargeFeeType); return result == 0 ? false : true; }