示例#1
0
 public ActionResult Login(UserRole model, double utcTime = 0)
 {
     try
     {
         var ac = _uow.Accounts.Login(model.Username, model.Password);
         if (ac.AccountEnabled == false)
         {
             ViewBag.error = "Your account is disabled, please contact support for further assistance";
             return(View());
         }
         if (ac.AccountType_Id == (int)AccountTypes.ADMIN)
         {
             ViewBag.error = "Invalid Login";
             return(View());
         }
         SessionItems.Add(SessionKey.ACCOUNT, ac);
         _uow.Accounts.SaveUserActivity(Request.UserAgent, Request.UserHostAddress, ac.Email, "Login");
         return(RedirectToAction("Index", "Dashboard", new { utcTime }));
     }
     catch (ExchangeException ex)
     {
         ViewBag.error = ex.ErrorMessage;
     }
     return(View());
 }
示例#2
0
        public ActionResult KYC(KYC model)
        {
            try
            {
                var _ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;
                var ac  = _uow.Accounts.GetAccount(_ac.AccountId);
                if (Request.Files.Count > 0)
                {
                    var file = Request.Files[0];
                    model.FirstDocument = "/Assets/Proof/" + DateTime.Now.Ticks.ToString() + file.FileName;
                    file.SaveAs(Server.MapPath(model.FirstDocument));
                    var file2 = Request.Files[1];
                    model.SecondDocument = "/Assets/Proof/" + DateTime.Now.Ticks.ToString() + file2.FileName;
                    file2.SaveAs(Server.MapPath(model.SecondDocument));
                }
                var detail = _uow.Accounts.kyc(model, ac.AccountId, Server.MapPath(model.FirstDocument), Server.MapPath(model.SecondDocument));
                _uow.Accounts.UpdateAccount(ac.AccountId);
                TempData["msg"] = "Your profile and documents has been uploaded successfully. We are reviewing your documents and get back to you shortly.";

                return(RedirectToAction("Index", "Dashboard"));
            }
            catch (ExchangeException ex)
            {
                ViewBag.msg = ex.ErrorMessage;
                return(RedirectToAction("Index", "Dashboard"));
            }
        }
示例#3
0
        public ActionResult UpdateBalance()
        {
            try
            {
                var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;
                if (ac == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }
                else
                {
                    var res = _uow.Payment.GetWallets(ac.AccountId, "USD");

                    var balance = new
                    {
                        bal = res.FirstOrDefault().Balance
                    };

                    return(Json(new { balance }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception)
            {
                var balance = new
                {
                    bal = 0
                };

                return(Json(new { balance }, JsonRequestBehavior.AllowGet));
            }
        }
示例#4
0
        public ActionResult CryptoWithDrawl(string address, string symbol, double amount)
        {
            var _ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;
            var ac  = _uow.Accounts.GetAccount(_ac.AccountId);

            try
            {
                var a = _uow.Payment.WithDrawlReqAdmin(
                    new Payment()
                {
                    Account_Id = ac.AccountId, Amount = (decimal)amount, Currency = symbol, ToWalletAddress = address
                });
                SessionItems.Add(SessionKey.ACCOUNT, a);
                TempData["msg"] = "Withdraw request has been successfully sent to admin. Wait for the approval.";
                var obj = new
                {
                    status  = true,
                    message = TempData["msg"]
                };
                return(Json(obj, JsonRequestBehavior.AllowGet));
            }
            catch (ExchangeException ex)
            {
                var obj = new
                {
                    status  = false,
                    message = ex.ErrorMessage.ToString()
                };
                return(Json(obj, JsonRequestBehavior.AllowGet));
            }
        }
示例#5
0
        public ActionResult _header()
        {
            var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;

            ViewBag.email = ac.Email;
            return(View());
        }
示例#6
0
        public ActionResult AddressAuthorize(string cur)
        {
            var acc  = SessionItems.Get(SessionKey.ACCOUNT) as Account;
            var stat = _uow.Payment.AddressAuthorize(cur, acc.AccountId, acc.Email);

            return(Json(new { status = stat }, JsonRequestBehavior.AllowGet));
        }
示例#7
0
        public ActionResult DeleteAddress(string cur, string address, long addressid)
        {
            var acc  = SessionItems.Get(SessionKey.ACCOUNT) as Account;
            var stat = _uow.Payment.DeleteWhitListAddress(cur, acc.AccountId, addressid, address);

            return(Json(new { status = stat }, JsonRequestBehavior.AllowGet));
        }
示例#8
0
        public ActionResult Referral()
        {
            var          acc  = SessionItems.Get(SessionKey.ACCOUNT) as Account;
            RefferalData data = _uow.Accounts.GetRefferalData(acc.AccountId);

            return(View(data));
        }
示例#9
0
        public ActionResult GetPendingOrders()
        {
            var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;

            if (ac == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                var res = _uow.Accounts.GetPendingTrades(ac.AccountId);
                List <PendingOrderForView> list = new List <PendingOrderForView>();
                for (var t = 0; t < res.Count; t++)
                {
                    long rTime = 0;
                    if (res[t].expiryTime == -1)
                    {
                        rTime = -1;
                    }
                    else
                    {
                        DateTime current   = DateTime.UtcNow;
                        DateTime addedTime = res[t].TradeDate.AddMinutes((double)res[t].expiryTime / 60);
                        long     remaining = (long)(addedTime - current).TotalSeconds;
                        rTime = (remaining >= 0) ? remaining : 0;
                    }

                    list.Add(new PendingOrderForView()
                    {
                        TradeId        = res[t].TradeId,
                        TradeDate      = res[t].TradeDate.ToString(),
                        TradeType      = res[t].TradeType,
                        TradeTypeValue = res[t].TradeTypeValue,
                        Currency       = res[t].Currency,
                        Symbol         = res[t].Symbol,
                        Amount         = (decimal)res[t].Amount,
                        Rate           = (decimal)res[t].Rate,
                        Status         = res[t].Status,
                        Account_Id     = (long)res[t].Account_Id,
                        Value          = (decimal)res[t].Value,
                        Direction      = res[t].Direction,
                        expiryTime     = rTime,
                        ExitPrice      = res[t].ExitPrice,
                        PnL            = res[t].PnL,
                        UpPrice        = res[t].UpLimitValue,
                        DownPrice      = res[t].DownLimitValue,
                        ST_Enable      = res[t].StopLoss_TakeProfitEn,
                    });
                }

                var pendingOrders = new
                {
                    orders = list
                };

                return(Json(new { pendingOrders }, JsonRequestBehavior.AllowGet));
            }
        }
示例#10
0
        public ActionResult GetOrderBook(string pair)
        {
            var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;
            GetOrderBookBinance res = _uow.MarketRates.GetOrderBookBinance(UtilityMethods.convertSymbol(pair));
            var orderBook           = new
            {
                book = res
            };

            return(Json(new { orderBook }, JsonRequestBehavior.AllowGet));
        }
示例#11
0
        public ActionResult AddAddress(string cur, string address, long addressid)
        {
            var acc = SessionItems.Get(SessionKey.ACCOUNT) as Account;
            List <AddressBook> addressList = _uow.Payment.AddWhitListAddress(cur, acc.AccountId, addressid, address);

            if (addressList.Count == 0)
            {
                return(Json(new { status = false }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { status = true }, JsonRequestBehavior.AllowGet));
            }
        }
示例#12
0
        public ActionResult GetAddressList(string cur)
        {
            var acc = SessionItems.Get(SessionKey.ACCOUNT) as Account;
            List <AddressBook> addressList = _uow.Payment.GetCurrencyAddressBook(cur, acc.AccountId);
            var        addresses           = addressList.Select(x => x.Address).ToList();
            List <int> addressId           = new List <int>()
            {
                0, 0, 0, 0, 0
            };
            var temp = addressList.Select(x => x.AdressId).ToList();

            for (var i = 0; i < temp.Count; i++)
            {
                addressId[i] = temp[i];
            }
            return(Json(new { addresses, addressId, currency = cur, accountId = acc.AccountId }, JsonRequestBehavior.AllowGet));
        }
示例#13
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (SessionItems.Get(SessionKey.ACCOUNT) == null && SessionItems.Get(SessionKey.ADMIN) == null)
            {
                ViewResult view = new ViewResult();
                view.ViewName        = "~/Views/Account/Login.cshtml";
                view.ViewBag.error   = "Please login to continue";
                filterContext.Result = view;
            }
            else
            {
                string controller = filterContext.Controller.GetType().Name.Replace("Controller", "");
                // actionContext.ControllerContext.Controller.GetType().Name.Replace("Controller", "");
                string function = filterContext.ActionDescriptor.ActionName;

                var  rights       = db.FunctionAccesses;
                var  ac           = SessionItems.Get(SessionKey.ACCOUNT) as Account;
                byte?userType     = ac.UserRoles.FirstOrDefault().UserRoleTypeId;
                bool isAccessible = false;

                foreach (var item in rights)
                {
                    if (item.FunctionRequest.ControllerName == controller && item.FunctionRequest.FunctionName == function && item.UserRoleTypeId == userType && item.IsAccessible == true)
                    {
                        isAccessible = true;
                    }
                }

                if (function.StartsWith("_"))
                {
                    isAccessible = true;
                }


                if (isAccessible == false)
                {
                    ViewResult view = new ViewResult();
                    view.ViewName        = "~/Views/Account/Login.cshtml";
                    view.ViewBag.error   = "You are not allowed to access this.";
                    filterContext.Result = view;
                }
            }

            base.OnActionExecuting(filterContext);
        }
 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     if (SessionItems.Get(SessionKey.ACCOUNT) == null)
     {
         ViewResult view = new ViewResult();
         view.ViewName        = "~/Views/Account/Login.cshtml";
         view.ViewBag.error   = "Please login to continue";
         filterContext.Result = view;
     }
     else if (SessionItems.Get(SessionKey.TWOFA) == null)
     {
         ViewResult view = new ViewResult();
         view.ViewName        = "~/Views/Account/TwoFA.cshtml";
         view.ViewBag.error   = "Please enter two factor code first";
         filterContext.Result = view;
     }
     base.OnActionExecuting(filterContext);
 }
示例#15
0
        private async Task LoadMoreItemsAsync()
        {
            try
            {
                // show loadings
                // get notifications settings!
                var result = await Helper.InstaApi.AccountProcessor.GetLoginSessionsAsync();

                if (result.Succeeded)
                {
                    SessionItems.Clear();
                    SuspiciousLoginItems.Clear();
                    SessionItems.AddRange(result.Value.Sessions);
                    SuspiciousLoginItems.AddRange(result.Value.SuspiciousLogins);
                }
            }
            catch { }
        }
示例#16
0
        public ActionResult Index(string symbol = "BTC-USDT", string timeFrame = "1m", decimal utcTime = 0, string referral = "")
        {
            var acc = SessionItems.Get(SessionKey.ACCOUNT) as Account;
            //var orderBook = _uow.MarketRates.GetOrderBookBinance(UtilityMethods.convertSymbol(symbol));
            IndexModel IndexModel;
            var        candle = ConvertCandles(symbol, timeFrame, utcTime);

            if (acc == null)
            {
                IndexModel = new IndexModel()
                {
                    AcceptTermConditions = true,
                    GetPairs             = _uow.Accounts.GetPairs(),
                    MarketName           = symbol,
                    pairSplit            = UtilityMethods.convertSymbolPolygon(symbol),
                    GetTradeHistory      = new List <Trade>(),
                    GetCandles           = candle,
                    GetOrderBook         = null,
                    TimeFrameValue       = timeFrame,
                    timeOffset           = utcTime,
                    UserRoles            = new UserRole(),
                    IsLogin  = false,
                    referral = referral,
                };
            }
            else
            {
                IndexModel = new IndexModel()
                {
                    AcceptTermConditions = (acc.IsAgreeTermServices == null) ? false : acc.IsAgreeTermServices.Value,
                    GetPairs             = _uow.Accounts.GetPairs(),
                    MarketName           = symbol,
                    pairSplit            = UtilityMethods.convertSymbolPolygon(symbol),
                    GetTradeHistory      = _uow.Accounts.GetTradeHistory(acc.AccountId),
                    GetCandles           = candle,
                    GetOrderBook         = null,
                    TimeFrameValue       = timeFrame,
                    timeOffset           = utcTime,
                    UserRoles            = new UserRole(),
                    IsLogin = true,
                };
            }
            return(View(IndexModel));
        }
示例#17
0
        public ActionResult Profile(bool showPopUp = false)
        {
            ViewBag.ShowPopUp = showPopUp;
            var acc          = SessionItems.Get(SessionKey.ACCOUNT) as Account;
            var ProfileModel = new ProfileModel
            {
                DepositHistory  = _uow.Accounts.GetDepositHistory(acc.AccountId),
                WithdrawHistory = _uow.Accounts.GetWithdrawHistory(acc.AccountId),
                ChangePassword  = new ChangePassword(),
                TradeHistory    = _uow.Accounts.GetTradeHistory(acc.AccountId),
                CurrencyList    = _uow.Accounts.GetCurrencyList(),
                KYC             = new KYC(),
                securityAnswer  = new securityModel(),
                Payment         = new Payment(),
                GetAccount      = _uow.Accounts.GetAccount(acc.AccountId)
            };

            return(View(ProfileModel));
        }
示例#18
0
 public string Buy(string pair, decimal rate, decimal amount, int type, int expirytime, decimal timeOffset)
 {
     // 1 for market order , 2 for limit order///
     try
     {
         var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;
         if (rate == -1)
         {
             var ticker = _uow.MarketRates.GetSpecificTickerBinance(UtilityMethods.convertSymbol(pair));
             if (type == 2)
             {
                 rate = decimal.Parse(ticker.askPrice);
             }
         }
         var response = _uow.Payment.Buy(ac.AccountId, pair, rate, amount, type, expirytime, timeOffset);
         return(response);
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
示例#19
0
 public ActionResult Login(UserRole model)
 {
     try
     {
         var ac = _uow.Accounts.Login(model.Username, model.Password);
         if (ac.AccountEnabled == false)
         {
             TempData["error"] = "Your account is disabled, please contact support for further assistance";
             return(RedirectToAction("Login", "Account"));
         }
         //var res = _uow.Accounts.CheckAgentAndHost(Request.UserAgent, Request.UserHostAddress, ac.Email, ac.AccountId);
         //if (res == false)
         //{
         //    ViewBag.error = "Browser or IP has changed, a verification email has been sent to you. Click the link to verify your account.";
         //    return View();
         //}
         SessionItems.Add(SessionKey.ACCOUNT, ac);
         //if (ac.TwoFactorEnabled == true)
         //{
         //    return RedirectToAction("TwoFA", "Account");
         //}
         if (ac.AccountType_Id == (int)AccountTypes.ADMIN)
         {
             SessionItems.Add(SessionKey.ADMIN, true);
             _uow.Accounts.SaveUserActivity(Request.UserAgent, Request.UserHostAddress, ac.Email, "Login");
             return(RedirectToAction("Index", "Admin"));
         }
         else
         {
             TempData["error"] = "Invalid username or password";
             return(RedirectToAction("Login", "Account"));
         }
     }
     catch (ExchangeException ex)
     {
         ViewBag.error = ex.ErrorMessage;
     }
     return(View());
 }
示例#20
0
        public ActionResult CloseOrder(long orderId)
        {
            var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;

            if (ac == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            var obj = _uow.Payment.CloseOrder(orderId, ac.AccountId);
            var msg = "";

            if (obj != null)
            {
                msg = "Order has been Successfully Close.";
                return(Json(new { msg }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                msg = "Order not canceled, An Error Occured";
                return(Json(new { msg }, JsonRequestBehavior.AllowGet));
            }
        }
示例#21
0
        public ActionResult WireTransfer(ProfileModel model)
        {
            try
            {
                var _ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;
                var ac  = _uow.Accounts.GetAccount(_ac.AccountId);
                var obj = new Payment()
                {
                    Account_Id        = ac.AccountId,
                    FiatCurrency      = "USD",
                    FiatAmount        = model.Payment.FiatAmount,
                    BankAddress       = model.Payment.BankAddress,
                    PaymentType       = "FIAT_WITHDRAW",
                    BankAccountTitle  = model.Payment.BankAccountTitle,
                    BankName          = model.Payment.BankName,
                    BankAccountNumber = model.Payment.BankAccountNumber,
                    PaymentDate       = DateTime.Now,
                    IBAN             = model.Payment.IBAN,
                    BankCity         = model.Payment.BankCity,
                    Reason           = model.Payment.Reason,
                    Currency         = "USD",
                    Source           = "FIAT",
                    Amount           = model.Payment.FiatAmount,
                    AmountSent       = Convert.ToDecimal(model.Payment.FiatAmount),
                    PaymentStatus_Id = (int)1,
                    StatusMessage    = "Withdrawl Requested"
                };

                var account = _uow.Payment.WireWithDrawlReqAdmin(obj);
                SessionItems.Add(SessionKey.ACCOUNT, account);
                Session["msg"] = "Wire transfer has been successfully submitted to admin. Wait for confirmation";
                return(RedirectToAction("Profile", "Account"));
            }
            catch (ExchangeException ex)
            {
                Session["msg"] = "Some error occured, try agin later";
                return(RedirectToAction("Profile", "Account"));
            }
        }
示例#22
0
        public ResultModel Insert(string userId, Company obj)
        {
            Company objt = new Company()
            {
            };

            LoadModel(obj, objt);
            objt.Id = Guid.NewGuid();
            objt.RepresentativeUserId = userId;
            try
            {
                DataContext.Companies.InsertOnSubmit(objt);
                DataContext.SubmitChanges();
                SessionItems.CurrentUser.UpdateUserCompanyRep(objt.Id);
                SessionItems.UpdatedCurrentUser();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                DataContext.SubmitChanges();
            }
            return(ResultModel.SuccessResult());
        }
示例#23
0
        public ActionResult SetAcceptTerms(bool value)
        {
            var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;

            if (ac == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            var  obj = _uow.Accounts.SetTerm_Conditions(ac.AccountId, value);
            bool res = false;

            if (obj != null)
            {
                SessionItems.Add(SessionKey.ACCOUNT, obj);
                res = true;
                return(Json(new { res }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                res = false;
                return(Json(new { res }, JsonRequestBehavior.AllowGet));
            }
        }
示例#24
0
 public ActionResult SecurityDetails(string firstQuestion, string SecAns1, string secondQuestion, string SecAns2, string thirdQuestion, string SecAns3)
 {
     try
     {
         var _ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;
         var ac  = _uow.Accounts.GetAccount(_ac.AccountId);
         if (firstQuestion != "-- select question --" && secondQuestion != "-- select question --" && thirdQuestion != "-- select question --" &&
             SecAns1 != null && SecAns1 != "" && SecAns2 != null && SecAns2 != "" && SecAns3 != null && SecAns3 != "")
         {
             var detail = _uow.Accounts.securityAnswer(ac.AccountId, firstQuestion, SecAns1, secondQuestion, SecAns2, thirdQuestion, SecAns3);
         }
         else
         {
             ViewBag.msg = "Please fill all fields.";
             return(RedirectToAction("Index", "Dashboard"));
         }
         return(RedirectToAction("Profile", "Account"));
     }
     catch (ExchangeException ex)
     {
         ViewBag.msg = ex.ErrorMessage;
         return(RedirectToAction("Profile", "Account"));
     }
 }
示例#25
0
        public ActionResult ChangePassword(string oldPassword, string newPassword)
        {
            try
            {
                var  _ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;
                var  ac  = _uow.Accounts.GetAccount(_ac.AccountId);
                bool v   = _uow.Accounts.ChangePassword(ac.AccountId, oldPassword, newPassword);

                var obj = new {
                    message = "Password has been updated successfully",
                    status  = true
                };
                return(Json(obj, JsonRequestBehavior.AllowGet));
            }
            catch (ExchangeException ex)
            {
                var obj = new
                {
                    message = "An error occured! " + ex.ErrorMessage,
                    status  = false
                };
                return(Json(obj, JsonRequestBehavior.AllowGet));
            }
        }
示例#26
0
        public static void ComputeAchievements()
        {
            // PreProcessing
            try { Inventory.LoadCats(); } catch { };
            try { Inventory.LoadPatterns(); } catch { };
            try { SessionItems.Load(); } catch { };
            try { Coins.Load(); } catch { };
            AchievementItems.Ongoing = new List <AchievementItem>();
            AchievementItems.Done    = new List <AchievementItem>();
            TimeSpan TotalTime = new TimeSpan(0, 0, 0, 0);
            int      MaxinRow  = 0;
            var      CurrinRow = 0;

            for (int i = 0; i < SessionItems.Sessions.Count(); i++)
            {
                TotalTime.Add(SessionItems.Sessions[i].Duration);
                if (i > 0)
                {
                    if (SessionItems.Sessions[i].Date.Subtract(SessionItems.Sessions[i - 1].Date) < new TimeSpan(1, 12, 0, 0))
                    {
                        if (SessionItems.Sessions[i].Date.Subtract(SessionItems.Sessions[i - 1].Date) > new TimeSpan(0, 12, 0, 0))
                        {
                            CurrinRow += 1;
                        }
                        if (MaxinRow < CurrinRow)
                        {
                            MaxinRow = CurrinRow;
                        }
                    }
                    else
                    {
                        CurrinRow = 0;
                    }
                }
                else
                {
                    CurrinRow += 1;
                    if (MaxinRow < CurrinRow)
                    {
                        MaxinRow = CurrinRow;
                    }
                }
            }
            // Partie 1 - Temps Total
            var        TotalHours = TotalTime.TotalHours;
            List <int> Milestones = new List <int>()
            {
                1, 2, 5, 10, 20, 50, 100, 200, 500, 1000
            };

            for (int i = 0; i < Milestones.Count(); ++i)
            {
                // Heures 16-25
                if (TotalHours >= Milestones[i])
                {
                    // Succès Faits
                    AchievementItems.Done.Add(AchievementItems.All[16 + i]);
                }
                else
                {
                    //Calculer la progression & ajouter
                    double prog = (double)TotalHours / Milestones[i];
                    var    ach  = AchievementItems.All[16 + i];
                    ach.progress = prog;
                    AchievementItems.Ongoing.Add(ach);
                }
            }
            // Partie 2 -  Jours D'affilés
            List <int> MilestoneRow = new List <int>()
            {
                2, 3, 5, 7, 10, 15, 20, 30, 60
            };

            for (int i = 0; i < MilestoneRow.Count(); i++)
            {
                // Jours 7-15
                if (MaxinRow >= MilestoneRow[i])
                {
                    AchievementItems.Done.Add(AchievementItems.All[7 + i]);
                }
                else
                {
                    // Calculer la progression
                    double          prog = (double)MaxinRow / MilestoneRow[i];
                    AchievementItem ach  = AchievementItems.All[7 + i];
                    ach.progress = prog;
                    AchievementItems.Ongoing.Add(ach);
                }
            }
            // Partie 3 - Argent Gagné
            var        TotalMoney     = Coins.myCoins[1];
            List <int> MilestoneMoney = new List <int> {
                100, 1000, 2000, 5000, 10000, 50000, 100000
            };

            for (int i = 0; i < MilestoneMoney.Count(); i++)
            {
                if (TotalMoney >= MilestoneMoney[i])
                {
                    // Succès faits
                    AchievementItems.Done.Add(AchievementItems.All[i]);
                }
                else
                {
                    // Calculer la progression
                    double          prog = (double)AppData.Coins.myCoins[1] / MilestoneMoney[i];
                    AchievementItem ach  = AchievementItems.All[i];
                    ach.progress = prog;
                    AchievementItems.Ongoing.Add(ach);
                }
            }
            // Partie 4 - Achats
            //Total
            var        TotalItems          = Inventory.Cats.Count() + Inventory.Patterns.Count();
            List <int> MilestoneTotalItems = new List <int> {
                1, 3, 5, 10, 20, 40, 50, 80, 100
            };

            for (int i = 0; i < MilestoneTotalItems.Count(); i++)
            {
                if (TotalItems >= MilestoneTotalItems[i])
                {
                    // Succès faits
                    AchievementItems.Done.Add(AchievementItems.All[33 + i]);
                }
                else
                {
                    // Calculer la progression
                    var             prog = (double)TotalItems / MilestoneTotalItems[i];
                    AchievementItem ach  = AchievementItems.All[33 + i];
                    ach.progress = prog;
                    AchievementItems.Ongoing.Add(ach);
                }
            }
            //Chats
            var        TotalCats          = Inventory.Cats.Count();
            List <int> MilestoneTotalCats = new List <int> {
                1, 3, 5, 10, 20, 40, 50
            };

            for (int i = 0; i < MilestoneTotalCats.Count(); i++)
            {
                if (TotalCats >= MilestoneTotalCats[i])
                {
                    // Succès faits
                    AchievementItems.Done.Add(AchievementItems.All[26 + i]);
                }
                else
                {
                    // Calculer la progression
                    double          prog = (double)TotalCats / MilestoneTotalCats[i];
                    AchievementItem ach  = AchievementItems.All[26 + i];
                    ach.progress = prog;
                    AchievementItems.Ongoing.Add(ach);
                }
            }
            //Patterns
            var        TotalPatterns          = Inventory.Patterns.Count();
            List <int> MilestoneTotalPatterns = new List <int> {
                1, 3, 5, 10, 20, 40, 50
            };

            for (int i = 0; i < MilestoneTotalPatterns.Count(); i++)
            {
                if (TotalPatterns >= MilestoneTotalPatterns[i])
                {
                    // Succès faits
                    AchievementItems.Done.Add(AchievementItems.All[42 + i]);
                }
                else
                {
                    // Calculer la progression
                    double          prog = (double)TotalPatterns / MilestoneTotalPatterns[i];
                    AchievementItem ach  = AchievementItems.All[42 + i];
                    ach.progress = prog;
                    AchievementItems.Ongoing.Add(ach);
                }
            }
            AchievementItems.Ongoing.Sort(AchievementCompare);
            AchievementItems.SaveDone();
            AchievementItems.SaveOngoing();
        }
示例#27
0
 public ActionResult Logout()
 {
     SessionItems.RemoveAll();
     return(RedirectToAction("Index", "Admin"));
 }
示例#28
0
        public ActionResult _notification()
        {
            var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;

            return(View(_uow.Accounts.GetNotifications().OrderByDescending(m => m.NotificationId).Take(10).ToList()));
        }
示例#29
0
        public string history(string symbol, string from, string to, string resolution)
        {
            SessionItems.Add(SessionKey.LOAD_CHART, true);

            List <GetCandlesBySymbol> res = new List <GetCandlesBySymbol>();

            if (resolution == "1")
            {
                res = _uow.MarketRates.GetOwnTicks(symbol, 1);
            }
            else if (resolution == "5")
            {
                res = _uow.MarketRates.GetOwnTicks(symbol, 5);
            }
            else if (resolution == "30")
            {
                res = _uow.MarketRates.GetOwnTicks(symbol, 30);
            }
            else if (resolution == "60" || resolution == "90")
            {
                res = _uow.MarketRates.GetOwnTicks(symbol, 60);
            }
            else
            {
                res = _uow.MarketRates.GetOwnTicks(symbol, 1440);
            }

            ////////////
            //// GET SPREAD
            ///////////////

            decimal spread = _uow.MarketRates.GetBuySpread(symbol.Split('-')[1]);

            string t = "[";
            string o = "[";
            string h = "[";
            string l = "[";
            string c = "[";
            string v = "[";

            for (int i = 0; i < res.Count(); i++)
            {
                t += (Int32)(res[i].StartsAt.ToUniversalTime().Subtract(new DateTime(1970, 1, 1))).TotalSeconds;

                var open  = Convert.ToDecimal(res[i].Open).ToString();
                var high  = Convert.ToDecimal(res[i].High).ToString();
                var low   = Convert.ToDecimal(res[i].Low).ToString();
                var close = Convert.ToDecimal(res[i].Close).ToString();

                o += open; h += high; l += low; c += close; v += 10;

                if (i != (res.Count() - 1))
                {
                    t += ","; o += ","; h += ","; l += ","; c += ","; v += ",";
                }
                else
                {
                    t += "]"; o += "]"; h += "]"; l += "]"; c += "]"; v += "]";
                }
            }
            string data = @"{""t"":" + t + @",
                             ""o"":" + o + @",
                             ""h"":" + h + @",
                             ""l"":" + l + @",
                             ""c"":" + c + @",
                             ""v"":" + v + @",""s"":""ok""}";

            Session[symbol + "_DATA"] = data;
            return(data);
        }
示例#30
0
 /// <summary>
 /// 初始化
 /// </summary>
 public Session()
 {
     Items = new SessionItems();
 }