public void BindBaseInfoData() { BaseInfo = Ctrl_Base.GetBaseInfoById(ID); txtID.Text = BaseInfo.ID.ToString(); txtName.Text = BaseInfo.Name; txtIsMaster.Text = BaseInfo.Bz_Master == 1 ? "是" : "否"; txtStreet.Text = BaseInfo.StreetName; txtCommunity.Text = BaseInfo.CommunityName; txtHome.Text = BaseInfo.Home; txtIsDiBao.Text = BaseInfo.Bz_DiBao == null ? "否" : "是"; txtIsDiShouRu.Text = BaseInfo.Bz_DiShouRu == null ? "否" : "是"; txtLinShi.Text = BaseInfo.Bz_TempHelp == null? "否" : "是"; txtZaijiuye.Text = BaseInfo.Bz_ReEmploy == null? "否" : "是"; }
private void DataInfosBind() { BaseInfos = new List<BaseInfo>(); DataSet ds = Ctrl_Base.GetFamilyByFid(Fid); //遍历一个表多行多列 foreach (DataRow mDr in ds.Tables[0].Rows) { BaseInfo BaseInfo = new BaseInfo(); BaseInfo.ID =int.Parse(mDr["Id"].ToString()); BaseInfo.Fid =int.Parse(mDr["Fid"].ToString()); BaseInfo.Bz_Master = int.Parse(mDr["Bz_Master"].ToString()); BaseInfo.Name = mDr["BaseName"].ToString(); BaseInfo.IdCard = mDr["IdCard"].ToString(); BaseInfo.Home = mDr["Home"].ToString(); BaseInfo.StreetName = mDr["StreetName"].ToString(); BaseInfo.CommunityName = mDr["CommunityName"].ToString(); BaseInfos.Add(BaseInfo); } }
/// <summary> /// 保存按钮事件 /// </summary> /// <param name="sender">系统参数</param> /// <param name="e">系统参数</param> protected void btnSave_Click(object sender, EventArgs e) { if (FunLogicAddData()) return;//判断是否有未填项 #region 获取家庭成员信息表数据 ds DataTable dt = CopyFormData(); DataSet ds = new DataSet(); ds.Merge(dt); #endregion #region 存入家庭成员信息 Approve_Record AppRecord = new Approve_Record(); BaseInfo baseInfo = new BaseInfo(); int Fid = Ctrl_Counter.GetCounter_Fid();//获取家庭Id 家庭Id不是户主的Id int ApproverId = 0;//申请人所在行Id 恒为0 int MasterId = int.Parse(drpMaster.SelectedValue) - 1;//获取户主所在行Id for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Approve_DiBao AppDiBao = new Approve_DiBao(); AppDiBao.Fid = Fid; baseInfo.Fid = Fid; if (MasterId == i)//户主信息录入 { AppDiBao.Bz_Master = 1;//如果为户主行 则户主标记为1 baseInfo.Bz_Master = 1; AppDiBao.Address = txtAddress.Text; AppDiBao.Home = txtHome.Text; AppDiBao.Tel1 = txtTel1.Text; AppDiBao.Tel2 = txtTel2.Text; AppDiBao.House = txtHouse.Text; AppDiBao.Square = txtSquare.Text; AppDiBao.StreetId = int.Parse(drpStreet.SelectedValue); AppDiBao.CommunityId = int.Parse(drpCommunity.SelectedValue); AppUser.StreetId = int.Parse(drpStreet.SelectedValue); AppUser.CommunityId = int.Parse(drpCommunity.SelectedValue); baseInfo.StreetId = AppUser.StreetId; baseInfo.CommunityId = AppUser.CommunityId; //新增 家庭财产和申请理由 if (txtApproveReason.Value.Length > 500) { MessageBox.Show(this, "申请理由不能超过250个字!"); return; } if (txtFamilyMoney.Value.Length > 500) { MessageBox.Show(this, "家庭财产说明不能超过50个字!"); return; } AppDiBao.ApproveReason = txtApproveReason.Value; AppDiBao.FamilyMeans = txtFamilyMoney.Value; } else AppDiBao.Bz_Master = 0; baseInfo.Bz_Master = 0; AppDiBao.Bz_Cz = 1;//城镇低保标记 AppDiBao.Name = ds.Tables[0].Rows[i]["Name"].ToString(); AppDiBao.IdCard = ds.Tables[0].Rows[i]["IdCard"].ToString(); baseInfo.Name = AppDiBao.Name; baseInfo.IdCard = AppDiBao.IdCard; try { if (ds.Tables[0].Rows[i]["Wage"].ToString() == "") AppDiBao.Wage = "0"; else AppDiBao.Wage = double.Parse(ds.Tables[0].Rows[i]["Wage"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage1"].ToString() == "") AppDiBao.Wage1 = "0"; else AppDiBao.Wage1 = double.Parse(ds.Tables[0].Rows[i]["Wage1"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage2"].ToString() == "") AppDiBao.Wage2 = "0"; else AppDiBao.Wage2 = double.Parse(ds.Tables[0].Rows[i]["Wage2"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage3"].ToString() == "") AppDiBao.Wage3 = "0"; else AppDiBao.Wage3 = double.Parse(ds.Tables[0].Rows[i]["Wage3"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage4"].ToString() == "") AppDiBao.Wage4 = "0"; else AppDiBao.Wage4 = double.Parse(ds.Tables[0].Rows[i]["Wage4"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage5"].ToString() == "") AppDiBao.Wage5 = "0"; else AppDiBao.Wage5 = double.Parse(ds.Tables[0].Rows[i]["Wage5"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage6"].ToString() == "") AppDiBao.Wage6 = "0"; else AppDiBao.Wage6 = double.Parse(ds.Tables[0].Rows[i]["Wage6"].ToString()).ToString(); } catch { MessageBox.Show(this, "有项目填写不正确,请仔细检查!"); return; } if (ApproverId == i) { AppDiBao.Bz_Approver = 1;//如果为申请人行 则申请人标记为1 AppDiBao.Uid = AppUser.Id; AppRecord.UserId = AppUser.Id; AppRecord.TypeId = TypeId; AppRecord.StepId = 0; } else AppDiBao.Bz_Approver = 0; if (Ctrl_Approve.AddDiBao(AppDiBao) == 0) { MessageBox.Show(this, "申请失败,请您再试一次!"); return; } if (i == ds.Tables[0].Rows.Count - 1)//最后一行保存完毕 再添加申请人信息及申请记录 避免街道数据无法获取 { if ((Ctrl_Approve.AddRecord(AppRecord) == 0) || !Ctrl_Approve.UpdateUser(AppUser))//将申请人信息写入申请工作流程表 { MessageBox.Show(this, "申请失败,请您再试一次!"); return; } } } MessageBox.ShowAndRedirect(this, "申请成功!", "../../First.aspx"); #endregion }
/// <summary> /// 保存按钮事件 /// </summary> /// <param name="sender">系统参数</param> /// <param name="e">系统参数</param> protected void btnSave_Click(object sender, EventArgs e) { if (FunLogicAddData()) return;//判断是否有未填项 #region 获取家庭成员信息表数据 ds DataTable dt = CopyFormData(); DataSet ds = new DataSet(); ds.Merge(dt); #endregion #region 存入家庭成员信息 int recordId = 0; Approve_Record AppRecord = new Approve_Record(); BaseInfo baseInfo = new BaseInfo(); int Fid = Ctrl_Counter.GetCounter_Fid();//获取家庭Id 家庭Id不是户主的Id int ApproverId = 0;//申请人所在行Id 恒为0 int MasterId = int.Parse(drpMaster.SelectedValue) - 1;//获取户主所在行Id for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Approve_DiShouRu appDiShouRu = new Approve_DiShouRu(); appDiShouRu.Fid = Fid; baseInfo.Fid = Fid; if (MasterId == i)//户主信息录入 { appDiShouRu.Bz_Master = 1;//如果为户主行 则户主标记为1 baseInfo.Bz_Master = 1; appDiShouRu.Address = txtAddress.Text; appDiShouRu.Home = txtHome.Text; appDiShouRu.Tel1 = txtTel1.Text; appDiShouRu.Tel2 = txtTel2.Text; appDiShouRu.House = txtHouse.Text; appDiShouRu.Square = txtSquare.Text; appDiShouRu.StreetId = int.Parse(drpStreet.SelectedValue); appDiShouRu.CommunityId = int.Parse(drpCommunity.SelectedValue); AppUser.StreetId = int.Parse(drpStreet.SelectedValue); AppUser.CommunityId = int.Parse(drpCommunity.SelectedValue); baseInfo.StreetId = AppUser.StreetId; baseInfo.CommunityId = AppUser.CommunityId; //新增 家庭财产和申请理由 if (txtApproveReason.Value.Length > 500) { MessageBox.Show(this, "申请理由不能超过250个字!"); return; } appDiShouRu.ApproveReason = txtApproveReason.Value; } else appDiShouRu.Bz_Master = 0; baseInfo.Bz_Master = 0; appDiShouRu.Bz_Cz = 1;//城镇低保标记 appDiShouRu.Name = ds.Tables[0].Rows[i]["Name"].ToString(); appDiShouRu.IdCard = ds.Tables[0].Rows[i]["IdCard"].ToString(); baseInfo.Name = appDiShouRu.Name; baseInfo.IdCard = appDiShouRu.IdCard; try { if (ds.Tables[0].Rows[i]["Wage"].ToString() == "") appDiShouRu.Wage = "0"; else appDiShouRu.Wage = double.Parse(ds.Tables[0].Rows[i]["Wage"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage1"].ToString() == "") appDiShouRu.Wage1 = "0"; else appDiShouRu.Wage1 = double.Parse(ds.Tables[0].Rows[i]["Wage1"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage2"].ToString() == "") appDiShouRu.Wage2 = "0"; else appDiShouRu.Wage2 = double.Parse(ds.Tables[0].Rows[i]["Wage2"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage3"].ToString() == "") appDiShouRu.Wage3 = "0"; else appDiShouRu.Wage3 = double.Parse(ds.Tables[0].Rows[i]["Wage3"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage4"].ToString() == "") appDiShouRu.Wage4 = "0"; else appDiShouRu.Wage4 = double.Parse(ds.Tables[0].Rows[i]["Wage4"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage5"].ToString() == "") appDiShouRu.Wage5 = "0"; else appDiShouRu.Wage5 = double.Parse(ds.Tables[0].Rows[i]["Wage5"].ToString()).ToString(); if (ds.Tables[0].Rows[i]["Wage6"].ToString() == "") appDiShouRu.Wage6 = "0"; else appDiShouRu.Wage6 = double.Parse(ds.Tables[0].Rows[i]["Wage6"].ToString()).ToString(); } catch { MessageBox.Show(this, "有项目填写不正确,请仔细检查!"); return; } if (ApproverId == i) { appDiShouRu.Bz_Approver = 1;//如果为申请人行 则申请人标记为1 appDiShouRu.Uid = AppUser.Id; AppRecord.UserId = AppUser.Id; AppRecord.TypeId = TypeId; AppRecord.StepId = 0; } else appDiShouRu.Bz_Approver = 0; appDiShouRu.Add_Time = DateTime.Now.ToString("yyyy-MM-dd"); if (Ctrl_Approve.AddDiShouRu(appDiShouRu) == 0) { MessageBox.Show(this, "申请失败,请您再试一次!"); return; } if (i == ds.Tables[0].Rows.Count - 1)//最后一行保存完毕 再添加申请人信息及申请记录 避免街道数据无法获取 { recordId = Ctrl_Approve.AddRecord(AppRecord); if ((recordId == 0) || !Ctrl_Approve.UpdateUser(AppUser))//将申请人信息写入申请工作流程表 { MessageBox.Show(this, "申请失败,请您再试一次!"); return; } } } Confirm confirm = new Confirm(); confirm.Fid = Fid; confirm.RecordId = recordId; confirm.TypeId = 3; confirm.IdCard = AppUser.IdCard; confirm.ConfirmCode = Med_Ass.GenerateRandomNumber(6); if (CommonHelp.AddConfirm(confirm) == 0) { MessageBox.Show(this, "插入验证码发生错误,联系管理员"); } else { MessageBox.ShowAndRedirect(this, "申请成功,请及时查询回馈信息,牢记下一页面的查询码,供查询使用:", "../Confirm.aspx?confirmCode=" + confirm.ConfirmCode); } #endregion }
/// <summary> /// 根据id获取Base Id /// </summary> /// <param name="id"></param> /// <returns></returns> public static BaseInfo GetBaseInfoById(int id) { BaseInfo BaseInfo = new BaseInfo(); DataSet ds = new DataSet(); try { StringBuilder strSql = new StringBuilder(); strSql.Append("select A.Id,A.Fid,A.Bz_Master,A.Name,A.IdCard,A.Home,A.Bz_DiBao,A.Bz_DiShouRu,A.Bz_ReEmploy,A.Bz_TempHelp,B.Name as StreetName,C.Name as CommunityName "); strSql.Append(" from BaseInfo as A left join Area_Street as B on A.StreetId=B.Id left join Area_Community as C on A.CommunityId=C.Id"); strSql.Append(" where A.Id=" + id); ds = DbHelperSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Name"] != null && ds.Tables[0].Rows[0]["Name"].ToString() != "") { BaseInfo.Name = ds.Tables[0].Rows[0]["Name"].ToString(); } if (ds.Tables[0].Rows[0]["Id"] != null && ds.Tables[0].Rows[0]["Id"].ToString() != "") { BaseInfo.ID = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString()); } if (ds.Tables[0].Rows[0]["Fid"] != null && ds.Tables[0].Rows[0]["Fid"].ToString() != "") { BaseInfo.Fid = int.Parse(ds.Tables[0].Rows[0]["Fid"].ToString()); } if (ds.Tables[0].Rows[0]["Bz_Master"] != null && ds.Tables[0].Rows[0]["Bz_Master"].ToString() != "") { BaseInfo.Bz_Master = int.Parse(ds.Tables[0].Rows[0]["Bz_Master"].ToString()); } if (ds.Tables[0].Rows[0]["IdCard"] != null && ds.Tables[0].Rows[0]["IdCard"].ToString() != "") { BaseInfo.IdCard = ds.Tables[0].Rows[0]["IdCard"].ToString(); } if (ds.Tables[0].Rows[0]["Home"] != null && ds.Tables[0].Rows[0]["Home"].ToString() != "") { BaseInfo.Home = ds.Tables[0].Rows[0]["Home"].ToString(); } if (ds.Tables[0].Rows[0]["Bz_DiBao"] != null && ds.Tables[0].Rows[0]["Bz_DiBao"].ToString() != "") { BaseInfo.Bz_DiBao = int.Parse(ds.Tables[0].Rows[0]["Bz_DiBao"].ToString()); } if (ds.Tables[0].Rows[0]["Bz_DiShouRu"] != null && ds.Tables[0].Rows[0]["Bz_DiShouRu"].ToString() != "") { BaseInfo.Bz_DiShouRu = int.Parse(ds.Tables[0].Rows[0]["Bz_DiShouRu"].ToString()); } if (ds.Tables[0].Rows[0]["Bz_ReEmploy"] != null && ds.Tables[0].Rows[0]["Bz_ReEmploy"].ToString() != "") { BaseInfo.Bz_ReEmploy = int.Parse(ds.Tables[0].Rows[0]["Bz_ReEmploy"].ToString()); } if (ds.Tables[0].Rows[0]["Bz_TempHelp"] != null && ds.Tables[0].Rows[0]["Bz_TempHelp"].ToString() != "") { BaseInfo.Bz_TempHelp = int.Parse(ds.Tables[0].Rows[0]["Bz_TempHelp"].ToString()); } if (ds.Tables[0].Rows[0]["StreetName"] != null && ds.Tables[0].Rows[0]["StreetName"].ToString() != "") { BaseInfo.StreetName = ds.Tables[0].Rows[0]["StreetName"].ToString(); } if (ds.Tables[0].Rows[0]["CommunityName"] != null && ds.Tables[0].Rows[0]["CommunityName"].ToString() != "") { BaseInfo.CommunityName = ds.Tables[0].Rows[0]["CommunityName"].ToString(); } } } catch (Exception e) { Log4Net.LogWrite("err", "SysAccessData.SysManage.UserManage\\DacUserInfo\\GetBaseInfoById" + e.Message); } return BaseInfo; }