Esempio n. 1
0
        public ActionResult Save(Fin_Convert DataBase)
        {
            var Pwd2 = Common.CryptHelper.DESCrypt.Encrypt(Request["Pwd2"]);

            DataBase.CreateTime = DateTime.Now;
            var r = DB.Fin_Convert.Save(Pwd2, DataBase);

            //if (r.IsSuccess)
            //{
            //    r.ReUrl = ControllerPath + "/Index";
            //}
            return(Json(r));
        }
Esempio n. 2
0
 public ActionResult ToZhuanHuan(decimal Amount, string PayPwd)
 {
     try
     {
         var Pwd2     = Common.CryptHelper.DESCrypt.Encrypt(PayPwd);
         var member   = DB.Member_Info.FindEntity(CurrentUser.MemberId);
         var Poundage = 0;
         var entity   = new Fin_Convert()
         {
             MemberId    = member.MemberId,
             MemberCode  = member.Code,
             NickName    = member.NickName,
             Amount      = Amount,
             ConvertType = "奖金转余额",
             CreateTime  = DateTime.Now
         };
         DB.Fin_Convert.Save(Pwd2, entity);
         return(Success("操作成功"));
     }
     catch (Exception ex)
     {
         return(Error(ex));
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 保存(添加与更新)
        /// </summary>
        /// <param name="Pwd2">支付密码</param>
        /// <param name="entity">当前实体对象</param>
        /// <returns></returns>
        public bool Save(string Pwd2, Fin_Convert entity)
        {
            JsonHelp json = new JsonHelp()
            {
                Status = "n", Msg = "保存失败"
            };

            Xml_Site config = DB.XmlConfig.XmlSite;

            #region 检查支付密码是否正确,转换金额是否超限,

            using (var tran = DB.Fin_Convert.BeginTransaction)
            {
                try
                {
                    var model = DB.Member_Info.FindEntity(entity.MemberId);
                    if (model != null && model.Pwd2 == Pwd2)
                    {
                    }
                    else
                    {
                        throw new Exception("支付密码错误");
                    }
                    if (entity.Amount <= 0)
                    {
                        throw new Exception("转换金额要大于0");
                    }

                    if (entity.ConvertType == "奖金转余额")
                    {
                        if (entity.Amount > model.Coins)
                        {
                            throw new Exception("奖金额度不足!");
                        }
                    }


                    if (entity.ConvertId == 0)
                    {
                        if (Insert(entity))
                        {  //流水账单
                            Fin_LiuShui _liushui = new Fin_LiuShui();
                            //更新会员表的收益,电子币
                            if (entity.ConvertType == "奖金转余额")
                            {
                                model.Coins      -= entity.Amount;
                                model.Commission += entity.Amount;
                                DB.Fin_LiuShui.AddLS(model.MemberId, -entity.Amount.Value, "奖金转余额", "奖金");
                                DB.Fin_LiuShui.AddLS(model.MemberId, entity.Amount.Value, "奖金转余额");
                            }


                            DB.Member_Info.Update(model);
                            json.Status = "y";
                            json.Msg    = "操作成功";
                            //添加操作日志
                            DB.SysLogs.setMemberLog(Enums.EventType.Add, string.Format("货币转换,操作人:[{0}],金额:[{1}],操作成功", entity.NickName, entity.Amount));
                        }
                    }
                    tran.Complete();
                    return(true);
                }
                catch (Exception ex)
                {
                    DB.Rollback();
                    throw ex;
                }
            }


            #endregion
        }