コード例 #1
0
ファイル: BaseInfoDAL.cs プロジェクト: wakaoyun/dengqibin
 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;
 }
コード例 #2
0
 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>");
     }
 }
コード例 #3
0
ファイル: BaseInfoDAL.cs プロジェクト: wakaoyun/dengqibin
 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;
 }
コード例 #4
0
ファイル: BaseInfoBLL.cs プロジェクト: wakaoyun/dengqibin
 public bool UpdateBaseInfo(BaseInfoModel baseinfo)
 {
     int result = dal.UpdateBaseInfo(baseinfo);
     return result == 0 ? false : true;
 }
コード例 #5
0
ファイル: BaseInfoBLL.cs プロジェクト: wakaoyun/dengqibin
 public bool InsertBaseInfo(BaseInfoModel baseinfo)
 {
     int result = dal.InsertBaseInfo(baseinfo);
     return result == 0 ? false : true;
 }