/// <summary> /// 确定按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { bool k = true; AppStep = Ctrl_Approve.GetAppStepById(RecordId); AppStep.RecordId = RecordId; if (UserLevel == 2) { AppStep.Reason_Community = txtReason_Community.Text; AppStep.Bz_Result_Community = rbYes.Checked ? 1 : 0; AppStep.Community_Date = DateTime.Now.ToString("yyyy-MM-dd"); AppStep.Office_Date = null; AppStep.Civil_Date = null; if (Ctrl_Approve.AddStep(AppStep) == 0) k = false; else if (!Ctrl_Approve.UpdateRecordStepById(RecordId, 1)) k = false; } if (UserLevel == 1) { AppStep.Reason_Office = txtReason_Office.Text; AppStep.Bz_Result_Office = rbYes.Checked ? 1 : 0; AppStep.Office_Date = DateTime.Now.ToString("yyyy-MM-dd"); AppStep.Civil_Date = null; if (!Ctrl_Approve.UpdateStep(AppStep)) k = false; else if (!Ctrl_Approve.UpdateRecordStepById(RecordId, 2)) k = false; } if (UserLevel == 0) { AppStep.Reason_Civil = txtReason_Civil.Text; AppStep.Bz_Result_Civil = rbYes.Checked ? 1 : 0; AppStep.Civil_Date = DateTime.Now.ToString("yyyy-MM-dd"); if (AppStep.Id == 0)//如果是跳过步骤直接审批 { if (Ctrl_Approve.AddStep(AppStep) == 0) k = false; else if (!Ctrl_Approve.UpdateRecordStepById(RecordId, 3)) k = false; } else { if (!Ctrl_Approve.UpdateStep(AppStep)) k = false; else if (!Ctrl_Approve.UpdateRecordStepById(RecordId, 3)) k = false; } if (k == true && rbYes.Checked)//审核成功,写入基本表 if (!AddBaseInfo()) k = false; } if (k == true) MessageBox.ShowAndRedirect(this, "审核成功!", "List_DiShouRu.aspx"); else MessageBox.ShowAndRedirect(this, "审核失败!如有疑问,请与管理员联系", "List_DiShouRu.aspx"); }
/// <summary> /// 确定按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { bool k = true; if (UserLevel == 0) { if (string.IsNullOrEmpty(this.txtReason_Civil.Text)) { MessageBox.Show(this, "批复内容不能为空"); return; } AppStep = Ctrl_Approve.GetAppStepById(RecordId); AppStep.RecordId = RecordId; AppStep.Reason_Civil = this.txtReason_Civil.Text.Trim(); AppStep.Bz_Result_Civil = rbYes.Checked ? 1 : 0; AppStep.Civil_Date = DateTime.Now.ToString("yyyy-MM-dd"); if (Ctrl_Approve.AddStep(AppStep) == 0) { k = false; } else if (!Ctrl_Approve.UpdateRecordStepById(RecordId, 3)) { k = false; } if (k == true && rbYes.Checked)//审核成功,更新基本表 { if (!UpdateBaseInfo()) k = false; } int state = rbYes.Checked ? 1 : 2; if (!Ctrl_Ass_Remployee.UpdateEmployeeByIdCard(IdCard, state)) k = false; if (k == true) MessageBox.ShowAndRedirect(this, "审核成功!", "List_ZaiJiuYe.aspx"); else MessageBox.ShowAndRedirect(this, "审核失败!如有疑问,请与管理员联系", "List_ZaiJiuYe.aspx"); } else { MessageBox.Show(this, "你没有此项的审批权限,联系技术员"); } }
/// <summary> /// 数据初始化绑定 /// </summary> private void Bind() { #region 获取基本数据 int MasterId = 0; AppRecord.StepId = int.Parse(Ctrl_Approve.GetRecordById(RecordId.ToString()).Tables[0].Rows[0]["StepId"].ToString()); int UserId = Ctrl_Approve.GetUserIdByRecordId(RecordId); int Fid = Ctrl_Approve.GetFidByUserId(UserId, "DiBao");//获取家庭Id hdFid.Value = Fid.ToString();//将家庭Id放置前台 dtDiBao = Ctrl_Approve.GetDiBaoByFid(Fid).Tables[0]; for (int i = 0; i < dtDiBao.Rows.Count; i++) { if (i == 0) AppUser.Name = dtDiBao.Rows[i]["Name"].ToString(); if (dtDiBao.Rows[i]["Bz_Master"].ToString() == "1") { MasterId = 1 + i; AppDiBao.Id = int.Parse(dtDiBao.Rows[i]["Id"].ToString()); AppDiBao.Address = dtDiBao.Rows[i]["Address"].ToString(); AppDiBao.Home = dtDiBao.Rows[i]["Home"].ToString(); AppDiBao.Tel1 = dtDiBao.Rows[i]["Tel1"].ToString(); AppDiBao.Tel2 = dtDiBao.Rows[i]["Tel2"].ToString(); AppDiBao.House = dtDiBao.Rows[i]["House"].ToString(); AppDiBao.Square = dtDiBao.Rows[i]["Square"].ToString(); AppDiBao.StreetId = int.Parse(dtDiBao.Rows[i]["StreetId"].ToString()); AppDiBao.CommunityId = int.Parse(dtDiBao.Rows[i]["CommunityId"].ToString()); AppDiBao.ApproveReason = dtDiBao.Rows[i]["ApproveReason"].ToString(); AppDiBao.FamilyMeans = dtDiBao.Rows[i]["FamilyMeans"].ToString(); } } ViewState["dt"] = dtDiBao; lvMemberList.DataSource = dtDiBao; lvMemberList.DataBind(); #endregion #region 初始化申请人基本信息 lbApproverName.Text = AppUser.Name; txtAddress.Text = AppDiBao.Address; txtHome.Text = AppDiBao.Home; txtTel1.Text = AppDiBao.Tel1; txtTel2.Text = AppDiBao.Tel2; txtHouse.Text = AppDiBao.House; txtSquare.Text = AppDiBao.Square; //新增 申请理由和 家庭财产说明 txtApproveReason.Value = AppDiBao.ApproveReason; txtFamilyMoney.Value = AppDiBao.FamilyMeans; #endregion #region 初始化区域信息 drpStreet.DataSource = Ctrl_Area.GetStreetList(); drpStreet.DataTextField = "Name"; drpStreet.DataValueField = "Id"; drpStreet.DataBind(); drpStreet.SelectedValue = AppDiBao.StreetId.ToString(); drpCommunity.DataSource = Ctrl_Area.GetCommunityListByStreetId(int.Parse(drpStreet.SelectedValue)); ; drpCommunity.DataTextField = "Name"; drpCommunity.DataValueField = "Id"; drpCommunity.DataBind(); drpCommunity.SelectedValue = AppDiBao.CommunityId.ToString(); #endregion #region 初始化户主信息(默认为申请人) drpMasterDataBind(); drpMaster.SelectedValue = MasterId.ToString(); #endregion #region 初始化申请步骤及申请意见 AppStep = Ctrl_Approve.GetAppStepById(RecordId); if (UserLevel == 1) { txtReason_Community.Text = (AppStep.Bz_Result_Community == 1 ? "同意\n" : "不同意\n") + AppStep.Reason_Community; } if (UserLevel == 0) { txtReason_Community.Text = (AppStep.Bz_Result_Community == 1 ? "同意\n" : "不同意或未审核\n") + AppStep.Reason_Community; if (AppRecord.StepId > 1) txtReason_Office.Text = (AppStep.Bz_Result_Office == 1 ? "同意\n" : "不同意\n") + AppStep.Reason_Office; if (AppRecord.StepId > 2) txtReason_Civil.Text = (AppStep.Bz_Result_Civil == 1 ? "同意\n" : "不同意\n") + AppStep.Reason_Civil; } #endregion #region 计算收入 MathMoney(); #endregion }
/// <summary> /// 数据初始化绑定 /// </summary> private void Bind() { #region 获取基本数据 //AppRecord.StepId = int.Parse(Ctrl_Approve.GetRecordById(RecordId.ToString()).Tables[0].Rows[0]["StepId"].ToString()); int employeeId = Ctrl_Approve.GetEmployeeIdByRecordId(RecordId); employee = Ctrl_Ass_Remployee.GetRemployeeByEmployeeId(employeeId); #endregion #region 初始化申请人基本信息 EmployeeId = employee.Id; lbApproverName.Text = employee.Name; txtAddress.Text = employee.Address; txtTel1.Text = employee.Tel; txtTel2.Text = employee.Tel1; this.txtIdCard.Text = employee.IdCard; IdCard = employee.IdCard; this.imgPhoto.ImageUrl = employee.ImgPath; this.imgIdCard.ImageUrl = employee.ImgIdCard; this.txtDoc.Value = employee.Descibe; #endregion #region 初始化区域信息 drpStreet.DataSource = Ctrl_Area.GetStreetList(); drpStreet.DataTextField = "Name"; drpStreet.DataValueField = "Id"; drpStreet.DataBind(); drpStreet.SelectedValue = employee.StreetId.ToString(); drpCommunity.DataSource = Ctrl_Area.GetCommunityListByStreetId(int.Parse(drpStreet.SelectedValue)); ; drpCommunity.DataTextField = "Name"; drpCommunity.DataValueField = "Id"; drpCommunity.DataBind(); drpCommunity.SelectedValue = employee.CommunityId.ToString(); #endregion #region 初始化申请步骤及申请意见 AppStep = Ctrl_Approve.GetAppStepById(RecordId); #endregion }
/// <summary> /// 根据审批记录表id找出详细的审批记录以及结果 /// </summary> /// <param name="recordId"></param> /// <returns>返回详细审批记录结果的实体集</returns> public static Approve_Step GetApproveStep(int recordId) { Approve_Step app_Step = new Approve_Step(); try { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from Approve_Step where RecordId=@recordId"); SqlParameter[] parameters = { new SqlParameter("@recordId", SqlDbType.Int), }; parameters[0].Value = recordId; DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); DataRow rows = ds.Tables[0].Rows[0]; if (ds.Tables[0].Rows.Count == 1) { app_Step.Id = (int)rows["Id"]; app_Step.RecordId = (int)rows["RecordId"]; app_Step.Reason_Community = (string)rows["Reason_Community"]; app_Step.Bz_Result_Community = (int)rows["Bz_Result_Community"]; app_Step.Reason_Office = (string)rows["Reason_Office"]; app_Step.Bz_Result_Office = (int)rows["Bz_Result_Office"]; app_Step.Reason_Civil = (string)rows["Reason_Civil"]; app_Step.Bz_Result_Civil = (int)rows["Bz_Result"]; app_Step.Bz_Result = (int)rows["Bz_Result"]; app_Step.Community_Date = (string)rows["Community_Date"]; app_Step.Office_Date = (string)rows["Office_Date"]; app_Step.Civil_Date = (string)rows["Civil_Date"]; } } catch (Exception e) { Log4Net.LogWrite("err", "CommonHelp:GetApproveStep" + e.Message); } return app_Step; }
/// <summary> /// 数据初始化绑定 /// </summary> private void Bind() { #region 获取基本数据 //AppRecord.StepId = int.Parse(Ctrl_Approve.GetRecordById(RecordId.ToString()).Tables[0].Rows[0]["StepId"].ToString()); company = Ctrl_Ass_ReCompany.GetCompanyInfoByCompanyId(companyId); #endregion #region 初始化申请人基本信息 this.lbCompanyName.Text = company.CompanyName; this.txtName.Text = company.CompanyRes; this.txtIdCard.Text = company.ResIdCard; this.txtAddress.Text = company.Address; this.txtTel1.Text = company.Tel1; this.txtTel2.Text = company.Tel2; this.imgPhoto.ImageUrl = company.CompanyPhotoPath; this.imgIdCard.ImageUrl = company.CompanyResPhotoPath; this.txtDoc.Value = company.Descibe; #endregion #region 初始化申请步骤及申请意见 AppStep = Ctrl_Approve.GetAppStepById(RecordId); #endregion }
/// <summary> /// 获取申请步骤信息 /// </summary> /// <param name="RecordId"></param> /// <returns></returns> public static Approve_Step GetAppStepById(int RecordId) { Approve_Step AppStep = new Approve_Step(); DataSet ds = new DataSet(); try { StringBuilder strSql = new StringBuilder(); strSql.Append("Select * from Approve_Step "); strSql.Append("where RecordId=@RecordId"); SqlParameter[] parameters = { new SqlParameter("@RecordId", SqlDbType.Int, 4) }; parameters[0].Value = RecordId; ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Id"] != null && ds.Tables[0].Rows[0]["Id"].ToString() != "") { AppStep.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString()); } if (ds.Tables[0].Rows[0]["RecordId"] != null && ds.Tables[0].Rows[0]["RecordId"].ToString() != "") { AppStep.RecordId = int.Parse(ds.Tables[0].Rows[0]["RecordId"].ToString()); } if (ds.Tables[0].Rows[0]["Reason_Community"] != null && ds.Tables[0].Rows[0]["Reason_Community"].ToString() != "") { AppStep.Reason_Community = ds.Tables[0].Rows[0]["Reason_Community"].ToString(); } if (ds.Tables[0].Rows[0]["Reason_Office"] != null && ds.Tables[0].Rows[0]["Reason_Office"].ToString() != "") { AppStep.Reason_Office = ds.Tables[0].Rows[0]["Reason_Office"].ToString(); } if (ds.Tables[0].Rows[0]["Reason_Civil"] != null && ds.Tables[0].Rows[0]["Reason_Civil"].ToString() != "") { AppStep.Reason_Civil = ds.Tables[0].Rows[0]["Reason_Civil"].ToString(); } if (ds.Tables[0].Rows[0]["Bz_Result_Community"] != null && ds.Tables[0].Rows[0]["Bz_Result_Community"].ToString() != "") { AppStep.Bz_Result_Community = int.Parse(ds.Tables[0].Rows[0]["Bz_Result_Community"].ToString()); } if (ds.Tables[0].Rows[0]["Bz_Result_Office"] != null && ds.Tables[0].Rows[0]["Bz_Result_Office"].ToString() != "") { AppStep.Bz_Result_Office = int.Parse(ds.Tables[0].Rows[0]["Bz_Result_Office"].ToString()); } if (ds.Tables[0].Rows[0]["Bz_Result_Civil"] != null && ds.Tables[0].Rows[0]["Bz_Result_Civil"].ToString() != "") { AppStep.Bz_Result_Civil = int.Parse(ds.Tables[0].Rows[0]["Bz_Result_Civil"].ToString()); } if (ds.Tables[0].Rows[0]["Bz_Result"] != null && ds.Tables[0].Rows[0]["Bz_Result"].ToString() != "") { AppStep.Bz_Result = int.Parse(ds.Tables[0].Rows[0]["Bz_Result"].ToString()); } if (ds.Tables[0].Rows[0]["Community_Date"] != null && ds.Tables[0].Rows[0]["Community_Date"].ToString() != "") { AppStep.Community_Date = ds.Tables[0].Rows[0]["Community_Date"].ToString(); } if (ds.Tables[0].Rows[0]["Office_Date"] != null && ds.Tables[0].Rows[0]["Office_Date"].ToString() != "") { AppStep.Office_Date = ds.Tables[0].Rows[0]["Office_Date"].ToString(); } if (ds.Tables[0].Rows[0]["Civil_Date"] != null && ds.Tables[0].Rows[0]["Civil_Date"].ToString() != "") { AppStep.Civil_Date = ds.Tables[0].Rows[0]["Civil_Date"].ToString(); } } } catch (Exception e) { Log4Net.LogWrite("err", "Controler.Ctrl_Approve.AddUser:" + e.Message); } ds.Dispose(); return AppStep; }
/// <summary> /// 插入一行审批阶段意见数据 /// </summary> /// <param name="AppStep">审批阶段意见实体</param> /// <returns>成功返回1 否则返回0</returns> public static int AddStep(Approve_Step AppStep) { int iExecute = 0; try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Approve_Step("); strSql.Append( "RecordId,Reason_Community,Reason_Office,Reason_Civil,Bz_Result_Community,Bz_Result_Office,Bz_Result_Civil,Bz_Result,Community_Date,Office_Date,Civil_Date)"); strSql.Append(" values ("); strSql.Append( "@RecordId,@Reason_Community,@Reason_Office,@Reason_Civil,@Bz_Result_Community,@Bz_Result_Office,@Bz_Result_Civil,@Bz_Result,@Community_Date,@Office_Date,@Civil_Date)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@RecordId", SqlDbType.Int), new SqlParameter("@Reason_Community", SqlDbType.NVarChar, 100), new SqlParameter("@Reason_Office", SqlDbType.NVarChar, 100), new SqlParameter("@Reason_Civil", SqlDbType.NVarChar, 100), new SqlParameter("@Bz_Result_Community", SqlDbType.Int), new SqlParameter("@Bz_Result_Office", SqlDbType.Int), new SqlParameter("@Bz_Result_Civil", SqlDbType.Int), new SqlParameter("@Bz_Result", SqlDbType.Int), new SqlParameter("@Community_Date", SqlDbType.NVarChar, 50), new SqlParameter("@Office_Date", SqlDbType.NVarChar, 50), new SqlParameter("@Civil_Date", SqlDbType.NVarChar, 50), }; parameters[0].Value = AppStep.RecordId; parameters[1].Value = AppStep.Reason_Community; parameters[2].Value = AppStep.Reason_Office; parameters[3].Value = AppStep.Reason_Civil; parameters[4].Value = AppStep.Bz_Result_Community; parameters[5].Value = AppStep.Bz_Result_Office; parameters[6].Value = AppStep.Bz_Result_Civil; parameters[7].Value = AppStep.Bz_Result; parameters[8].Value = AppStep.Community_Date; parameters[9].Value = AppStep.Office_Date; parameters[10].Value = AppStep.Civil_Date; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj != null) { iExecute = Convert.ToInt32(obj); } } catch (Exception e) { Log4Net.LogWrite("err", "Controler.Ctrl_Approve.AddUser:" + e.Message); } return iExecute; }
/// <summary> /// 更新一行审批阶段意见数据 /// </summary> /// <param name="AppStep">审批阶段意见实体</param> /// <returns>成功返回true 否则返回false</returns> public static bool UpdateStep(Approve_Step AppStep) { bool iExecute = false; try { StringBuilder strSql = new StringBuilder(); strSql.Append(" update Approve_Step set "); strSql.Append(" RecordId=@RecordId, "); strSql.Append(" Reason_Community=@Reason_Community, "); strSql.Append(" Reason_Office=@Reason_Office, "); strSql.Append(" Reason_Civil=@Reason_Civil, "); strSql.Append(" Bz_Result_Community=@Bz_Result_Community, "); strSql.Append(" Bz_Result_Office=@Bz_Result_Office, "); strSql.Append(" Bz_Result_Civil=@Bz_Result_Civil, "); strSql.Append(" Bz_Result=@Bz_Result, "); strSql.Append(" Community_Date=@Community_Date, "); strSql.Append(" Office_Date=@Office_Date, "); strSql.Append(" Civil_Date=@Civil_Date "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@RecordId", SqlDbType.Int), new SqlParameter("@Reason_Community", SqlDbType.NVarChar, 100), new SqlParameter("@Reason_Office", SqlDbType.NVarChar, 100), new SqlParameter("@Reason_Civil", SqlDbType.NVarChar, 100), new SqlParameter("@Bz_Result_Community", SqlDbType.Int), new SqlParameter("@Bz_Result_Office", SqlDbType.Int), new SqlParameter("@Bz_Result_Civil", SqlDbType.Int), new SqlParameter("@Bz_Result", SqlDbType.Int), new SqlParameter("@Community_Date", SqlDbType.NVarChar, 50), new SqlParameter("@Office_Date", SqlDbType.NVarChar, 50), new SqlParameter("@Civil_Date", SqlDbType.NVarChar, 50), new SqlParameter("@Id", SqlDbType.Int) }; parameters[0].Value = AppStep.RecordId; parameters[1].Value = AppStep.Reason_Community; parameters[2].Value = AppStep.Reason_Office; parameters[3].Value = AppStep.Reason_Civil; parameters[4].Value = AppStep.Bz_Result_Community; parameters[5].Value = AppStep.Bz_Result_Office; parameters[6].Value = AppStep.Bz_Result_Civil; parameters[7].Value = AppStep.Bz_Result; parameters[8].Value = AppStep.Community_Date; parameters[9].Value = AppStep.Office_Date; parameters[10].Value = AppStep.Civil_Date; parameters[11].Value = AppStep.Id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { iExecute = true; } } catch (Exception e) { Log4Net.LogWrite("err", "SysAccessData.SysManage.SysMenuManage\\DacMenuInfo\\Update" + e.Message); } return iExecute; }