Пример #1
0
        /// <summary>
        /// 根据Id获取低保申请数据
        /// </summary>
        /// <param name="Id">Id</param>
        /// <returns>该人低保数据</returns>
        public static Approve_DiShouRu GetDiShouRuById(int Id)
        {
            Approve_DiShouRu appDiShouRu = new Approve_DiShouRu();
            Approve_DiBao AppDiBao = new Approve_DiBao();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("select A.Id,A.Uid,A.Fid,A.Bz_Approver,A.Bz_Master,A.Bz_BaoZhang,A.Name,A.IdCard,");
                strSql.Append("B.Address,B.Home,B.Tel1,B.Tel2,B.House,B.Square,A.StreetId,A.CommunityId,");
                strSql.Append("A.Wage,A.Wage1,A.Wage2,A.Wage3,A.Wage4,A.Wage5,A.Wage6,A.Bz_Cz");
                strSql.Append(" from Approve_DiShouRu as A");
                strSql.Append(" inner join (select * from Approve_DiShouRu where Bz_Master=1) as B on A.Fid=B.Fid");
                strSql.Append(" where A.Id=" + Id);
                DataSet ds = new DataSet();
                ds = DbHelperSQL.Query(strSql.ToString());
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["Id"] != null && ds.Tables[0].Rows[0]["Id"].ToString() != "")
                    {
                        appDiShouRu.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Uid"] != null && ds.Tables[0].Rows[0]["Uid"].ToString() != "")
                    {
                        appDiShouRu.Uid = int.Parse(ds.Tables[0].Rows[0]["Uid"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Fid"] != null && ds.Tables[0].Rows[0]["Fid"].ToString() != "")
                    {
                        appDiShouRu.Fid = int.Parse(ds.Tables[0].Rows[0]["Fid"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Bz_Approver"] != null &&
                        ds.Tables[0].Rows[0]["Bz_Approver"].ToString() != "")
                    {
                        appDiShouRu.Bz_Approver = int.Parse(ds.Tables[0].Rows[0]["Bz_Approver"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Bz_Master"] != null && ds.Tables[0].Rows[0]["Bz_Master"].ToString() != "")
                    {
                        appDiShouRu.Bz_Master = int.Parse(ds.Tables[0].Rows[0]["Bz_Master"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Bz_BaoZhang"] != null &&
                        ds.Tables[0].Rows[0]["Bz_BaoZhang"].ToString() != "")
                    {
                        appDiShouRu.Bz_BaoZhang = int.Parse(ds.Tables[0].Rows[0]["Bz_BaoZhang"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["StreetId"] != null && ds.Tables[0].Rows[0]["StreetId"].ToString() != "")
                    {
                        appDiShouRu.StreetId = int.Parse(ds.Tables[0].Rows[0]["StreetId"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["CommunityId"] != null &&
                        ds.Tables[0].Rows[0]["CommunityId"].ToString() != "")
                    {
                        appDiShouRu.CommunityId = int.Parse(ds.Tables[0].Rows[0]["CommunityId"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Name"] != null && ds.Tables[0].Rows[0]["Name"].ToString() != "")
                    {
                        appDiShouRu.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["IdCard"] != null && ds.Tables[0].Rows[0]["IdCard"].ToString() != "")
                    {
                        appDiShouRu.IdCard = ds.Tables[0].Rows[0]["IdCard"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Address"] != null && ds.Tables[0].Rows[0]["Address"].ToString() != "")
                    {
                        appDiShouRu.Address = ds.Tables[0].Rows[0]["Address"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Home"] != null && ds.Tables[0].Rows[0]["Home"].ToString() != "")
                    {
                        appDiShouRu.Home = ds.Tables[0].Rows[0]["Home"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Tel1"] != null && ds.Tables[0].Rows[0]["Tel1"].ToString() != "")
                    {
                        appDiShouRu.Tel1 = ds.Tables[0].Rows[0]["Tel1"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Tel2"] != null && ds.Tables[0].Rows[0]["Tel2"].ToString() != "")
                    {
                        appDiShouRu.Tel2 = ds.Tables[0].Rows[0]["Tel2"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["House"] != null && ds.Tables[0].Rows[0]["House"].ToString() != "")
                    {
                        appDiShouRu.House = ds.Tables[0].Rows[0]["House"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Square"] != null && ds.Tables[0].Rows[0]["Square"].ToString() != "")
                    {
                        appDiShouRu.Square = ds.Tables[0].Rows[0]["Square"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Wage"] != null && ds.Tables[0].Rows[0]["Wage"].ToString() != "")
                    {
                        appDiShouRu.Wage = ds.Tables[0].Rows[0]["Wage"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Wage1"] != null && ds.Tables[0].Rows[0]["Wage1"].ToString() != "")
                    {
                        appDiShouRu.Wage1 = ds.Tables[0].Rows[0]["Wage1"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Wage2"] != null && ds.Tables[0].Rows[0]["Wage2"].ToString() != "")
                    {
                        appDiShouRu.Wage2 = ds.Tables[0].Rows[0]["Wage2"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Wage3"] != null && ds.Tables[0].Rows[0]["Wage3"].ToString() != "")
                    {
                        appDiShouRu.Wage3 = ds.Tables[0].Rows[0]["Wage3"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Wage4"] != null && ds.Tables[0].Rows[0]["Wage4"].ToString() != "")
                    {
                        appDiShouRu.Wage4 = ds.Tables[0].Rows[0]["Wage4"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Wage5"] != null && ds.Tables[0].Rows[0]["Wage5"].ToString() != "")
                    {
                        appDiShouRu.Wage5 = ds.Tables[0].Rows[0]["Wage5"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Wage6"] != null && ds.Tables[0].Rows[0]["Wage6"].ToString() != "")
                    {
                        appDiShouRu.Wage6 = ds.Tables[0].Rows[0]["Wage6"].ToString();
                    }
                    if (ds.Tables[0].Rows[0]["Bz_Cz"] != null && ds.Tables[0].Rows[0]["Bz_Cz"].ToString() != "")
                    {
                        appDiShouRu.Bz_Cz = int.Parse(ds.Tables[0].Rows[0]["Bz_Cz"].ToString());
                    }
                    ds.Dispose();
                }
            }
            catch (Exception e)
            {
                Log4Net.LogWrite("err", "Controler.Ctrl_Approve.GetDiBaoById:" + e.Message);
            }
            return appDiShouRu;
        }
Пример #2
0
        /// <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
        }
Пример #3
0
        /// <summary>
        /// 添加一行低收入人员申请信息
        /// </summary>
        /// <param name="AppDiBao">低收入人员信息实体</param>
        /// <returns>添加成功返回非0值,否则返回0</returns>
        public static int AddDiShouRu(Approve_DiShouRu AppDiShouRu)
        {
            int iExecute = 0;
            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into Approve_DiShouRu(");
                strSql.Append("Uid,Fid,Bz_Approver,Bz_Master,Bz_BaoZhang,Name,IdCard,Address,Home,StreetId,CommunityId,");
                strSql.Append("Tel1,Tel2,House,Square,Wage,Wage1,Wage2,Wage3,Wage4,Wage5,Wage6,Bz_Cz,Add_Time,ApproveReason)");
                strSql.Append(" values (");
                strSql.Append(
                    "@Uid,@Fid,@Bz_Approver,@Bz_Master,@Bz_BaoZhang,@Name,@IdCard,@Address,@Home,@StreetId,@CommunityId,");
                strSql.Append(
                    "@Tel1,@Tel2,@House,@Square,@Wage,@Wage1,@Wage2,@Wage3,@Wage4,@Wage5,@Wage6,@Bz_Cz,@AddTime,@ApproveReason)");
                strSql.Append(";select @@IDENTITY");

                SqlParameter[] parameters =
                {
                    new SqlParameter("@Uid", SqlDbType.Int),
                    new SqlParameter("@Fid", SqlDbType.Int),
                    new SqlParameter("@Bz_Approver", SqlDbType.Int),
                    new SqlParameter("@Bz_Master", SqlDbType.Int),
                    new SqlParameter("@Bz_BaoZhang", SqlDbType.Int),
                    new SqlParameter("@Name", SqlDbType.NVarChar, 30),
                    new SqlParameter("@IdCard", SqlDbType.NVarChar, 30),
                    new SqlParameter("@Address", SqlDbType.NVarChar, 100),
                    new SqlParameter("@Home", SqlDbType.NVarChar, 100),
                    new SqlParameter("@StreetId", SqlDbType.Int),
                    new SqlParameter("@CommunityId", SqlDbType.Int),
                    new SqlParameter("@Tel1", SqlDbType.NVarChar, 30),
                    new SqlParameter("@Tel2", SqlDbType.NVarChar, 30),
                    new SqlParameter("@House", SqlDbType.NVarChar, 30),
                    new SqlParameter("@Square", SqlDbType.NVarChar, 30),
                    new SqlParameter("@Wage", SqlDbType.NVarChar, 10),
                    new SqlParameter("@Wage1", SqlDbType.NVarChar, 10),
                    new SqlParameter("@Wage2", SqlDbType.NVarChar, 10),
                    new SqlParameter("@Wage3", SqlDbType.NVarChar, 10),
                    new SqlParameter("@Wage4", SqlDbType.NVarChar, 10),
                    new SqlParameter("@Wage5", SqlDbType.NVarChar, 10),
                    new SqlParameter("@Wage6", SqlDbType.NVarChar, 10),
                    new SqlParameter("@Bz_Cz", SqlDbType.Int),
                    new SqlParameter("@AddTime", SqlDbType.NVarChar, 50),
                    new SqlParameter("@ApproveReason", SqlDbType.NVarChar, 500)
                };
                parameters[0].Value = AppDiShouRu.Uid;
                parameters[1].Value = AppDiShouRu.Fid;
                parameters[2].Value = AppDiShouRu.Bz_Approver;
                parameters[3].Value = AppDiShouRu.Bz_Master;
                parameters[4].Value = AppDiShouRu.Bz_BaoZhang;
                parameters[5].Value = AppDiShouRu.Name;
                parameters[6].Value = AppDiShouRu.IdCard;
                parameters[7].Value = AppDiShouRu.Address;
                parameters[8].Value = AppDiShouRu.Home;
                parameters[9].Value = AppDiShouRu.StreetId;
                parameters[10].Value = AppDiShouRu.CommunityId;
                parameters[11].Value = AppDiShouRu.Tel1;
                parameters[12].Value = AppDiShouRu.Tel2;
                parameters[13].Value = AppDiShouRu.House;
                parameters[14].Value = AppDiShouRu.Square;
                parameters[15].Value = AppDiShouRu.Wage;
                parameters[16].Value = AppDiShouRu.Wage1;
                parameters[17].Value = AppDiShouRu.Wage2;
                parameters[18].Value = AppDiShouRu.Wage3;
                parameters[19].Value = AppDiShouRu.Wage4;
                parameters[20].Value = AppDiShouRu.Wage5;
                parameters[21].Value = AppDiShouRu.Wage6;
                parameters[22].Value = AppDiShouRu.Bz_Cz;
                parameters[23].Value = AppDiShouRu.Add_Time;
                parameters[24].Value = AppDiShouRu.ApproveReason;
                object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
                if (obj != null)
                {
                    iExecute = Convert.ToInt32(obj);
                }
            }
            catch (Exception e)
            {
                Log4Net.LogWrite("err", "Controler.Ctrl_Approve.AddDiBao:" + e.Message);
            }
            return iExecute;
        }