Ejemplo n.º 1
0
 public int InsertBasePark(BaseParkModel basePark)
 {
     SqlParameter[] param = { new SqlParameter("@Name", SqlDbType.VarChar, 20), new SqlParameter("@Amount", SqlDbType.Int),
                              new SqlParameter("@Memo",SqlDbType.VarChar,50)
                            };
     param[0].Value = basePark.Name;
     param[1].Value = basePark.Amount;
     param[2].Value = basePark.Memo;
     int result = SqlHelp.ExecuteNonQuery("prc_InsertBasePark", CommandType.StoredProcedure, param);
     return result;
 }
Ejemplo n.º 2
0
 public List<BaseParkModel> GetBasePark()
 {
     SqlDataReader dr = SqlHelp.ExecuteReader("prc_GetBasePark", CommandType.StoredProcedure);
     List<BaseParkModel> list = new List<BaseParkModel>();
     while (dr.Read())
     {
         BaseParkModel basePark = new BaseParkModel();
         basePark.ParkID = Convert.ToInt32(dr[0]);
         basePark.Name = dr[1].ToString();
         basePark.Amount = Convert.ToInt32(dr[2]);
         basePark.Memo = dr[3].ToString();
         list.Add(basePark);
     }
     dr.Close();
     return list;
 }
Ejemplo n.º 3
0
 protected void Add_Click(object sender, EventArgs e)
 {
     BaseParkModel basePark = new BaseParkModel();
     basePark.Name = txtParkName.Text.Trim();
     basePark.Amount = Convert.ToInt32(txtParkAmount.Text.Trim());
     basePark.Memo = txtMemo.Text.Trim();
     bool flag = bll.InsertBasePark(basePark);
     if (flag)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('添加成功');location.href='BaseParkInfo.aspx';</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('添加失败');</script>");
     }
 }
Ejemplo n.º 4
0
 public BaseParkModel GetBaseParkByID(int parkID)
 {
     SqlParameter param = new SqlParameter("@ParkID", SqlDbType.Int);
     param.Value = parkID;
     SqlDataReader dr = SqlHelp.ExecuteReader("prc_GetBaseParkByID", CommandType.StoredProcedure, param);
     dr.Read();
     BaseParkModel basePark = new BaseParkModel();
     if (dr.HasRows)
     {
         basePark.ParkID = Convert.ToInt32(dr[0]);
         basePark.Name = dr[1].ToString();
         basePark.Amount = Convert.ToInt32(dr[2]);
         basePark.Memo = dr[3].ToString();
     }
     dr.Close();
     return basePark;
 }
Ejemplo n.º 5
0
 protected void Modify_Click(object sender, EventArgs e)
 {
     BaseParkModel basePark = new BaseParkModel();
     basePark.ParkID = int.Parse(Request.QueryString["ID"]);
     basePark.Name = txtParkName.Text.Trim();
     basePark.Amount = Convert.ToInt32(txtParkAmount.Text.Trim());
     basePark.Memo = txtMemo.Text.Trim();
     bool flag = bll.UpdateBasePark(basePark);
     if (flag)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改成功');location.href='BaseParkInfo.aspx';</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改失败');</script>");
     }
 }
Ejemplo n.º 6
0
 public bool InsertBasePark(BaseParkModel basePark)
 {
     int result = dal.InsertBasePark(basePark);
     return result == 0 ? false : true;
 }
Ejemplo n.º 7
0
 public bool UpdateBasePark(BaseParkModel basePark)
 {
     int result = dal.UpdateBasePark(basePark);
     return result == 0 ? false : true;
 }