Example #1
0
        /// <summary>
        /// 插入互转纪录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool InsertCrossRotationLog(CrossRotation model)
        {
            bool result = false;

            try
            {
                using (var db = WriteSanNongDunDbBase())
                {
                    result = db.Insert <CrossRotation>(model);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(LogDal), "InsertCrossRotationLog", Engineer.ggg, model, ex);
            }
            return(result);
        }
Example #2
0
 /// <summary>
 /// 插入互转纪录
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool InsertCrossRotationLog(CrossRotation model)
 {
     return(_logDal.InsertCrossRotationLog(model));
 }
Example #3
0
        /// <summary>
        /// ZFC转账
        /// </summary>
        /// <param name="mobileNumber"></param>
        /// <param name="zfc"></param>
        /// <returns></returns>
        public JsonResult ZFCSend(string mobileNumber, string ZFC)
        {
            bool    result = false;
            decimal zfc    = 0;
            //验证数据
            var userInfo = _userBll.GetUserInfoByUserName(mobileNumber);//接受人的信息

            if (userInfo == null)
            {
                return(Json(new { result = false, msg = "输入的用户不存在!" }));
            }
            if (userInfo.UserId == _ServiceContext.SND_CurrentUser.UserId)
            {
                return(Json(new { result = false, msg = "不能送zfc给自己!" }));
            }
            result = decimal.TryParse(ZFC, out zfc);

            if (!result)
            {
                return(Json(new { result = false, msg = "请输入正确的数量!" }));
            }
            if (zfc < 1)
            {
                return(Json(new { result = false, msg = "数量不能少于1!" }));
            }
            AccountInfo sendAccount = new AccountInfo();
            AccountInfo reAccount   = new AccountInfo();

            sendAccount = _accountBll.GetAccByUserId(_ServiceContext.SND_CurrentUser.UserId);
            reAccount   = _accountBll.GetAccByUserId(userInfo.UserId);

            if (sendAccount.Zfc < zfc)
            {
                return(Json(new { result = false, msg = "账户zfc不足!" }));
            }

            //进行转账
            sendAccount.Zfc -= zfc;
            reAccount.Zfc   += zfc;

            result = _accountBll.UpdateAccInfo(sendAccount);
            if (result)
            {
                result = _accountBll.UpdateAccInfo(reAccount);
            }
            else
            {
                return(Json(new { result = false, msg = "赠送失败,请稍后再试!" }));
            }

            //添加zfc转账记录

            CrossRotation model = new CrossRotation();

            model.CRAccountName = sendAccount.AccountName;
            model.CreateTime    = DateTime.Now;
            model.CRType        = 2;
            model.CRUserId      = _ServiceContext.SND_CurrentUser.UserId;
            model.Qty           = zfc;
            model.REAccountName = reAccount.AccountName;
            model.Remark        = "";
            model.REUserId      = userInfo.UserId;

            result = _logBll.InsertCrossRotationLog(model);



            return(Json(new { result = true, msg = "赠送成功!" }));
        }