//审核通过
        protected void btn_pass_Click(object sender, EventArgs e)
        {
            int id = payback.Id;

            if (new PayBackApplyDAO().agreePayBack(id))
            {
                //跟新用户的债务表
                UserDebt userdebt = new UserDebt();
                userdebt        = new UserDebtDAO().getUserDebt(payback.User_name);
                userdebt.Amount = userdebt.Amount - payback.Amount;
                new UserDebtDAO().updateUserDebt(userdebt);

                //向用户债务交易记录表中添加交易记录
                UserDebtTrans userdebttrans = new UserDebtTrans();
                userdebttrans.Amount         = -payback.Amount;
                userdebttrans.Operation_time = DateTime.Now;
                userdebttrans.Operation      = "还款";
                userdebttrans.Note           = payback.Note;
                userdebttrans.User_name      = payback.User_name;

                new UserDebtTransDAO().addUserDebtTrans(userdebttrans);

                alert("通过申请!!");
            }
            else
            {
                alert("系统繁忙,请稍后再提交!!");
            }
        }
Example #2
0
        //用户还款的具体实现
        protected void btn_user_repay_right_Click(object sender, EventArgs e)
        {
            string account   = user_account.Text;
            string money_str = Request.Form["repay_money"];
            string note      = Request.Form["note_repay"];
            string path      = uplaod_image.FileName;


            if (path == "")
            {
                alert("请选择图片");
            }
            else
            {
                //首先判断该用户是否欠
                UserDebt user_debt = new UserDebtDAO().getUserDebt(account);

                if (user_debt != null)
                {
                    if (user_debt.Amount >= Convert.ToSingle(money_str))
                    {
                        //申请返款
                        PayBackApply payback = new PayBackApply();
                        payback.User_name      = account;
                        payback.Amount         = Convert.ToSingle(money_str);
                        payback.Operation      = "申请还款";
                        payback.Staff_apply    = Session["staff"].ToString();
                        payback.Note           = note;
                        payback.Operation_time = DateTime.Now;
                        payback.Is_aggree      = 0;

                        payback.Image = saveUploadFile(account);

                        if (new PayBackApplyDAO().addPayBackApply(payback))
                        {
                            //还款成功
                            // 记录交易信息
                            alert("申请成功!!");
                        }
                        else
                        {
                            alert("申请失败!!");
                        }
                    }
                    else
                    {
                        alert("用户欠款金额为:" + user_debt.Amount + " ;还款金额为:" + money_str + ",无法进行还款申请!!");
                    }
                }
                else
                {
                    alert("该用户不欠款,请确认用户信息!!");
                }
            }
        }
        //用户还款的具体实现
        protected void btn_user_repay_right_Click(object sender, EventArgs e)
        {
            string account   = user_account.Text;
            string money_str = Request.Form["repay_money"];
            string note      = Request.Form["note_repay"];

            //首先判断该用户是否欠
            UserDebt user_debt = new UserDebtDAO().getUserDebt(account);

            if (user_debt != null)
            {
                if (user_debt.Amount >= Convert.ToSingle(money_str))
                {
                    // 跟新用户的 欠款表
                    UserDebt userdebt = new UserDebt();
                    userdebt.Amount    = -Convert.ToSingle(money_str);
                    userdebt.User_name = account;
                    if (new UserDebtDAO().updateUserDebt(userdebt))
                    {
                        //还款成功
                        // 记录交易信息
                        UserDebtTrans userdebttrans = new UserDebtTrans();
                        userdebttrans.Operation      = "还款";
                        userdebttrans.Operation_time = DateTime.Now;
                        userdebttrans.User_name      = account;
                        userdebttrans.Amount         = -Convert.ToSingle(money_str);
                        userdebttrans.Note           = note;
                        new UserDebtTransDAO().addUserDebtTrans(userdebttrans);

                        alert("还款成功!!");
                    }
                    else
                    {
                        alert("还款失败!!");
                    }
                }
                else
                {
                    alert("用户欠款金额为:" + user_debt.Amount + " ;还款金额为:" + money_str + ",无法进行还款!!");
                }
            }
            else
            {
                alert("该用户不欠款,请确认用户信息!!");
            }
        }