Exemple #1
0
        /// <summary>
        /// 充值提交
        /// </summary>
        /// <param name="amount"></param>
        /// <returns></returns>
        public JsonResult ChargeSubmit(decimal amount)
        {
            Finance_Wallet Fwinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(base.CurrentUser.Id, base.CurrentUser.UserType, int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString()));

            if (Fwinfo != null)
            {
            }
            ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
            long             orderid = _orderBO.GenerateOrderNumber();
            Finance_Recharge frinfo  = new Finance_Recharge();

            frinfo.Recharge_Number    = orderid;
            frinfo.Recharge_UserId    = base.CurrentUser.Id;
            frinfo.Recharge_UserType  = base.CurrentUser.UserType;
            frinfo.Recharge_Time      = DateTime.Now;
            frinfo.Recharge_Address   = ChemCloud.Core.Common.GetIpAddress();
            frinfo.Recharge_Money     = amount;
            frinfo.Recharge_MoneyLeft = Fwinfo.Wallet_UserLeftMoney;
            frinfo.Recharge_MoneyType = int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString());
            frinfo.Recharge_Type      = 0;
            frinfo.Recharge_Status    = 1;
            if (ServiceHelper.Create <IFinance_RechargeService>().AddFinance_Recharge(frinfo))
            {
                return(Json(frinfo.Recharge_Number));
            }
            else
            {
                return(Json(""));
            }
        }
        public bool UpdateFinance_Recharge(Finance_Recharge finfo)
        {
            if (finfo == null)
            {
                return(false);
            }
            Finance_Recharge fw = context.Finance_Recharge.FirstOrDefault((Finance_Recharge m) => m.Id == finfo.Id);

            if (fw == null)
            {
                return(false);
            }
            int i = 0;

            fw.Recharge_Number    = finfo.Recharge_Number;
            fw.Recharge_UserId    = finfo.Recharge_UserId;
            fw.Recharge_UserType  = finfo.Recharge_UserType;
            fw.Recharge_Time      = finfo.Recharge_Time;
            fw.Recharge_Address   = finfo.Recharge_Address;
            fw.Recharge_Money     = finfo.Recharge_Money;
            fw.Recharge_MoneyLeft = finfo.Recharge_MoneyLeft;
            fw.Recharge_MoneyType = finfo.Recharge_MoneyType;
            fw.Recharge_Type      = finfo.Recharge_Type;
            fw.Recharge_Status    = finfo.Recharge_Status;
            i = context.SaveChanges();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public Finance_Recharge GetFinance_RechargeInfo(long uid, int usertype, int cointype)
        {
            Finance_Recharge finfo = new Finance_Recharge();

            finfo = (
                from p in context.Finance_Recharge
                where p.Recharge_UserId.Equals(uid) && p.Recharge_UserType.Equals(usertype) && p.Recharge_MoneyType.Equals(cointype)
                select p).FirstOrDefault();
            return(finfo);
        }
        public Finance_Recharge GetFinance_RechargeInfo(long rechargeId)
        {
            Finance_Recharge finfo = new Finance_Recharge();

            finfo = (
                from p in context.Finance_Recharge
                where p.Recharge_Number.Equals(rechargeId)
                select p).FirstOrDefault();
            return(finfo);
        }
        public bool AddFinance_Recharge(Finance_Recharge finfo)
        {
            int i = 0;

            if (finfo == null || finfo.Id != 0)
            {
                return(false);
            }
            context.Finance_Recharge.Add(finfo);
            i = context.SaveChanges();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }