예제 #1
0
        public string GetUserTranstionEntry(string usEntry)
        {
            UserBalanceModel ubm  = new UserBalanceModel();
            UserBalanceBL    ubbl = new UserBalanceBL();

            var IsExists = "";

            if (ModelState.IsValid)
            {
                if (IsExists.Equals(null))
                {
                    ModelState.AddModelError("UserName", "Already exists");
                    // return View(Object);
                }
            }
            if (Session["UserInfo"] == null)
            {
                return("false");
            }

            string userInfo = Session["UserInfo"] as string;
            string UserID   = userInfo.Split('_')[0];

            string[] USEntry = usEntry.Split('/');
            ubm.PayDate        = USEntry[0].ToString();
            ubm.UserID         = USEntry[1].ToString();
            ubm.TransitionType = USEntry[2].ToString();
            ubm.Amount         = USEntry[3].ToString();
            ubm.OperatorMode   = UserID;
            return(ubbl.GetUserTranstionEntry(ubm));
        }
예제 #2
0
        public string GetUserTranstionEntry(UserBalanceModel UBModel)
        {
            BaseDL   BDL = new BaseDL();
            Function FUN = new Function();

            SqlParameter[] prms = new SqlParameter[5];
            DateTime       dt   = DateTime.ParseExact(UBModel.PayDate.Replace("-", "/"), "dd/MM/yyyy", CultureInfo.GetCultureInfo("en-us"));

            prms[0] = new SqlParameter("@PayDate", SqlDbType.Date)
            {
                Value = dt
            };
            prms[1] = new SqlParameter("@UserID", SqlDbType.VarChar)
            {
                Value = string.IsNullOrWhiteSpace(UBModel.UserID) ? (object)DBNull.Value : UBModel.UserID
            };
            prms[2] = new SqlParameter("@TransitionType", SqlDbType.TinyInt)
            {
                Value = string.IsNullOrWhiteSpace(UBModel.TransitionType) ? (object)DBNull.Value : UBModel.TransitionType
            };
            prms[3] = new SqlParameter("@Amount", SqlDbType.Int)
            {
                Value = string.IsNullOrWhiteSpace(UBModel.Amount) ? (object)DBNull.Value : UBModel.Amount
            };
            prms[4] = new SqlParameter("@OperatorMode", SqlDbType.VarChar)
            {
                Value = string.IsNullOrWhiteSpace(UBModel.OperatorMode) ? (object)DBNull.Value : UBModel.OperatorMode
            };

            if (BDL.InsertUpdateDeleteData("User_Transition_Insert", prms))
            {
                return("true");
            }
            return("false");
        }
예제 #3
0
        public string DataIsExists(UserBalanceModel UBModel)
        {
            BaseDL   BDL = new BaseDL();
            Function FUN = new Function();

            SqlParameter[] prms = new SqlParameter[2];

            DateTime dt = DateTime.ParseExact(UBModel.PayDate.Replace("-", "/"), "dd/MM/yyyy", CultureInfo.GetCultureInfo("en-us"));

            prms[0] = new SqlParameter("@PayDate", SqlDbType.Date)
            {
                Value = dt
            };
            prms[1] = new SqlParameter("@UserID", SqlDbType.VarChar)
            {
                Value = string.IsNullOrWhiteSpace(UBModel.UserID) ? (object)DBNull.Value : UBModel.UserID
            };
            DataTable DtResult = BDL.SelectData("User_Transition_DataExists", prms);

            if (DtResult.Rows.Count > 0)
            {
                return("true");
            }
            return("false");
        }
        public UserBalanceModel GetBalance()
        {
            long             userid = long.Parse(Session["userid"].ToString());
            var              data   = _db.userBalanceModels.Where(u => u.user_id == userid).ToList();
            UserBalanceModel res    = data.FirstOrDefault();

            return(res);
        }
예제 #5
0
        public string GetUserBalanceByDetailDate(string id)
        {
            UserBalanceBL    ubbl = new UserBalanceBL();
            UserBalanceModel UBM  = new UserBalanceModel();

            UBM.UserID = id.Split('_')[0];
            return(ubbl.GetUserBalanceByDetailDate(UBM));
        }
예제 #6
0
        public string GetDailyUserBalance_List(string UserID)
        {
            UserBalanceModel ubm = new UserBalanceModel();

            ubm.UserID = UserID.ToString();
            UserBalanceBL ubbl = new UserBalanceBL();

            return(ubbl.GetDailyUserBalance_List(ubm));
        }
예제 #7
0
        public async Task <UserBalanceModel> GetBalances(string userId, bool calculateEstimate)
        {
            try
            {
                var model       = new UserBalanceModel();
                var currentUser = new Guid(userId);
                using (var context = ExchangeDataContextFactory.CreateReadOnlyContext())
                {
                    var query = from currency in context.Currency
                                from balance in context.Balance.Where(b => b.UserId == currentUser && b.CurrencyId == currency.Id).DefaultIfEmpty()
                                //	from address in context.Address.Where(a => a.UserId == currentUser && a.CurrencyId == currency.Id).DefaultIfEmpty()
                                where currency.IsEnabled
                                orderby currency.Name
                                select new UserBalanceItemModel
                    {
                        //Address = address.AddressHash,
                        CurrencyId      = currency.Id,
                        HeldForTrades   = (decimal?)balance.HeldForTrades ?? 0,
                        PendingWithdraw = (decimal?)balance.PendingWithdraw ?? 0,
                        Name            = currency.Name,
                        Symbol          = currency.Symbol,
                        Status          = currency.Status,
                        ListingStatus   = currency.ListingStatus,
                        StatusMessage   = currency.StatusMessage,
                        Total           = (decimal?)balance.Total ?? 0,
                        Unconfirmed     = (decimal?)balance.Unconfirmed ?? 0,
                        IsFavorite      = (bool?)balance.IsFavorite ?? false,
                        CurrencyType    = currency.Type,
                        BaseAddress     = currency.BaseAddress
                    };

                    var balances = await query.ToListNoLockAsync().ConfigureAwait(false);

                    model.Balances = balances.DistinctBy(x => x.CurrencyId).ToList();
                }

                if (calculateEstimate)
                {
                    await model.Balances.ForEachAsync(async b => b.EstimatedBTC = await BalanceEstimationService.GetEstimatedBTC(b.Total, b.CurrencyId));

                    model.BTCEstimate    = model.Balances.Sum(x => x.EstimatedBTC);
                    model.BTCEstimateAlt = model.Balances.Where(x => x.CurrencyId != Constant.BITCOIN_ID).Sum(x => x.EstimatedBTC);

                    var verificationData = await UserVerificationReader.GetVerificationStatus(userId).ConfigureAwait(false);

                    model.HasWithdrawLimit = verificationData.Limit > 0;
                    model.WithdrawLimit    = verificationData.Limit;
                    model.WithdrawTotal    = verificationData.Current;
                }
                return(model);
            }
            catch (Exception)
            {
                return(new UserBalanceModel());
            }
        }
예제 #8
0
        public string GetDailyUserBalance_List(UserBalanceModel UBModel)
        {
            BaseDL   BDL = new BaseDL();
            Function FUN = new Function();

            SqlParameter[] prms = new SqlParameter[1];
            prms[0] = new SqlParameter("@UserID", SqlDbType.VarChar)
            {
                Value = string.IsNullOrWhiteSpace(UBModel.UserID) ? (object)DBNull.Value : UBModel.UserID
            };
            DataTable DtBLList = BDL.SelectData("M_UserBalance_BalanceSelect", prms);

            return(FUN.DataTableToJSONWithJSONNet(DtBLList));
        }
예제 #9
0
        public string GetUserBalanceByDetailDate(UserBalanceModel UBModel)
        {
            BaseDL   bdl = new BaseDL();
            Function fun = new Function();

            SqlParameter[] prms = new SqlParameter[1];
            prms[0] = new SqlParameter("@UserID", SqlDbType.VarChar)
            {
                Value = string.IsNullOrWhiteSpace(UBModel.UserID) ? (object)DBNull.Value : UBModel.UserID
            };
            DataTable DtCinemaIncome = bdl.SelectData("M_UserBalance_DetailSelect", prms);

            return(fun.DataTableToJSONWithJSONNet(DtCinemaIncome));
        }
예제 #10
0
        public string DataIsExists(string data)
        {
            UserBalanceModel ubm  = new UserBalanceModel();
            UserBalanceBL    ubbl = new UserBalanceBL();

            if (Session["UserInfo"] == null)
            {
                return("false");
            }


            string[] USEntry = data.Split('/');

            ubm.PayDate = USEntry[0].ToString();

            ubm.UserID = USEntry[1].ToString();
            return(ubbl.DataIsExists(ubm));
        }