예제 #1
0
        /// <summary>
        /// 获取T_FB_REPAYAPPLYMASTER信息
        /// </summary>
        /// <param name="strRepayApplyMasterId">主键索引</param>
        /// <returns></returns>
        public T_FB_REPAYAPPLYMASTER GetRepayApplyMasterByID(string strRepayApplyMasterId)
        {
            if (string.IsNullOrEmpty(strRepayApplyMasterId))
            {
                return(null);
            }

            RepayApplyMasterDAL dalRepayApplyMaster = new RepayApplyMasterDAL();
            StringBuilder       strFilter           = new StringBuilder();
            List <string>       objArgs             = new List <string>();

            if (!string.IsNullOrEmpty(strRepayApplyMasterId))
            {
                strFilter.Append(" REPAYAPPLYMASTERID == @0");
                objArgs.Add(strRepayApplyMasterId);
            }
            try
            {
                T_FB_REPAYAPPLYMASTER entRd = dalRepayApplyMaster.GetRepayApplyMasterRdByMultSearch(strFilter.ToString(), objArgs.ToArray());
                return(entRd);
            }
            catch (Exception ex)
            {
                string ErrInfo = this.GetType().ToString() + ":GetRepayApplyMasterByID," + System.DateTime.Now.ToString() + "," + ex.Message;
                Tracer.Debug(ErrInfo);
            }
            return(null);
        }
예제 #2
0
        /// <summary>
        /// 根据查询条件,获取还款信息(主要用于查询分页)
        /// </summary>
        /// <param name="strOwnerID">查询人的员工ID</param>
        /// <param name="strDateStart">查询起始时间</param>
        /// <param name="strDateEnd">查询截止时间</param>
        /// <param name="strCheckState">查询审核状态</param>
        /// <param name="strFilter">查询条件</param>
        /// <param name="objArgs">查询参数</param>
        /// <param name="strOrderBy">strSortKey</param>
        /// <returns></returns>
        public static IQueryable <T_FB_REPAYAPPLYMASTER> GetAllRepayApplyMasterRdListByMultSearch(string strOwnerID, string strDateStart,
                                                                                                  string strDateEnd, string strCheckState, string strFilter, List <object> objArgs, string strSortKey)
        {
            try
            {
                RepayApplyMasterDAL dalRepay = new RepayApplyMasterDAL();
                string strOrderBy            = string.Empty;

                if (string.IsNullOrWhiteSpace(strOwnerID) || string.IsNullOrWhiteSpace(strCheckState))
                {
                    return(null);
                }

                if (!string.IsNullOrEmpty(strSortKey))
                {
                    strOrderBy = strSortKey;
                }
                else
                {
                    strOrderBy = " REPAYAPPLYMASTERID ";
                }

                SMT.SaaS.BLLCommonServices.Utility ulFoo = new SaaS.BLLCommonServices.Utility();
                if (strCheckState != Convert.ToInt32(FBAEnums.CheckStates.WaittingApproval).ToString())
                {
                    ulFoo.SetOrganizationFilter(ref strFilter, ref objArgs, strOwnerID, "T_FB_REPAYAPPLYMASTER");
                }
                else
                {
                    string StrOld = "";
                    StrOld = strFilter;//将过滤前的字符串付给再比较
                    ulFoo.SetFilterWithflow("REPAYAPPLYMASTERID", "T_FB_REPAYAPPLYMASTER", strOwnerID, ref strCheckState, ref strFilter, ref objArgs);
                    if (StrOld.Equals(strFilter))
                    {
                        return(null);
                    }
                    strCheckState = Convert.ToInt32(FBAEnums.CheckStates.Approving).ToString();
                }

                if (strCheckState == Convert.ToInt32(FBAEnums.CheckStates.All).ToString())
                {
                    strCheckState = string.Empty;
                }

                var ents = dalRepay.GetRepayApplyMasterRdListByMultSearch(strCheckState, strDateStart, strDateEnd, strOrderBy, strFilter, objArgs.ToArray());
                return(ents);
            }
            catch (Exception ex)
            {
                Utility.SaveLog(DateTime.Now.ToString() + "调用函数GetAllRepayApplyMasterRdListByMultSearch出错, 查询人的员工ID为:" + strOwnerID + ",错误信息为:" + ex.ToString());
            }

            return(null);
        }
예제 #3
0
        private void BindRepayRd(string strID)
        {
            string strSql = string.Format(string.Copy(strRepaySearch), strID);

            RepayApplyMasterDAL dalRepay = new RepayApplyMasterDAL();
            DataTable dtRepay = dalRepay.GetRepayRdList(strSql);
            if (dtRepay == null)
            {
                return;
            }

            gvRepayList.DataSource = dtRepay;
            gvRepayList.DataBind();
        }
예제 #4
0
        private void BindRepayRd(string strID)
        {
            string strSql = string.Format(string.Copy(strRepaySearch), strID);

            RepayApplyMasterDAL dalRepay = new RepayApplyMasterDAL();
            DataTable           dtRepay  = dalRepay.GetRepayRdList(strSql);

            if (dtRepay == null)
            {
                return;
            }

            gvRepayList.DataSource = dtRepay;
            gvRepayList.DataBind();
        }
예제 #5
0
        protected void btnUpdateUnRepayRd_Click(object sender, EventArgs e)
        {
            BorrowApplyMasterDAL dalBorrow = new BorrowApplyMasterDAL();
            RepayApplyMasterDAL dalRepay = new RepayApplyMasterDAL();
            ChargeApplyMasterDAL dalCharge = new ChargeApplyMasterDAL();

            foreach (GridViewRow row in gvUnRepayList.Rows)
            {
                string strId = Server.HtmlDecode(row.Cells[1].Text).ToString();
                string strBorrow = Server.HtmlDecode(row.Cells[6].Text).ToString();
                string strUnRepay = Server.HtmlDecode(row.Cells[7].Text).ToString();
                if (string.IsNullOrWhiteSpace(strId) || string.IsNullOrWhiteSpace(strBorrow) || string.IsNullOrWhiteSpace(strUnRepay))
                {
                    continue;
                }                

                string strSql_Repay = string.Format(string.Copy(strRepaySearch), strId);

                DataTable dtRepay = dalRepay.GetRepayRdList(strSql_Repay);
                if (dtRepay == null)
                {
                    continue;
                }                

                decimal dRepayMoney = 0;
                decimal dUpdateMoney = 0;
                decimal dBorrow = 0;
                decimal dUnRepay = 0;
                decimal.TryParse(strBorrow, out dBorrow);
                decimal.TryParse(strUnRepay, out dUnRepay);
                foreach (DataRow item in dtRepay.Rows)
                {
                    decimal dRepayTemp = 0, dChage = 0;
                    string strRepayId = string.Empty, strOrderType = string.Empty;

                    if (item["ORDERTYPE"] == null || item["REPAYMONEY"] == null || item["CHARGEMONEY"] == null)
                    {
                        continue;
                    }

                    strRepayId = item["REPAYAPPLYDETAILID"].ToString();
                    strOrderType = item["ORDERTYPE"].ToString();

                    if (strOrderType == "Repay")
                    {
                        decimal.TryParse(item["REPAYMONEY"].ToString(), out dRepayTemp);
                    }
                    else if (strOrderType == "Charge")
                    {
                        decimal.TryParse(item["REPAYMONEY"].ToString(), out dRepayTemp);
                        decimal.TryParse(item["CHARGEMONEY"].ToString(), out dChage);

                        decimal dTemp = dBorrow - dRepayMoney;
                        bool bUpdate = false;
                        if (dTemp >= dChage)
                        {
                            if (dRepayTemp < dChage)
                            {
                                dRepayTemp = dChage;
                                bUpdate = true;
                            }
                        }
                        else
                        {
                            if (dRepayTemp != dTemp)
                            {
                                dRepayTemp = dTemp;
                                bUpdate = true;
                            }
                        }

                        if (bUpdate)
                        {
                            string strUpdateChage = string.Format(string.Copy(strChageUpdate), dRepayTemp, strRepayId);
                            dalCharge.UpdateBySql(strUpdateChage);
                            Literal5.Text += "已更新的冲借款" + strRepayId + ";";
                        } 
                    }
                    dRepayMoney += dRepayTemp;
                }

                if (dRepayMoney == 0)
                {
                    Literal4.Text += "该借款" + strId + "不存在还款;";
                }

                if (dRepayMoney > dBorrow)
                {
                    dRepayMoney = dBorrow;
                    Literal4.Text += "还款超出借款" + strId + ";";
                }

                dUpdateMoney = dBorrow - dRepayMoney;
                if (dUpdateMoney == dUnRepay)
                {
                    continue;
                }
                string strUpdateBorrow = string.Format(string.Copy(strBorrowUpdate), dUpdateMoney, strId);
                dalBorrow.UpdateBySql(strUpdateBorrow);
                Literal3.Text += "已更新的借款" + strId + ";";
            }
        }
예제 #6
0
        protected void btnUpdateUnRepayRd_Click(object sender, EventArgs e)
        {
            BorrowApplyMasterDAL dalBorrow = new BorrowApplyMasterDAL();
            RepayApplyMasterDAL  dalRepay  = new RepayApplyMasterDAL();
            ChargeApplyMasterDAL dalCharge = new ChargeApplyMasterDAL();

            foreach (GridViewRow row in gvUnRepayList.Rows)
            {
                string strId      = Server.HtmlDecode(row.Cells[1].Text).ToString();
                string strBorrow  = Server.HtmlDecode(row.Cells[6].Text).ToString();
                string strUnRepay = Server.HtmlDecode(row.Cells[7].Text).ToString();
                if (string.IsNullOrWhiteSpace(strId) || string.IsNullOrWhiteSpace(strBorrow) || string.IsNullOrWhiteSpace(strUnRepay))
                {
                    continue;
                }

                string strSql_Repay = string.Format(string.Copy(strRepaySearch), strId);

                DataTable dtRepay = dalRepay.GetRepayRdList(strSql_Repay);
                if (dtRepay == null)
                {
                    continue;
                }

                decimal dRepayMoney  = 0;
                decimal dUpdateMoney = 0;
                decimal dBorrow      = 0;
                decimal dUnRepay     = 0;
                decimal.TryParse(strBorrow, out dBorrow);
                decimal.TryParse(strUnRepay, out dUnRepay);
                foreach (DataRow item in dtRepay.Rows)
                {
                    decimal dRepayTemp = 0, dChage = 0;
                    string  strRepayId = string.Empty, strOrderType = string.Empty;

                    if (item["ORDERTYPE"] == null || item["REPAYMONEY"] == null || item["CHARGEMONEY"] == null)
                    {
                        continue;
                    }

                    strRepayId   = item["REPAYAPPLYDETAILID"].ToString();
                    strOrderType = item["ORDERTYPE"].ToString();

                    if (strOrderType == "Repay")
                    {
                        decimal.TryParse(item["REPAYMONEY"].ToString(), out dRepayTemp);
                    }
                    else if (strOrderType == "Charge")
                    {
                        decimal.TryParse(item["REPAYMONEY"].ToString(), out dRepayTemp);
                        decimal.TryParse(item["CHARGEMONEY"].ToString(), out dChage);

                        decimal dTemp   = dBorrow - dRepayMoney;
                        bool    bUpdate = false;
                        if (dTemp >= dChage)
                        {
                            if (dRepayTemp < dChage)
                            {
                                dRepayTemp = dChage;
                                bUpdate    = true;
                            }
                        }
                        else
                        {
                            if (dRepayTemp != dTemp)
                            {
                                dRepayTemp = dTemp;
                                bUpdate    = true;
                            }
                        }

                        if (bUpdate)
                        {
                            string strUpdateChage = string.Format(string.Copy(strChageUpdate), dRepayTemp, strRepayId);
                            dalCharge.UpdateBySql(strUpdateChage);
                            Literal5.Text += "已更新的冲借款" + strRepayId + ";";
                        }
                    }
                    dRepayMoney += dRepayTemp;
                }

                if (dRepayMoney == 0)
                {
                    Literal4.Text += "该借款" + strId + "不存在还款;";
                }

                if (dRepayMoney > dBorrow)
                {
                    dRepayMoney    = dBorrow;
                    Literal4.Text += "还款超出借款" + strId + ";";
                }

                dUpdateMoney = dBorrow - dRepayMoney;
                if (dUpdateMoney == dUnRepay)
                {
                    continue;
                }
                string strUpdateBorrow = string.Format(string.Copy(strBorrowUpdate), dUpdateMoney, strId);
                dalBorrow.UpdateBySql(strUpdateBorrow);
                Literal3.Text += "已更新的借款" + strId + ";";
            }
        }