/// <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 }
protected void btnSubmit_Click(object sender, EventArgs e) { ReCompany company = new ReCompany(); if ((string.IsNullOrEmpty(photoLoc)) || (string.IsNullOrEmpty(idCardLoc))) { MessageBox.Show(this, "照片必须上传,检查照片上传情况"); return; } company.CompanyName = this.txtName.Value.Trim(); company.Address = this.txtAddress.Value.Trim(); company.CompanyRes = this.txtRes.Value.Trim(); company.ResIdCard = this.txtIdCard.Value.Trim(); company.CompanyResPhotoPath = idCardLoc; company.CompanyPhotoPath = photoLoc; company.CompanyScale = this.txtScale.Value.Trim(); company.Tel1 = this.txtTel1.Text.Trim(); company.Tel2 = this.txtTel2.Text.Trim(); company.Descibe = this.txtDoc.Value.Trim(); company.TypeId = 1; company.State = 1; company.AddTime = DateTime.Now.ToString(); int result = Ctrl_Ass_ReCompany.AddReCompany(company); if (result != 0) { Approve_Record appRecord = new Approve_Record(); appRecord.UserId = 0; appRecord.EmployeeId = result; appRecord.TypeId = 20; appRecord.StepId = 4; int recordId = (Ctrl_Approve.AddRecord(appRecord)); if (recordId == 0) { MessageBox.Show(this, "添加失败,审批记录表!"); return; } else { Confirm confirm = new Confirm(); confirm.Fid = 0; confirm.IdCard = company.ResIdCard; confirm.TypeId = 20; confirm.RecordId = recordId; confirm.ConfirmCode = Med_Ass.GenerateRandomNumber(6); if (CommonHelp.AddConfirm(confirm) == 0) { MessageBox.Show(this, "插入验证码发生错误,联系管理员"); return; } else { MessageBox.ShowAndRedirect(this, "添加成功,牢记查询码,供发布工作时使用" + confirm.ConfirmCode, "ZaiJiuYe_Main.aspx"); } } } else { MessageBox.Show(this, "添加失败"); return; } }
/// <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(); 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++) { ApproveTempHelp appTempHelp = new ApproveTempHelp(); appTempHelp.Fid = Fid; if (MasterId == i)//户主信息录入 { appTempHelp.Bz_Master = 1;//如果为户主行 则户主标记为1 appTempHelp.Address = txtAddress.Text; appTempHelp.Home = txtHome.Text; appTempHelp.Tel1 = txtTel1.Text; appTempHelp.Tel2 = txtTel2.Text; appTempHelp.House = txtHouse.Text; appTempHelp.Square = txtSquare.Text; appTempHelp.StreetId = int.Parse(drpStreet.SelectedValue); appTempHelp.CommunityId = int.Parse(drpCommunity.SelectedValue); AppUser.StreetId = int.Parse(drpStreet.SelectedValue); AppUser.CommunityId = int.Parse(drpCommunity.SelectedValue); //新增 家庭财产和申请理由 if (txtApproveReason.Value.Length > 500) { MessageBox.Show(this, "申请理由不能超过250个字!"); return; } appTempHelp.ApproveReason = txtApproveReason.Value; } else appTempHelp.Bz_Master = 0; appTempHelp.Bz_Cz = 1;//城镇低保标记 appTempHelp.Name = ds.Tables[0].Rows[i]["Name"].ToString(); appTempHelp.IdCard = ds.Tables[0].Rows[i]["IdCard"].ToString(); try { if (ds.Tables[0].Rows[i]["Wage"].ToString() == "") appTempHelp.Wage = "0"; else appTempHelp.Wage = double.Parse(ds.Tables[0].Rows[i]["Wage"].ToString()).ToString(); } catch { MessageBox.Show(this, "有项目填写不正确,请仔细检查!"); return; } if (ApproverId == i) { appTempHelp.Bz_Approver = 1;//如果为申请人行 则申请人标记为1 appTempHelp.Uid = AppUser.Id; AppRecord.UserId = AppUser.Id; AppRecord.TypeId = TypeId; AppRecord.StepId = 0; } else appTempHelp.Bz_Approver = 0; if (Ctrl_Approve.AddTempHelp(appTempHelp) == 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; } else { Confirm confirm = new Confirm(); confirm.Fid = Fid; confirm.RecordId = recordId; confirm.TypeId = 9; 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 }
protected void btnSubmit_Click(object sender, EventArgs e) { if (photoLoc == " ") { MessageBox.Show(this, "个人照片没有上传"); return; } if (idCardLoc == " ") { MessageBox.Show(this, "身份证照片没有上传"); return; } if (this.txtDoc.Value.Trim().ToString().Length > 200) { MessageBox.Show(this, "个人简介超过指定字数,重新提交"); return; } if (string.IsNullOrEmpty(this.txtDoc.Value.Trim().ToString())) { MessageBox.Show(this, "个人简介不能为空"); return; } if (string.IsNullOrEmpty(this.txtTel1.Text.Trim()) && string.IsNullOrEmpty(this.txtTel2.Text.Trim())) { MessageBox.Show(this, "至少填写一个联系电话"); return; } employee.Tel = this.txtTel1.Text.Trim(); employee.Tel1 = this.txtTel2.Text.Trim(); employee.ImgPath = photoLoc; employee.ImgIdCard = idCardLoc; employee.Descibe = this.txtDoc.Value.Trim(); employee.State = 0; employee.Address = this.txtAddress.Text; employee.Home = this.txtHome.Text; employee.TypeId = 1; employee.State = 1; int employeeId = Ctrl_Ass_Remployee.AddRemployee(employee); if (employeeId != 0) { Approve_Record appRecord = new Approve_Record(); appRecord.UserId = 0; appRecord.EmployeeId = employeeId; appRecord.TypeId = 11; appRecord.StepId = 4; int recordId = (Ctrl_Approve.AddRecord(appRecord)); if (recordId == 0) { MessageBox.Show(this, "添加失败,审批记录表!"); return; } else { Confirm confirm = new Confirm(); confirm.Fid = 0; confirm.IdCard = idCard; confirm.TypeId = 11; confirm.RecordId = recordId; confirm.ConfirmCode = Med_Ass.GenerateRandomNumber(6); if (CommonHelp.AddConfirm(confirm) == 0) { MessageBox.Show(this, "插入验证码发生错误,联系管理员"); return; } else { MessageBox.ShowAndRedirect(this, "添加成功,牢记查询码,供招工作时使用" + confirm.ConfirmCode, "ZaiJiuYe_Main.aspx"); } } } else { MessageBox.Show(this, "添加失败!"); return; } }
protected void btnSubmit_Click(object sender, EventArgs e) { ReCompany company = new ReCompany(); if ((string.IsNullOrEmpty(photoLoc)) || (string.IsNullOrEmpty(idCardLoc))) { MessageBox.Show(this, "照片必须上传,检查照片上传情况"); return; } company.CompanyName = this.txtName.Value.Trim(); company.Address = this.txtAddress.Value.Trim(); company.CompanyRes = this.txtRes.Value.Trim(); company.ResIdCard = this.txtIdCard.Value.Trim(); company.CompanyResPhotoPath = idCardLoc; company.CompanyPhotoPath = photoLoc; company.CompanyScale = this.txtScale.Value.Trim(); company.Tel1 = this.txtTel1.Text.Trim(); company.Tel2 = this.txtTel2.Text.Trim(); company.Descibe = this.txtDoc.Value.Trim(); company.TypeId = 0; company.State = 0; company.AddTime = DateTime.Now.ToString(); int result = Ctrl_Ass_ReCompany.AddReCompany(company); if (result != 0) { Approve_Record appRecord = new Approve_Record(); appRecord.UserId = 0; appRecord.CompanyId = result; appRecord.TypeId = 20; appRecord.StepId = 0; int recordId = (Ctrl_Approve.AddRecord(appRecord)); if (recordId == 0) { MessageBox.Show(this, "添加失败,审批记录表!"); } else { Confirm confirm = new Confirm(); confirm.IdCard = company.ResIdCard; confirm.TypeId = 20; confirm.RecordId = recordId; confirm.ConfirmCode = Med_Ass.GenerateRandomNumber(6); confirm.Fid = 0; if (CommonHelp.AddConfirm(confirm) == 0) { MessageBox.Show(this, "插入验证码发生错误,联系管理员"); return; } else { MessageBox.ShowAndRedirect(this, "申请成功,请及时查询回馈信息,牢记下一页面的查询码,供查询使用:", "../Confirm.aspx?confirmCode=" + confirm.ConfirmCode); } } //Response.Write("<script>alert('添加成功" + result + "')</script>"); } else { MessageBox.Show(this, "插入验证码发生错误,联系管理员"); return; } }
/// <summary> /// 根据审批记录表主键id获得审批记录实体 /// </summary> /// <param name="recordId">审批记录表主键id</param> /// <returns></returns> public static Approve_Record GetApproveRecord(int recordId) { Approve_Record app_Record = new Approve_Record(); try { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from Approve_Record where Id=@recordId"); SqlParameter[] parameters = { new SqlParameter("@recordId", SqlDbType.Int), }; parameters[0].Value = recordId; DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count == 1) { app_Record.Id = (int)ds.Tables[0].Rows[0]["Id"]; app_Record.UserId = (int)ds.Tables[0].Rows[0]["UserId"]; app_Record.TypeId = (int)ds.Tables[0].Rows[0]["TypeId"]; app_Record.StepId = (int)ds.Tables[0].Rows[0]["StepId"]; app_Record.Reason = (string)ds.Tables[0].Rows[0]["Reason"]; app_Record.Result = (string)ds.Tables[0].Rows[0]["Result"]; } } catch (Exception e) { Log4Net.LogWrite("err", "CommonHelp:GetApproveRecord" + e.Message); } return app_Record; }
/// <summary> /// 添加一条审批记录 /// </summary> /// <param name="AppRecord">审批记录实体</param> /// <returns></returns> public static int AddRecord(Approve_Record AppRecord) { int iExecute = 0; try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Approve_Record("); strSql.Append("UserId,TypeId,StepId,Reason,Result,EmployeeId,CompanyId)"); strSql.Append(" values ("); strSql.Append("@UserId,@TypeId,@StepId,@Reason,@Result,@EmployeeId,@CompanyId)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@UserId", SqlDbType.Int), new SqlParameter("@TypeId", SqlDbType.Int), new SqlParameter("@StepId", SqlDbType.Int), new SqlParameter("@Reason", SqlDbType.NVarChar, 100), new SqlParameter("@Result", SqlDbType.NVarChar, 50), new SqlParameter("@EmployeeId", SqlDbType.Int), new SqlParameter("@CompanyId", SqlDbType.Int), }; parameters[0].Value = AppRecord.UserId; parameters[1].Value = AppRecord.TypeId; parameters[2].Value = AppRecord.StepId; parameters[3].Value = AppRecord.Reason; parameters[4].Value = AppRecord.Result; parameters[5].Value = AppRecord.EmployeeId; parameters[6].Value = AppRecord.CompanyId; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj != null) { iExecute = Convert.ToInt32(obj); } } catch (Exception e) { Log4Net.LogWrite("err", "Controler.Ctrl_Approve.AddRecord:" + e.Message); } return iExecute; }