예제 #1
0
 protected void Add_Click(object sender, EventArgs e)
 {
     PavilionModel pavilion = new PavilionModel();
     int i = pabll.GetMaxID();
     if (i == -1)
     {
         pavilion.PaID = "100";
     }
     else
     {
         pavilion.PaID = (i + 1).ToString();
     }
     pavilion.Name = txtPavilionName.Text.Trim();
     pavilion.Layer = Convert.ToInt32(txtPavilionLayer.Text.Trim());
     pavilion.Height = Convert.ToDouble(txtPavilionHeight.Text.Trim());
     pavilion.Area = Convert.ToDouble(txtPavilionArea.Text.Trim());
     pavilion.BuildDate = Convert.ToDateTime(txtBuildDate.Value.Trim());
     pavilion.TypeID = Convert.ToInt32(DDLPavilionType.SelectedValue);
     pavilion.Memo = txtMemo.Text.Trim();
     bool flag = pabll.InsertPavilion(pavilion);
     if (flag)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('添加成功');location.href='PavilionInfo.aspx';</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('添加失败');</script>");
     }
 }
예제 #2
0
 public List<PavilionModel> GetAllPavilion()
 {
     SqlDataReader dr = SqlHelp.ExecuteReader("prc_GetAllPavilion", CommandType.StoredProcedure);
     List<PavilionModel> list = new List<PavilionModel>();
     while (dr.Read())
     {
         PavilionModel pavilion = new PavilionModel();
         pavilion.PaID = dr[0].ToString();
         pavilion.Name = dr[1].ToString();
         pavilion.Layer = Convert.ToInt32(dr[2]);
         pavilion.Height = Convert.ToDouble(dr[3]);
         pavilion.Area = Convert.ToDouble(dr[4]);
         pavilion.BuildDate = Convert.ToDateTime(dr[5]);
         pavilion.Memo = dr[6].ToString();
         pavilion.TypeName = dr[7].ToString();
         list.Add(pavilion);
     }
     dr.Close();
     return list;
 }
예제 #3
0
 protected void Edit_Click(object sender, EventArgs e)
 {
     PavilionModel pavilion = new PavilionModel();
     pavilion.PaID = Request.QueryString["ID"].ToString();
     pavilion.Name = txtPavilionName.Text.Trim();
     pavilion.Layer = Convert.ToInt32(txtPavilionLayer.Text.Trim());
     pavilion.Height = Convert.ToDouble(txtPavilionHeight.Text.Trim());
     pavilion.Area = Convert.ToDouble(txtPavilionArea.Text.Trim());
     pavilion.BuildDate = Convert.ToDateTime(txtBuildDate.Value.Trim());
     pavilion.TypeID = Convert.ToInt32(DDLPavilionType.SelectedValue);
     pavilion.Memo = txtMemo.Text.Trim();
     bool flag = pabll.UpdatePavilion(pavilion);
     if (flag)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改成功');location.href='PavilionInfo.aspx';</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改失败');</script>");
     }
 }
예제 #4
0
 public List<PavilionModel> GetPavilionByCondition(string condition)
 {
     SqlParameter param = new SqlParameter("@Condition", SqlDbType.VarChar, 255);
     param.Value = condition;
     SqlDataReader dr = SqlHelp.ExecuteReader("prc_GetPavilionByCondition", CommandType.StoredProcedure,param);
     List<PavilionModel> list = new List<PavilionModel>();
     while (dr.Read())
     {
         PavilionModel pavilion = new PavilionModel();
         pavilion.PaID = dr[0].ToString();
         pavilion.Name = dr[1].ToString();
         pavilion.Layer = Convert.ToInt32(dr[2]);
         pavilion.Height = Convert.ToDouble(dr[3]);
         pavilion.Area = Convert.ToDouble(dr[4]);
         pavilion.BuildDate = Convert.ToDateTime(dr[5]);
         pavilion.Memo = dr[6].ToString();
         pavilion.TypeName = dr[7].ToString();
         list.Add(pavilion);
     }
     dr.Close();
     return list;
 }
예제 #5
0
 public PavilionModel GetPavilionByID(string paID)
 {
     SqlParameter param = new SqlParameter("@PaID", SqlDbType.VarChar, 3);
     param.Value = paID;
     SqlDataReader dr = SqlHelp.ExecuteReader("prc_GetPavilionByID", CommandType.StoredProcedure, param);
     dr.Read();
     PavilionModel pavilion = new PavilionModel();
     if (dr.HasRows)
     {
         pavilion.PaID = dr[0].ToString();
         pavilion.Name = dr[1].ToString();
         pavilion.Layer = Convert.ToInt32(dr[2]);
         pavilion.Height = Convert.ToDouble(dr[3]);
         pavilion.Area = Convert.ToDouble(dr[4]);
         pavilion.BuildDate = Convert.ToDateTime(dr[5]);
         pavilion.Memo = dr[6].ToString();
         pavilion.TypeName = dr[7].ToString();
         pavilion.TypeID = Convert.ToInt32(dr[8]);
     }
     dr.Close();
     return pavilion;
 }
예제 #6
0
 public bool InsertPavilion(PavilionModel pavilion)
 {
     int result = dal.InsertPavilion(pavilion);
     return result == 0 ? false : true;
 }
예제 #7
0
 public bool UpdatePavilion(PavilionModel pavilion)
 {
     int result = dal.UpdatePavilion(pavilion);
     return result == 0 ? false : true;
 }
예제 #8
0
 public int UpdatePavilion(PavilionModel pavilion)
 {
     SqlParameter[] param = { new SqlParameter("@PaID", SqlDbType.VarChar, 3), new SqlParameter("@Name", SqlDbType.VarChar, 20),
                              new SqlParameter("@Layer",SqlDbType.SmallInt),new SqlParameter("@Height",SqlDbType.Float),
                              new SqlParameter("@Area",SqlDbType.Float),new SqlParameter("@BuildDate",SqlDbType.DateTime,10),
                              new SqlParameter("@Memo",SqlDbType.Text),new SqlParameter("@TypeID",SqlDbType.Int)
                            };
     param[0].Value = pavilion.PaID;
     param[1].Value = pavilion.Name;
     param[2].Value = pavilion.Layer;
     param[3].Value = pavilion.Height;
     param[4].Value = pavilion.Area;
     param[5].Value = pavilion.BuildDate;
     param[6].Value = pavilion.Memo;
     param[7].Value = pavilion.TypeID;
     int result = SqlHelp.ExecuteNonQuery("prc_UpdatePavilion", CommandType.StoredProcedure, param);
     return result;
 }