Пример #1
0
 public int InsertHomePark(HomeParkModel homePark)
 {
     SqlParameter[] param = { new SqlParameter("@ParkID", SqlDbType.Int), new SqlParameter("@Code", SqlDbType.VarChar, 9),
                              new SqlParameter("@CarID",SqlDbType.VarChar,20),new SqlParameter("@Type",SqlDbType.VarChar,20),
                              new SqlParameter("@BuyDate",SqlDbType.DateTime,10),new SqlParameter("@Color",SqlDbType.VarChar,20)
                            };
     param[0].Value = homePark.ParkID;
     param[1].Value = homePark.Code;
     param[2].Value = homePark.CarID;
     param[3].Value = homePark.Type;
     param[4].Value = homePark.BuyDate;
     param[5].Value = homePark.Color;
     int result = SqlHelp.ExecuteNonQuery("prc_InsertHomePark", CommandType.StoredProcedure, param);
     return result;
 }
Пример #2
0
 protected void Modify_Click(object sender, EventArgs e)
 {
     HomeParkModel homePark = new HomeParkModel();
     homePark.ID = int.Parse(Request.QueryString["ID"]);
     homePark.ParkID = Convert.ToInt32(DDLType.SelectedValue);
     homePark.CarID = txtCarID.Text.Trim();
     homePark.Type = txtType.Text.Trim();
     homePark.Color = txtColor.Text.Trim();
     homePark.BuyDate = Convert.ToDateTime(txtBuyDate.Value);
     bool flag = bll.UpdateHomePark(homePark);
     if (flag)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改成功');location.href='HomeParkInfo.aspx';</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改失败');</script>");
     }
 }
Пример #3
0
 protected void Add_Click(object sender, EventArgs e)
 {
     HomeParkBLL bll = new HomeParkBLL();
     HomeParkModel homePark = new HomeParkModel();
     homePark.ParkID = Convert.ToInt32(DDLType.SelectedValue);
     homePark.Code = DDLRoomID.SelectedValue;
     homePark.CarID = txtCarID.Text.Trim();
     homePark.Type = txtType.Text.Trim();
     homePark.BuyDate = Convert.ToDateTime(txtBuyDate.Value);
     homePark.Color = txtColor.Text.Trim();
     bool flag = bll.InsertHomePark(homePark);
     if (flag)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('添加成功');location.href='HomeParkInfo.aspx';</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('添加失败');</script>");
     }
 }
Пример #4
0
 public HomeParkModel GetHomeParkByID(int id)
 {
     SqlParameter param = new SqlParameter("@ID", SqlDbType.Int);
     param.Value = id;
     SqlDataReader dr = SqlHelp.ExecuteReader("prc_GetHomeParkByID", CommandType.StoredProcedure,param);
     dr.Read();
     HomeParkModel homePark = new HomeParkModel();
     if(dr.HasRows)
     {                
         homePark.ID = Convert.ToInt32(dr[0]);
         homePark.ParkID = Convert.ToInt32(dr[1]);
         homePark.CarID = dr[2].ToString();
         homePark.Type = dr[3].ToString();
         homePark.BuyDate = Convert.ToDateTime(dr[4]);
         homePark.Color = dr[5].ToString();
         homePark.RoomID = dr[6].ToString();
     }
     dr.Close();
     return homePark;
 }
Пример #5
0
 public List<HomeParkModel> GetAllHomePark()
 {
     SqlDataReader dr = SqlHelp.ExecuteReader("prc_GetHomePark", CommandType.StoredProcedure);
     List<HomeParkModel> list = new List<HomeParkModel>();
     while (dr.Read())
     {
         HomeParkModel homePark = new HomeParkModel();
         homePark.ID = Convert.ToInt32(dr[0]);
         homePark.ParkID = Convert.ToInt32(dr[1]);
         homePark.Code = dr[2].ToString();
         homePark.CarID = dr[3].ToString();
         homePark.Type = dr[4].ToString();
         homePark.BuyDate = Convert.ToDateTime(dr[5]);
         homePark.Color = dr[6].ToString();
         homePark.ParkName = dr[7].ToString();
         homePark.RoomID = dr[8].ToString();
         list.Add(homePark);
     }
     dr.Close();
     return list;
 }
Пример #6
0
 public bool InsertHomePark(HomeParkModel homePark)
 {
     int result = dal.InsertHomePark(homePark);
     return result == 0 ? false : true;
 }
Пример #7
0
 public bool UpdateHomePark(HomeParkModel homePark)
 {
     int result = dal.UpdateHomePark(homePark);
     return result == 0 ? false : true;
 }