public void btnSubmit_Click(object sender, EventArgs e) { string confirmCode = txtConfirmCode.Text.Trim(); Confirm confirm = new Confirm(); if (Med_Ass.VerifyConfirmCode(confirmCode, ref confirm)) { Session["Id"] = confirm.Id.ToString(); Session["Fid"] = confirm.Fid.ToString(); Session["IdCard"] = confirm.IdCard.ToString(); Session["TypeId"] = (confirm.TypeId - 1).ToString(); Session["RecordId"] = confirm.RecordId.ToString(); if (confirm.TypeId == 3) { Response.Redirect("Result/DiShouRuResult.aspx"); } if (confirm.TypeId == 9) { Response.Redirect("Result/TempHelpResult.aspx"); } if (confirm.TypeId == 10) { Response.Redirect("Result/YiLiao_Result.aspx"); } if (confirm.TypeId == 11) { string url = (type == 0 ? "ZaiJiuYe/ZaiJiuYe_Person.aspx" : (type == 1 ? "ZaiJiuYe/ZaiJiuYe_Company.aspx" : "Result/ZaiJiuYe_Result.aspx")); Response.Redirect(url); } if (confirm.TypeId == 20) { Response.Redirect("Result/ReCompany_Result.aspx"); } } else { MessageBox.Show(this, "你输入的查询码不正确,请重新输入"); } }
/// <summary> /// 验证验证码是否,正确, /// 正确的话,返回主键id(供查询步骤使用)和相应审批表中的主键id /// </summary> /// <param name="confirm">验证码实体类</param> /// <returns>如果存在的话返回true</returns> public static bool VerifyConfirmCode(string confirmCode, ref Confirm confirm) { bool result = false; try { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Id,Fid,IdCard,Confirm,TypeId,RecordId from Ass_Confirm where Confirm= @confirm order by Id desc "); SqlParameter[] parameters = { new SqlParameter("@confirm",SqlDbType.NVarChar,50), }; parameters[0].Value = confirmCode; DataSet ds = new DataSet(); ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count == 1) { confirm.Id = (long)ds.Tables[0].Rows[0]["Id"]; confirm.IdCard = (string)ds.Tables[0].Rows[0]["IdCard"]; confirm.Fid = (long)ds.Tables[0].Rows[0]["Fid"]; if (ds.Tables[0].Rows[0]["RecordId"] != DBNull.Value) { confirm.RecordId = (int)ds.Tables[0].Rows[0]["RecordId"]; } else { confirm.RecordId = 0; } confirm.ConfirmCode = confirmCode; if (ds.Tables[0].Rows[0]["TypeId"] != DBNull.Value) { confirm.TypeId = (int)ds.Tables[0].Rows[0]["TypeId"]; } else { confirm.TypeId = 10; } ds.Dispose(); result = true; } } catch (Exception e) { Log4Net.LogWrite("err", "Med_Ass:VerifyConfirmCode:error:" + e.Message); } return result; }
/// <summary> /// 当有医疗救助人员申请时,生成一条查询码,插入到相应表中,供查询使用,返回刚刚插入数据在数据库验证码表中的主键Id /// </summary> /// <param name="confirm">验证码实体</param> /// <returns>刚刚插入数据在数据库验证码表中的主键Id,默认为0</returns> public static int InsertConfirm(Confirm confirm) { int result = 0; try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Ass_Confirm(Fid,IdCard,Confirm,TypeId) values(@fid,@idCard,@confirmCode,@typeId)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@fid", SqlDbType.BigInt), new SqlParameter("@idCard", SqlDbType.NVarChar,50), new SqlParameter("@confirmCode",SqlDbType.NVarChar,50), new SqlParameter("@typeId",SqlDbType.Int) }; parameters[0].Value = confirm.Fid; parameters[1].Value = confirm.IdCard; parameters[2].Value = confirm.ConfirmCode; parameters[3].Value = confirm.TypeId; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj != null) { result = Convert.ToInt32(obj); } } catch (Exception e) { Log4Net.LogWrite("err", "Controler.Med_Ass.AddDiBao:" + e.Message); } return result; }
protected void btnSave_Click1(object sender, EventArgs e) { medApp.IdCard = AppUser.IdCard; if (!Med_Ass.IsHasNotApproveRecorder(medApp.IdCard)) { medApp.Name = lbApproverName.Text; medApp.Tel = txtTel1.Text; medApp.StreetId = int.Parse(drpStreet.SelectedValue); medApp.CommunityId = int.Parse(drpCommunity.SelectedValue); medApp.IllName = txtIllName.Text; medApp.Reason = txtReason.Value; #region 购药目的 住院 买药 门诊 逻辑验证 //填写申请的目的,钱用于哪方面 decimal money1 = 0; decimal money2 = 0; decimal money3 = 0; if ((ckHospital.Checked == true) && (!string.IsNullOrEmpty(txtMoney0.Value))) { medApp.IsHospital = 1; if (!decimal.TryParse(txtMoney0.Value, out money1)) { // medApp.HospitalFee = money1; MessageBox.Show(this, "住院金额填写不正确"); return; } } else if (((ckHospital.Checked == true) && (string.IsNullOrEmpty(txtMoney0.Value))) || (ckHospital.Checked == false) && (!string.IsNullOrEmpty(txtMoney0.Value))) { MessageBox.Show(this, "住院项目填写错误,检查你的输入情况"); return; } if ((ckMenZhen.Checked == true) && (!string.IsNullOrEmpty(txtMoney1.Value))) { medApp.IsMenZhen = 1; if (!decimal.TryParse(txtMoney1.Value, out money2)) { // medApp.HospitalFee = money1; MessageBox.Show(this, "门诊金额填写不正确"); return; } } else if (((ckMenZhen.Checked == true) && (string.IsNullOrEmpty(txtMoney1.Value))) || (ckMenZhen.Checked == false) && (!string.IsNullOrEmpty(txtMoney1.Value))) { MessageBox.Show(this, "门诊项目填写错误,检查你的输入情况"); return; } if ((ckGouYao.Checked == true) && (!string.IsNullOrEmpty(txtMoney2.Value))) { medApp.IsGouYao = 1; if (!decimal.TryParse(txtMoney2.Value, out money3)) { // medApp.HospitalFee = money1; MessageBox.Show(this, "购药金额填写不正确"); return; } } else if (((ckGouYao.Checked == true) && (string.IsNullOrEmpty(txtMoney2.Value))) || (ckGouYao.Checked == false) && (!string.IsNullOrEmpty(txtMoney2.Value))) { MessageBox.Show(this, "购药项目填写错误,检查你的输入情况"); return; } if ((ckGouYao.Checked == false) && (ckMenZhen.Checked == false) && (ckHospital.Checked == false)) { MessageBox.Show(this, "至少选择一个项目申请"); return; } if ((string.IsNullOrEmpty(txtMoney0.Value)) && (string.IsNullOrEmpty(txtMoney1.Value)) && (string.IsNullOrEmpty(txtMoney2.Value))) { MessageBox.Show(this, "填写错误"); return; } medApp.HospitalFee = money1; medApp.MenZhenFee = money2; medApp.GouYaoFee = money3; #endregion medApp.Home = txtHome.Text; medApp.Address = txtAddress.Text; //medApp.Purpose = rbClinic.Checked == true ? "门诊" : (rbMed.Checked == true ? "购药" : "住院"); medApp.ClassId = Ass_Class.SelectedIndex + 1; ; medApp.typeId = Ass_Type.SelectedIndex + 1; ; medApp.State = 0; medApp.Bz_Cz = 0; medApp.Sex = dpSex.SelectedValue; medApp.TotalMoney = 0; medApp.AppTime = DateTime.Now.ToString("yyyy-MM-dd"); if (action == "modify") { if (Med_Ass.UpdateAssById(fid, medApp)) { MessageBox.Show(this, "修改成功"); } } else if (action == "new") { string confirmCode = Med_Ass.GenerateRandomNumber(6); int fid = Med_Ass.InsertMedAss(medApp); if (fid != 0) { Entity.Confirm confirm = new Entity.Confirm(); confirm.Fid = fid; confirm.IdCard = medApp.IdCard; confirm.ConfirmCode = confirmCode; confirm.TypeId = 10; int confirmId = Med_Ass.InsertConfirm(confirm); if (confirmId != 0) { int result = Med_Ass.InsertStep(confirmId, medApp.IdCard, 0); if (result != 0) { btnSave.Enabled = false; MessageBox.ShowAndRedirect(this, "申请成功,请及时查询回馈信息,牢记下一页面的查询码,供查询使用:", "../Confirm.aspx?confirmCode=" + confirmCode); //string sOpen = "<script>alert('申请成功,请及时查询回馈信息,牢记你的查询码,供查询使用:'" + confirmCode + ");window.openner=null;window.close();</script>"; //HttpContext.Current.Response.Write(sOpen); //HttpContext.Current.Response.End(); // Response.Write("<script>alert('申请成功,请及时查询回馈信息,牢记你的查询码,供查询使用:'" + confirmCode + ");window.opener=null;window.close();</script>");// 不会弹出询问 } else { MessageBox.Show(this, "审批步骤列表发生错误"); } } else { MessageBox.Show(this, "验证码列表发生错误"); } } else { MessageBox.Show(this, "医疗列表发生错误"); } } } else { MessageBox.ShowAndRedirect(this, "你还有未被审核的项目,请联系你所在辖区的负责人", "../../First.aspx"); } }
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> /// 添加一条验证码记录到验证码列表 /// </summary> /// <param name="confirm">confirm实体</param> /// <returns></returns> public static int AddConfirm(Confirm confirm) { int iExecute = 0; try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Ass_Confirm("); strSql.Append("Fid,IdCard,Confirm,TypeId,RecordId)"); strSql.Append(" values ("); strSql.Append("@Fid,@IdCard,@Confirm,@TypeId,@RecordId)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Fid", SqlDbType.BigInt), new SqlParameter("@IdCard", SqlDbType.NVarChar,50), new SqlParameter("@Confirm", SqlDbType.NVarChar,50), new SqlParameter("@TypeId", SqlDbType.Int), new SqlParameter("@RecordId", SqlDbType.Int) }; parameters[0].Value = confirm.Fid; parameters[1].Value = confirm.IdCard; parameters[2].Value = confirm.ConfirmCode; parameters[3].Value = confirm.TypeId; parameters[4].Value = confirm.RecordId; 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; }