Example #1
0
 public List<BaseInfoModel> ShowBaseInfo()
 {
     SqlDataReader dr= SqlHelp.ExecuteReader("prc_ShowBaseInfo", CommandType.StoredProcedure);            
     dr.Read();
     List<BaseInfoModel> list = new List<BaseInfoModel>();
     if (dr.HasRows)
     {
         BaseInfoModel baseInfo = new BaseInfoModel();                
         baseInfo.ID = Convert.ToInt32(dr[0]);
         baseInfo.HomeName = dr[1].ToString();
         baseInfo.MainHead = dr[2].ToString();
         baseInfo.BuildDate = Convert.ToDateTime(dr[3]);
         baseInfo.BuildArea = Convert.ToDouble(dr[4]);
         baseInfo.Amount = Convert.ToInt32(dr[5]);
         baseInfo.Address = dr[6].ToString();
         baseInfo.GreenArea = Convert.ToDouble(dr[7]);
         baseInfo.RoadArea = Convert.ToDouble(dr[8]);
         baseInfo.Tel = dr[9].ToString();
         baseInfo.ParkingArea = Convert.ToDouble(dr[10]);
         baseInfo.Memo = dr[11].ToString();                
         list.Add(baseInfo);
     }
     dr.Close();
     return list;
 }
 protected void Modify_Click(object sender, EventArgs e)
 {
     BaseInfoModel baseinfo = new BaseInfoModel();
     baseinfo.HomeName = txtBaseName.Text.Trim();
     baseinfo.MainHead = txtMainHead.Text.Trim();
     baseinfo.BuildDate = DateTime.Parse(txtBuildDate.Value.Trim().ToString());
     baseinfo.BuildArea = Double.Parse(txtBuildArea.Text.Trim());
     baseinfo.RoadArea = Double.Parse(txtRoadArea.Text.Trim());
     baseinfo.GreenArea = Double.Parse(txtGreenArea.Text.Trim());
     baseinfo.ParkingArea = Double.Parse(txtParkArea.Text.Trim());
     baseinfo.Amount = int.Parse(txtAmount.Text.Trim());
     baseinfo.Tel = txtTelephone.Text.Trim();
     baseinfo.Address = txtAddress.Text.Trim();
     baseinfo.Memo = txtMemo.Text.Trim();
     baseinfo.ID = (int)Session["BaseInfoID"];
     bool flag = bll.UpdateBaseInfo(baseinfo);
     if (flag)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改成功');location.href='BaseInfo.aspx';</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改失败');</script>");
     }
 }
Example #3
0
 public int InsertBaseInfo(BaseInfoModel baseinfo)
 {
     SqlParameter[] param = { new SqlParameter("@HomeName", SqlDbType.VarChar, 20), new SqlParameter("@MainHead", SqlDbType.VarChar, 20),
                              new SqlParameter("@BuildDate",SqlDbType.DateTime,10),new SqlParameter("@BuildArea",SqlDbType.Float),
                              new SqlParameter("@Amount",SqlDbType.Int,4),new SqlParameter("@Address",SqlDbType.VarChar,255),
                              new SqlParameter("@GreenArea",SqlDbType.Float),new SqlParameter("@RoadArea",SqlDbType.Float),
                              new SqlParameter("@Tel",SqlDbType.VarChar,18),new SqlParameter("@ParkingArea",SqlDbType.Float),
                              new SqlParameter("@Memo",SqlDbType.Text)
                            };
     param[0].Value = baseinfo.HomeName;
     param[1].Value = baseinfo.MainHead;
     param[2].Value = baseinfo.BuildDate;
     param[3].Value = baseinfo.BuildArea;
     param[4].Value = baseinfo.Amount;
     param[5].Value = baseinfo.Address;
     param[6].Value = baseinfo.GreenArea;
     param[7].Value = baseinfo.RoadArea;
     param[8].Value = baseinfo.Tel;
     param[9].Value = baseinfo.ParkingArea;
     param[10].Value = baseinfo.Memo;
     int result = SqlHelp.ExecuteNonQuery("prc_InsertBaseInfo", CommandType.StoredProcedure, param);
     return result;
 }
Example #4
0
 public bool UpdateBaseInfo(BaseInfoModel baseinfo)
 {
     int result = dal.UpdateBaseInfo(baseinfo);
     return result == 0 ? false : true;
 }
Example #5
0
 public bool InsertBaseInfo(BaseInfoModel baseinfo)
 {
     int result = dal.InsertBaseInfo(baseinfo);
     return result == 0 ? false : true;
 }