示例#1
0
        /// <summary>
        /// 骑士提现申请单确认打款
        /// danny-20150513
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool ClienterWithdrawPayOk(ClienterWithdrawLog model)
        {
            string sql = string.Format(@" 
UPDATE ClienterWithdrawForm
 SET    [Status] = @Status,
		Payer=@Operator,
		PayTime=getdate()
OUTPUT
  Inserted.Id,
  Inserted.[Status],
  @Remark,
  @Operator,
  getdate()
INTO ClienterWithdrawLog
  ([WithwardId],
  [Status],
  [Remark],
  [Operator],
  [OperatTime])
 WHERE  Id = @Id");

            IDbParameters parm = DbHelper.CreateDbParameters();

            parm.AddWithValue("@Status", model.Status);
            parm.AddWithValue("@Operator", model.Operator);
            parm.AddWithValue("@Remark", model.Remark);
            parm.AddWithValue("@Id", model.WithwardId);
            return(DbHelper.ExecuteNonQuery(SuperMan_Write, sql, parm) > 0);
        }
        /// <summary>
        /// 骑士批量审核通过(只审核待审核状态的数据)
        /// </summary>
        /// <UpdateBy>zhaohailong</UpdateBy>
        /// <UpdateTime>20150625</UpdateTime>
        /// <param name="withwardIds"></param>
        /// <returns></returns>
        public JsonResult BatchWithdrawAuditOk(string withwardIds)
        {
            bool   hasError   = false;
            bool   hasSuccess = false;
            string totalMsg   = "审核成功";

            if (!string.IsNullOrEmpty(withwardIds))
            {
                string[] ids = withwardIds.Split('#');

                Dictionary <string, string> errorResult = new Dictionary <string, string>();
                foreach (string item in ids)
                {
                    string[] realids             = item.Split(',');
                    var      businessWithdrawLog = new ClienterWithdrawLog()
                    {
                        Operator   = UserContext.Current.Name,
                        Remark     = "商户提款申请单审核通过",
                        Status     = ClienterWithdrawFormStatus.Allow.GetHashCode(),
                        WithwardId = Convert.ToInt64(realids[0])
                    };
                    try
                    {
                        bool reg = iClienterFinanceProvider.ClienterWithdrawAudit(businessWithdrawLog);
                        if (reg == false)
                        {
                            hasError = true;
                            errorResult.Add(realids[1], "");
                        }
                        else
                        {
                            hasSuccess = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        hasError = true;
                        errorResult.Add(realids[1], ex.Message);
                    }
                }
                if (hasError)
                {
                    totalMsg = "";
                    string[] error = errorResult.Where(p => p.Value == "").Select(p => p.Key).ToArray();
                    if (error != null && error.Length > 0)
                    {
                        totalMsg = "以下单号审核失败,请重试!\n" + string.Join("\n", error);
                    }


                    string excepptionMsg = errorResult.Where(p => p.Value != "").Select(p => p.Value).FirstOrDefault();
                    if (!string.IsNullOrEmpty(excepptionMsg))
                    {
                        string[] exceptionIDs = errorResult.Where(p => p.Value != "").Select(p => p.Key).ToArray();
                        totalMsg += string.Format("\n以下单号审核失败:{0}!\n{1}\n", excepptionMsg, string.Join("\n", exceptionIDs));
                    }
                }
            }
            return(Json(new ResultModel(hasSuccess, totalMsg), JsonRequestBehavior.DenyGet));
        }
        /// <summary>
        /// 审核骑士提现申请单
        /// danny-20150513
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool ClienterWithdrawAudit(ClienterWithdrawLog model)
        {
            bool isClienterIDValid = _clienterDao.IsBussinessOrClienterValidByID(1, model.WithwardId);

            if (isClienterIDValid)
            {
                return(clienterFinanceDao.ClienterWithdrawAudit(model));
            }
            throw new Exception("提款单对应的骑士已经被取消资格,请联系客服");
        }
        public JsonResult WithdrawPayOk(string withwardId)
        {
            var clienterWithdrawLog = new ClienterWithdrawLog()
            {
                Operator   = UserContext.Current.Name,
                Remark     = "骑士提款申请单确认打款",
                Status     = ClienterWithdrawFormStatus.Success.GetHashCode(),
                WithwardId = Convert.ToInt64(withwardId)
            };
            var reg = iClienterFinanceProvider.ClienterWithdrawPayOk(clienterWithdrawLog);

            return(Json(new ResultModel(reg, reg ? "确认打款成功!" : "确认打款失败!"), JsonRequestBehavior.DenyGet));
        }
        /// <summary>
        /// 增加一条记录
        /// </summary>
        /// <param name="clienterWithdrawLog">参数实体</param>
        /// <returns></returns>
        public long Insert(ClienterWithdrawLog clienterWithdrawLog)
        {
            const string  insertSql    = @"
insert into ClienterWithdrawLog(WithwardId,Status,Remark,Operator)
values(@WithwardId,@Status,@Remark,@Operator)
select @@IDENTITY";
            IDbParameters dbParameters = DbHelper.CreateDbParameters();

            dbParameters.AddWithValue("WithwardId", clienterWithdrawLog.WithwardId); //提现单ID
            dbParameters.AddWithValue("Status", clienterWithdrawLog.Status);         //操作后状态
            dbParameters.AddWithValue("Remark", clienterWithdrawLog.Remark);         //备注
            dbParameters.AddWithValue("Operator", clienterWithdrawLog.Operator);     //操作人
            object result = DbHelper.ExecuteScalar(SuperMan_Write, insertSql, dbParameters);

            return(ParseHelper.ToLong(result));
        }
        /// <summary>
        /// 根据ID获取对象
        /// </summary>
        public ClienterWithdrawLog GetById(long id)
        {
            ClienterWithdrawLog model        = new ClienterWithdrawLog();
            const string        querysql     = @"
select  Id,WithwardId,Status,Remark,Operator,OperatTime
from  ClienterWithdrawLog (nolock)
where  Id=@Id ";
            IDbParameters       dbParameters = DbHelper.CreateDbParameters();

            dbParameters.AddWithValue("Id", id);

            DataTable dt = DataTableHelper.GetTable(DbHelper.ExecuteDataset(SuperMan_Read, querysql, dbParameters));

            if (DataTableHelper.CheckDt(dt))
            {
                model = DataTableHelper.ConvertDataTableList <ClienterWithdrawLog>(dt)[0];
            }
            return(model);
        }
        public JsonResult WithdrawAuditOk(string withwardId, string withwardNo)
        {
            var clienterWithdrawLog = new ClienterWithdrawLog()
            {
                Operator   = UserContext.Current.Name,
                Remark     = "骑士提款申请单审核通过",
                Status     = ClienterWithdrawFormStatus.Allow.GetHashCode(),
                WithwardId = Convert.ToInt64(withwardId)
            };

            try
            {
                var reg = iClienterFinanceProvider.ClienterWithdrawAudit(clienterWithdrawLog);
                return(Json(new ResultModel(true, reg ? "审核通过!" : "以下单号审核失败,请重试!\n" + withwardNo), JsonRequestBehavior.DenyGet));
            }
            catch (Exception ex)
            {
                return(Json(new ResultModel(false, "以下单号审核失败:" + ex.Message + "!\n" + withwardNo), JsonRequestBehavior.DenyGet));
            }
        }
        /// <summary>
        /// 骑士提现申请单确认打款
        /// danny-20150513
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool ClienterWithdrawPayOk(ClienterWithdrawLog model)
        {
            bool reg = false;

            using (IUnitOfWork tran = EdsUtilOfWorkFactory.GetUnitOfWorkOfEDS())
            {
                if (clienterFinanceDao.ClienterWithdrawPayOk(model))
                {
                    if (clienterFinanceDao.ModifyClienterBalanceRecordStatus(model.WithwardId.ToString()))
                    {
                        if (clienterFinanceDao.ModifyClienterTotalAmount(model.WithwardId.ToString()))
                        {
                            reg = true;
                            tran.Complete();
                        }
                    }
                }
            }
            return(reg);
        }
示例#9
0
 /// <summary>
 /// 修改一条记录
 ///<param name="clienterWithdrawLog">要修改的对象</param>
 /// </summary>
 public void Modify(ClienterWithdrawLog clienterWithdrawLog)
 {
     _clienterWithdrawLogDao.Update(clienterWithdrawLog);
 }
示例#10
0
 /// <summary>
 /// 新增一条记录
 ///<param name="clienterWithdrawLog">要新增的对象</param>
 /// </summary>
 public long Create(ClienterWithdrawLog clienterWithdrawLog)
 {
     return(_clienterWithdrawLogDao.Insert(clienterWithdrawLog));
 }
 /// <summary>
 /// 更新一条记录
 /// </summary>
 /// <param name="clienterWithdrawLog">参数实体</param>
 public void Update(ClienterWithdrawLog clienterWithdrawLog)
 {
 }