private void ShowInfo(int FimaryID) { Maticsoft.BLL.record_FamilyBaseInfo bll = new Maticsoft.BLL.record_FamilyBaseInfo(); Maticsoft.Model.record_FamilyBaseInfo model = bll.GetModel(FimaryID); this.lblFimaryID.Text = model.FimaryID.ToString(); this.txtF_FimaryCode.Text = model.F_FimaryCode; this.txtF_UserID.Text = model.F_UserID.ToString(); this.txtF_GroupID.Text = model.F_GroupID.ToString(); this.txtF_FimaryTel.Text = model.F_FimaryTel; this.txtF_FimrayAddress.Text = model.F_FimrayAddress; this.txtF_HouseType.Text = model.F_HouseType.ToString(); this.txtF_HouseArea.Text = model.F_HouseArea.ToString(); this.txtF_Ventilation.Text = model.F_Ventilation.ToString(); this.txtF_Humidity.Text = model.F_Humidity.ToString(); this.txtF_Warm.Text = model.F_Warm.ToString(); this.txtF_Lighting.Text = model.F_Lighting.ToString(); this.txtF_Sanitation.Text = model.F_Sanitation.ToString(); this.txtF_Kitchen.Text = model.F_Kitchen.ToString(); this.txtF_Fuel.Text = model.F_Fuel.ToString(); this.txtF_Water.Text = model.F_Water.ToString(); this.txtF_WasteDisposal.Text = model.F_WasteDisposal.ToString(); this.txtF_LivestockBar.Text = model.F_LivestockBar.ToString(); this.txtF_ToiletType.Text = model.F_ToiletType.ToString(); this.txtF_ResponsibilityUserID.Text = model.F_ResponsibilityUserID.ToString(); this.txtF_FillingUserID.Text = model.F_FillingUserID.ToString(); }
/// <summary> /// 点击确定按钮执行的方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { Maticsoft.BLL.record_FamilyBaseInfo record_FamilyBaseInfo_bll = new Maticsoft.BLL.record_FamilyBaseInfo(); Maticsoft.Model.record_FamilyBaseInfo record_FamilyBaseInfo_model = record_FamilyBaseInfo_bll.GetModel(FamilyID); if (record_FamilyBaseInfo_model == null) { record_FamilyBaseInfo_model = new Maticsoft.Model.record_FamilyBaseInfo(); } //获取客户端通过Post方式传递过来的值的(需要更改) record_FamilyBaseInfo_model.F_FamilyTel = (string)Common.sink(this.F_FamilyTel.UniqueID, MethodType.Post, 255, 0, DataType.Str); record_FamilyBaseInfo_model.F_FamilyAddress = (string)Common.sink(this.F_FamilyAddress.UniqueID, MethodType.Post, 255, 0, DataType.Str); record_FamilyBaseInfo_model.F_HouseArea = Convert.ToInt32(Common.sink(this.F_HouseArea.UniqueID, MethodType.Post, 255, 0, DataType.Int)); record_FamilyBaseInfo_model.F_HouseType = Convert.ToInt32(this.F_HouseType.SelectedValue); record_FamilyBaseInfo_model.F_Ventilation = Convert.ToInt32(this.F_Ventilation.SelectedValue); record_FamilyBaseInfo_model.F_Humidity = Convert.ToInt32(this.F_Humidity.SelectedValue); record_FamilyBaseInfo_model.F_Warm = Convert.ToInt32(this.F_Warm.SelectedValue); record_FamilyBaseInfo_model.F_Lighting = Convert.ToInt32(this.F_Lighting.SelectedValue); record_FamilyBaseInfo_model.F_Sanitation = Convert.ToInt32(this.F_Sanitation.SelectedValue); record_FamilyBaseInfo_model.F_Kitchen = Convert.ToInt32(this.F_Kitchen.SelectedValue); record_FamilyBaseInfo_model.F_Fuel = Convert.ToInt32(this.F_Fuel.SelectedValue); record_FamilyBaseInfo_model.F_Water = Convert.ToInt32(this.F_Water.SelectedValue); record_FamilyBaseInfo_model.F_WasteDisposal = Convert.ToInt32(this.F_WasteDisposal.SelectedValue); record_FamilyBaseInfo_model.F_LivestockBar = Convert.ToInt32(this.F_LivestockBar.SelectedValue); record_FamilyBaseInfo_model.F_ToiletType = Convert.ToInt32(this.F_ToiletType.SelectedValue); record_FamilyBaseInfo_model.F_ResponsibilityUserID = Convert.ToInt32(this.F_ResponsibilityUserID.Value); record_FamilyBaseInfo_model.F_FillingUserID = Convert.ToInt32(this.F_FillingUserID.Value); record_FamilyBaseInfo_model.F_UserID = Convert.ToInt32(this.F_UserID.Value); switch (CMD) { case "New": CMD_Txt = "增加"; //如果是增加操作,就调用Add方法 record_FamilyBaseInfo_model.FamilyID = record_FamilyBaseInfo_bll.Add(record_FamilyBaseInfo_model); Maticsoft.BLL.record_UserBaseInfo record_UserBaseInfo_bll = new Maticsoft.BLL.record_UserBaseInfo(); Maticsoft.Model.record_UserBaseInfo record_UserBaseInfo_model = record_UserBaseInfo_bll.GetModel(record_FamilyBaseInfo_model.F_UserID); Maticsoft.BLL.sys_Group sys_Group_bll = new Maticsoft.BLL.sys_Group(); Maticsoft.Model.sys_Group sys_Group_model = sys_Group_bll.GetModel(record_UserBaseInfo_model.U_Committee); string familyCode = sys_Group_model.G_Code + record_FamilyBaseInfo_model.FamilyID + ""; record_FamilyBaseInfo_model.F_FamilyCode = familyCode; record_FamilyBaseInfo_bll.Update(record_FamilyBaseInfo_model); record_UserBaseInfo_model.U_FamilyCode = familyCode; record_UserBaseInfo_bll.Update(record_UserBaseInfo_model); //更新户主的家庭档案号 break; case "Edit": CMD_Txt = "修改"; //如果是修改操作,就调用Update方法 record_FamilyBaseInfo_bll.Update(record_FamilyBaseInfo_model); break; } All_Title_Txt = CMD_Txt + App_Txt; //以下方法的第4个参数需要更改 EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", record_FamilyBaseInfo_model.FamilyID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx")); }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.record_FamilyBaseInfo GetModel(int FimaryID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 FimaryID,F_FimaryCode,F_UserID,F_GroupID,F_FimaryTel,F_FimrayAddress,F_HouseType,F_HouseArea,F_Ventilation,F_Humidity,F_Warm,F_Lighting,F_Sanitation,F_Kitchen,F_Fuel,F_Water,F_WasteDisposal,F_LivestockBar,F_ToiletType,F_ResponsibilityUserID,F_FillingUserID from record_FamilyBaseInfo "); strSql.Append(" where FimaryID=@FimaryID"); SqlParameter[] parameters = { new SqlParameter("@FimaryID", SqlDbType.Int, 4) }; parameters[0].Value = FimaryID; Maticsoft.Model.record_FamilyBaseInfo model = new Maticsoft.Model.record_FamilyBaseInfo(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(this.txtF_FimaryCode.Text.Trim().Length==0) { strErr+="家庭档案编号不能为空!\\n"; } if(!PageValidate.IsNumber(txtF_UserID.Text)) { strErr+="户主格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_GroupID.Text)) { strErr+="村(居)委会ID格式错误!\\n"; } if(this.txtF_FimaryTel.Text.Trim().Length==0) { strErr+="F_FimaryTel不能为空!\\n"; } if(this.txtF_FimrayAddress.Text.Trim().Length==0) { strErr+="家庭地址不能为空!\\n"; } if(!PageValidate.IsNumber(txtF_HouseType.Text)) { strErr+="房屋类型 1:砖瓦平房格式错误!\\n"; } if(!PageValidate.IsDecimal(txtF_HouseArea.Text)) { strErr+="居住面积格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_Ventilation.Text)) { strErr+="通风 1:好格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_Humidity.Text)) { strErr+="湿度 1:潮湿格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_Warm.Text)) { strErr+="保暖 1:好格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_Lighting.Text)) { strErr+="采光 1:好格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_Sanitation.Text)) { strErr+="卫生 1:清洁格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_Kitchen.Text)) { strErr+="厨房 1:合用格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_Fuel.Text)) { strErr+="使用燃料 1:液化气格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_Water.Text)) { strErr+="饮水来源 1:自来水格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_WasteDisposal.Text)) { strErr+="垃圾处理 1:垃圾处理格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_LivestockBar.Text)) { strErr+="禽畜栏 1:单设格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_ToiletType.Text)) { strErr+="厕所类型 1:家庭卫生厕所:三格式粪池式格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_ResponsibilityUserID.Text)) { strErr+="责任人格式错误!\\n"; } if(!PageValidate.IsNumber(txtF_FillingUserID.Text)) { strErr+="建档人格式错误!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int FimaryID=int.Parse(this.lblFimaryID.Text); string F_FimaryCode=this.txtF_FimaryCode.Text; int F_UserID=int.Parse(this.txtF_UserID.Text); int F_GroupID=int.Parse(this.txtF_GroupID.Text); string F_FimaryTel=this.txtF_FimaryTel.Text; string F_FimrayAddress=this.txtF_FimrayAddress.Text; int F_HouseType=int.Parse(this.txtF_HouseType.Text); decimal F_HouseArea=decimal.Parse(this.txtF_HouseArea.Text); int F_Ventilation=int.Parse(this.txtF_Ventilation.Text); int F_Humidity=int.Parse(this.txtF_Humidity.Text); int F_Warm=int.Parse(this.txtF_Warm.Text); int F_Lighting=int.Parse(this.txtF_Lighting.Text); int F_Sanitation=int.Parse(this.txtF_Sanitation.Text); int F_Kitchen=int.Parse(this.txtF_Kitchen.Text); int F_Fuel=int.Parse(this.txtF_Fuel.Text); int F_Water=int.Parse(this.txtF_Water.Text); int F_WasteDisposal=int.Parse(this.txtF_WasteDisposal.Text); int F_LivestockBar=int.Parse(this.txtF_LivestockBar.Text); int F_ToiletType=int.Parse(this.txtF_ToiletType.Text); int F_ResponsibilityUserID=int.Parse(this.txtF_ResponsibilityUserID.Text); int F_FillingUserID=int.Parse(this.txtF_FillingUserID.Text); Maticsoft.Model.record_FamilyBaseInfo model=new Maticsoft.Model.record_FamilyBaseInfo(); model.FimaryID=FimaryID; model.F_FimaryCode=F_FimaryCode; model.F_UserID=F_UserID; model.F_GroupID=F_GroupID; model.F_FimaryTel=F_FimaryTel; model.F_FimrayAddress=F_FimrayAddress; model.F_HouseType=F_HouseType; model.F_HouseArea=F_HouseArea; model.F_Ventilation=F_Ventilation; model.F_Humidity=F_Humidity; model.F_Warm=F_Warm; model.F_Lighting=F_Lighting; model.F_Sanitation=F_Sanitation; model.F_Kitchen=F_Kitchen; model.F_Fuel=F_Fuel; model.F_Water=F_Water; model.F_WasteDisposal=F_WasteDisposal; model.F_LivestockBar=F_LivestockBar; model.F_ToiletType=F_ToiletType; model.F_ResponsibilityUserID=F_ResponsibilityUserID; model.F_FillingUserID=F_FillingUserID; Maticsoft.BLL.record_FamilyBaseInfo bll=new Maticsoft.BLL.record_FamilyBaseInfo(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx"); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtF_FimaryCode.Text.Trim().Length == 0) { strErr += "家庭档案编号不能为空!\\n"; } if (!PageValidate.IsNumber(txtF_UserID.Text)) { strErr += "户主格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_GroupID.Text)) { strErr += "村(居)委会ID格式错误!\\n"; } if (this.txtF_FimaryTel.Text.Trim().Length == 0) { strErr += "F_FimaryTel不能为空!\\n"; } if (this.txtF_FimrayAddress.Text.Trim().Length == 0) { strErr += "家庭地址不能为空!\\n"; } if (!PageValidate.IsNumber(txtF_HouseType.Text)) { strErr += "房屋类型 1:砖瓦平房格式错误!\\n"; } if (!PageValidate.IsDecimal(txtF_HouseArea.Text)) { strErr += "居住面积格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_Ventilation.Text)) { strErr += "通风 1:好格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_Humidity.Text)) { strErr += "湿度 1:潮湿格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_Warm.Text)) { strErr += "保暖 1:好格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_Lighting.Text)) { strErr += "采光 1:好格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_Sanitation.Text)) { strErr += "卫生 1:清洁格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_Kitchen.Text)) { strErr += "厨房 1:合用格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_Fuel.Text)) { strErr += "使用燃料 1:液化气格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_Water.Text)) { strErr += "饮水来源 1:自来水格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_WasteDisposal.Text)) { strErr += "垃圾处理 1:垃圾处理格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_LivestockBar.Text)) { strErr += "禽畜栏 1:单设格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_ToiletType.Text)) { strErr += "厕所类型 1:家庭卫生厕所:三格式粪池式格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_ResponsibilityUserID.Text)) { strErr += "责任人格式错误!\\n"; } if (!PageValidate.IsNumber(txtF_FillingUserID.Text)) { strErr += "建档人格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int FimaryID = int.Parse(this.lblFimaryID.Text); string F_FimaryCode = this.txtF_FimaryCode.Text; int F_UserID = int.Parse(this.txtF_UserID.Text); int F_GroupID = int.Parse(this.txtF_GroupID.Text); string F_FimaryTel = this.txtF_FimaryTel.Text; string F_FimrayAddress = this.txtF_FimrayAddress.Text; int F_HouseType = int.Parse(this.txtF_HouseType.Text); decimal F_HouseArea = decimal.Parse(this.txtF_HouseArea.Text); int F_Ventilation = int.Parse(this.txtF_Ventilation.Text); int F_Humidity = int.Parse(this.txtF_Humidity.Text); int F_Warm = int.Parse(this.txtF_Warm.Text); int F_Lighting = int.Parse(this.txtF_Lighting.Text); int F_Sanitation = int.Parse(this.txtF_Sanitation.Text); int F_Kitchen = int.Parse(this.txtF_Kitchen.Text); int F_Fuel = int.Parse(this.txtF_Fuel.Text); int F_Water = int.Parse(this.txtF_Water.Text); int F_WasteDisposal = int.Parse(this.txtF_WasteDisposal.Text); int F_LivestockBar = int.Parse(this.txtF_LivestockBar.Text); int F_ToiletType = int.Parse(this.txtF_ToiletType.Text); int F_ResponsibilityUserID = int.Parse(this.txtF_ResponsibilityUserID.Text); int F_FillingUserID = int.Parse(this.txtF_FillingUserID.Text); Maticsoft.Model.record_FamilyBaseInfo model = new Maticsoft.Model.record_FamilyBaseInfo(); model.FimaryID = FimaryID; model.F_FimaryCode = F_FimaryCode; model.F_UserID = F_UserID; model.F_GroupID = F_GroupID; model.F_FimaryTel = F_FimaryTel; model.F_FimrayAddress = F_FimrayAddress; model.F_HouseType = F_HouseType; model.F_HouseArea = F_HouseArea; model.F_Ventilation = F_Ventilation; model.F_Humidity = F_Humidity; model.F_Warm = F_Warm; model.F_Lighting = F_Lighting; model.F_Sanitation = F_Sanitation; model.F_Kitchen = F_Kitchen; model.F_Fuel = F_Fuel; model.F_Water = F_Water; model.F_WasteDisposal = F_WasteDisposal; model.F_LivestockBar = F_LivestockBar; model.F_ToiletType = F_ToiletType; model.F_ResponsibilityUserID = F_ResponsibilityUserID; model.F_FillingUserID = F_FillingUserID; Maticsoft.BLL.record_FamilyBaseInfo bll = new Maticsoft.BLL.record_FamilyBaseInfo(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Maticsoft.Model.record_FamilyBaseInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into record_FamilyBaseInfo("); strSql.Append("F_FimaryCode,F_UserID,F_GroupID,F_FimaryTel,F_FimrayAddress,F_HouseType,F_HouseArea,F_Ventilation,F_Humidity,F_Warm,F_Lighting,F_Sanitation,F_Kitchen,F_Fuel,F_Water,F_WasteDisposal,F_LivestockBar,F_ToiletType,F_ResponsibilityUserID,F_FillingUserID)"); strSql.Append(" values ("); strSql.Append("@F_FimaryCode,@F_UserID,@F_GroupID,@F_FimaryTel,@F_FimrayAddress,@F_HouseType,@F_HouseArea,@F_Ventilation,@F_Humidity,@F_Warm,@F_Lighting,@F_Sanitation,@F_Kitchen,@F_Fuel,@F_Water,@F_WasteDisposal,@F_LivestockBar,@F_ToiletType,@F_ResponsibilityUserID,@F_FillingUserID)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@F_FimaryCode", SqlDbType.VarChar, 30), new SqlParameter("@F_UserID", SqlDbType.Int, 4), new SqlParameter("@F_GroupID", SqlDbType.Int, 4), new SqlParameter("@F_FimaryTel", SqlDbType.VarChar, 20), new SqlParameter("@F_FimrayAddress", SqlDbType.NVarChar, 100), new SqlParameter("@F_HouseType", SqlDbType.TinyInt, 1), new SqlParameter("@F_HouseArea", SqlDbType.Float, 8), new SqlParameter("@F_Ventilation", SqlDbType.TinyInt, 1), new SqlParameter("@F_Humidity", SqlDbType.TinyInt, 1), new SqlParameter("@F_Warm", SqlDbType.TinyInt, 1), new SqlParameter("@F_Lighting", SqlDbType.TinyInt, 1), new SqlParameter("@F_Sanitation", SqlDbType.TinyInt, 1), new SqlParameter("@F_Kitchen", SqlDbType.TinyInt, 1), new SqlParameter("@F_Fuel", SqlDbType.TinyInt, 1), new SqlParameter("@F_Water", SqlDbType.TinyInt, 1), new SqlParameter("@F_WasteDisposal", SqlDbType.TinyInt, 1), new SqlParameter("@F_LivestockBar", SqlDbType.TinyInt, 1), new SqlParameter("@F_ToiletType", SqlDbType.TinyInt, 1), new SqlParameter("@F_ResponsibilityUserID", SqlDbType.Int, 4), new SqlParameter("@F_FillingUserID", SqlDbType.Int, 4) }; parameters[0].Value = model.F_FimaryCode; parameters[1].Value = model.F_UserID; parameters[2].Value = model.F_GroupID; parameters[3].Value = model.F_FimaryTel; parameters[4].Value = model.F_FimrayAddress; parameters[5].Value = model.F_HouseType; parameters[6].Value = model.F_HouseArea; parameters[7].Value = model.F_Ventilation; parameters[8].Value = model.F_Humidity; parameters[9].Value = model.F_Warm; parameters[10].Value = model.F_Lighting; parameters[11].Value = model.F_Sanitation; parameters[12].Value = model.F_Kitchen; parameters[13].Value = model.F_Fuel; parameters[14].Value = model.F_Water; parameters[15].Value = model.F_WasteDisposal; parameters[16].Value = model.F_LivestockBar; parameters[17].Value = model.F_ToiletType; parameters[18].Value = model.F_ResponsibilityUserID; parameters[19].Value = model.F_FillingUserID; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.record_FamilyBaseInfo DataRowToModel(DataRow row) { Maticsoft.Model.record_FamilyBaseInfo model = new Maticsoft.Model.record_FamilyBaseInfo(); if (row != null) { if (row["FimaryID"] != null && row["FimaryID"].ToString() != "") { model.FimaryID = int.Parse(row["FimaryID"].ToString()); } if (row["F_FimaryCode"] != null) { model.F_FimaryCode = row["F_FimaryCode"].ToString(); } if (row["F_UserID"] != null && row["F_UserID"].ToString() != "") { model.F_UserID = int.Parse(row["F_UserID"].ToString()); } if (row["F_GroupID"] != null && row["F_GroupID"].ToString() != "") { model.F_GroupID = int.Parse(row["F_GroupID"].ToString()); } if (row["F_FimaryTel"] != null) { model.F_FimaryTel = row["F_FimaryTel"].ToString(); } if (row["F_FimrayAddress"] != null) { model.F_FimrayAddress = row["F_FimrayAddress"].ToString(); } if (row["F_HouseType"] != null && row["F_HouseType"].ToString() != "") { model.F_HouseType = int.Parse(row["F_HouseType"].ToString()); } if (row["F_HouseArea"] != null && row["F_HouseArea"].ToString() != "") { model.F_HouseArea = decimal.Parse(row["F_HouseArea"].ToString()); } if (row["F_Ventilation"] != null && row["F_Ventilation"].ToString() != "") { model.F_Ventilation = int.Parse(row["F_Ventilation"].ToString()); } if (row["F_Humidity"] != null && row["F_Humidity"].ToString() != "") { model.F_Humidity = int.Parse(row["F_Humidity"].ToString()); } if (row["F_Warm"] != null && row["F_Warm"].ToString() != "") { model.F_Warm = int.Parse(row["F_Warm"].ToString()); } if (row["F_Lighting"] != null && row["F_Lighting"].ToString() != "") { model.F_Lighting = int.Parse(row["F_Lighting"].ToString()); } if (row["F_Sanitation"] != null && row["F_Sanitation"].ToString() != "") { model.F_Sanitation = int.Parse(row["F_Sanitation"].ToString()); } if (row["F_Kitchen"] != null && row["F_Kitchen"].ToString() != "") { model.F_Kitchen = int.Parse(row["F_Kitchen"].ToString()); } if (row["F_Fuel"] != null && row["F_Fuel"].ToString() != "") { model.F_Fuel = int.Parse(row["F_Fuel"].ToString()); } if (row["F_Water"] != null && row["F_Water"].ToString() != "") { model.F_Water = int.Parse(row["F_Water"].ToString()); } if (row["F_WasteDisposal"] != null && row["F_WasteDisposal"].ToString() != "") { model.F_WasteDisposal = int.Parse(row["F_WasteDisposal"].ToString()); } if (row["F_LivestockBar"] != null && row["F_LivestockBar"].ToString() != "") { model.F_LivestockBar = int.Parse(row["F_LivestockBar"].ToString()); } if (row["F_ToiletType"] != null && row["F_ToiletType"].ToString() != "") { model.F_ToiletType = int.Parse(row["F_ToiletType"].ToString()); } if (row["F_ResponsibilityUserID"] != null && row["F_ResponsibilityUserID"].ToString() != "") { model.F_ResponsibilityUserID = int.Parse(row["F_ResponsibilityUserID"].ToString()); } if (row["F_FillingUserID"] != null && row["F_FillingUserID"].ToString() != "") { model.F_FillingUserID = int.Parse(row["F_FillingUserID"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.record_FamilyBaseInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update record_FamilyBaseInfo set "); strSql.Append("F_FimaryCode=@F_FimaryCode,"); strSql.Append("F_UserID=@F_UserID,"); strSql.Append("F_GroupID=@F_GroupID,"); strSql.Append("F_FimaryTel=@F_FimaryTel,"); strSql.Append("F_FimrayAddress=@F_FimrayAddress,"); strSql.Append("F_HouseType=@F_HouseType,"); strSql.Append("F_HouseArea=@F_HouseArea,"); strSql.Append("F_Ventilation=@F_Ventilation,"); strSql.Append("F_Humidity=@F_Humidity,"); strSql.Append("F_Warm=@F_Warm,"); strSql.Append("F_Lighting=@F_Lighting,"); strSql.Append("F_Sanitation=@F_Sanitation,"); strSql.Append("F_Kitchen=@F_Kitchen,"); strSql.Append("F_Fuel=@F_Fuel,"); strSql.Append("F_Water=@F_Water,"); strSql.Append("F_WasteDisposal=@F_WasteDisposal,"); strSql.Append("F_LivestockBar=@F_LivestockBar,"); strSql.Append("F_ToiletType=@F_ToiletType,"); strSql.Append("F_ResponsibilityUserID=@F_ResponsibilityUserID,"); strSql.Append("F_FillingUserID=@F_FillingUserID"); strSql.Append(" where FimaryID=@FimaryID"); SqlParameter[] parameters = { new SqlParameter("@F_FimaryCode", SqlDbType.VarChar, 30), new SqlParameter("@F_UserID", SqlDbType.Int, 4), new SqlParameter("@F_GroupID", SqlDbType.Int, 4), new SqlParameter("@F_FimaryTel", SqlDbType.VarChar, 20), new SqlParameter("@F_FimrayAddress", SqlDbType.NVarChar, 100), new SqlParameter("@F_HouseType", SqlDbType.TinyInt, 1), new SqlParameter("@F_HouseArea", SqlDbType.Float, 8), new SqlParameter("@F_Ventilation", SqlDbType.TinyInt, 1), new SqlParameter("@F_Humidity", SqlDbType.TinyInt, 1), new SqlParameter("@F_Warm", SqlDbType.TinyInt, 1), new SqlParameter("@F_Lighting", SqlDbType.TinyInt, 1), new SqlParameter("@F_Sanitation", SqlDbType.TinyInt, 1), new SqlParameter("@F_Kitchen", SqlDbType.TinyInt, 1), new SqlParameter("@F_Fuel", SqlDbType.TinyInt, 1), new SqlParameter("@F_Water", SqlDbType.TinyInt, 1), new SqlParameter("@F_WasteDisposal", SqlDbType.TinyInt, 1), new SqlParameter("@F_LivestockBar", SqlDbType.TinyInt, 1), new SqlParameter("@F_ToiletType", SqlDbType.TinyInt, 1), new SqlParameter("@F_ResponsibilityUserID", SqlDbType.Int, 4), new SqlParameter("@F_FillingUserID", SqlDbType.Int, 4), new SqlParameter("@FimaryID", SqlDbType.Int, 4) }; parameters[0].Value = model.F_FimaryCode; parameters[1].Value = model.F_UserID; parameters[2].Value = model.F_GroupID; parameters[3].Value = model.F_FimaryTel; parameters[4].Value = model.F_FimrayAddress; parameters[5].Value = model.F_HouseType; parameters[6].Value = model.F_HouseArea; parameters[7].Value = model.F_Ventilation; parameters[8].Value = model.F_Humidity; parameters[9].Value = model.F_Warm; parameters[10].Value = model.F_Lighting; parameters[11].Value = model.F_Sanitation; parameters[12].Value = model.F_Kitchen; parameters[13].Value = model.F_Fuel; parameters[14].Value = model.F_Water; parameters[15].Value = model.F_WasteDisposal; parameters[16].Value = model.F_LivestockBar; parameters[17].Value = model.F_ToiletType; parameters[18].Value = model.F_ResponsibilityUserID; parameters[19].Value = model.F_FillingUserID; parameters[20].Value = model.FimaryID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.record_FamilyBaseInfo DataRowToModel(DataRow row) { Maticsoft.Model.record_FamilyBaseInfo model=new Maticsoft.Model.record_FamilyBaseInfo(); if (row != null) { if(row["FimaryID"]!=null && row["FimaryID"].ToString()!="") { model.FimaryID=int.Parse(row["FimaryID"].ToString()); } if(row["F_FimaryCode"]!=null) { model.F_FimaryCode=row["F_FimaryCode"].ToString(); } if(row["F_UserID"]!=null && row["F_UserID"].ToString()!="") { model.F_UserID=int.Parse(row["F_UserID"].ToString()); } if(row["F_GroupID"]!=null && row["F_GroupID"].ToString()!="") { model.F_GroupID=int.Parse(row["F_GroupID"].ToString()); } if(row["F_FimaryTel"]!=null) { model.F_FimaryTel=row["F_FimaryTel"].ToString(); } if(row["F_FimrayAddress"]!=null) { model.F_FimrayAddress=row["F_FimrayAddress"].ToString(); } if(row["F_HouseType"]!=null && row["F_HouseType"].ToString()!="") { model.F_HouseType=int.Parse(row["F_HouseType"].ToString()); } if(row["F_HouseArea"]!=null && row["F_HouseArea"].ToString()!="") { model.F_HouseArea=decimal.Parse(row["F_HouseArea"].ToString()); } if(row["F_Ventilation"]!=null && row["F_Ventilation"].ToString()!="") { model.F_Ventilation=int.Parse(row["F_Ventilation"].ToString()); } if(row["F_Humidity"]!=null && row["F_Humidity"].ToString()!="") { model.F_Humidity=int.Parse(row["F_Humidity"].ToString()); } if(row["F_Warm"]!=null && row["F_Warm"].ToString()!="") { model.F_Warm=int.Parse(row["F_Warm"].ToString()); } if(row["F_Lighting"]!=null && row["F_Lighting"].ToString()!="") { model.F_Lighting=int.Parse(row["F_Lighting"].ToString()); } if(row["F_Sanitation"]!=null && row["F_Sanitation"].ToString()!="") { model.F_Sanitation=int.Parse(row["F_Sanitation"].ToString()); } if(row["F_Kitchen"]!=null && row["F_Kitchen"].ToString()!="") { model.F_Kitchen=int.Parse(row["F_Kitchen"].ToString()); } if(row["F_Fuel"]!=null && row["F_Fuel"].ToString()!="") { model.F_Fuel=int.Parse(row["F_Fuel"].ToString()); } if(row["F_Water"]!=null && row["F_Water"].ToString()!="") { model.F_Water=int.Parse(row["F_Water"].ToString()); } if(row["F_WasteDisposal"]!=null && row["F_WasteDisposal"].ToString()!="") { model.F_WasteDisposal=int.Parse(row["F_WasteDisposal"].ToString()); } if(row["F_LivestockBar"]!=null && row["F_LivestockBar"].ToString()!="") { model.F_LivestockBar=int.Parse(row["F_LivestockBar"].ToString()); } if(row["F_ToiletType"]!=null && row["F_ToiletType"].ToString()!="") { model.F_ToiletType=int.Parse(row["F_ToiletType"].ToString()); } if(row["F_ResponsibilityUserID"]!=null && row["F_ResponsibilityUserID"].ToString()!="") { model.F_ResponsibilityUserID=int.Parse(row["F_ResponsibilityUserID"].ToString()); } if(row["F_FillingUserID"]!=null && row["F_FillingUserID"].ToString()!="") { model.F_FillingUserID=int.Parse(row["F_FillingUserID"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.record_FamilyBaseInfo GetModel(int FimaryID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 FimaryID,F_FimaryCode,F_UserID,F_GroupID,F_FimaryTel,F_FimrayAddress,F_HouseType,F_HouseArea,F_Ventilation,F_Humidity,F_Warm,F_Lighting,F_Sanitation,F_Kitchen,F_Fuel,F_Water,F_WasteDisposal,F_LivestockBar,F_ToiletType,F_ResponsibilityUserID,F_FillingUserID from record_FamilyBaseInfo "); strSql.Append(" where FimaryID=@FimaryID"); SqlParameter[] parameters = { new SqlParameter("@FimaryID", SqlDbType.Int,4) }; parameters[0].Value = FimaryID; Maticsoft.Model.record_FamilyBaseInfo model=new Maticsoft.Model.record_FamilyBaseInfo(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }