Ejemplo n.º 1
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"));
            }
        }
Ejemplo n.º 2
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));
            }
        }
Ejemplo n.º 3
0
        public ActionResult Referral()
        {
            var          acc  = SessionItems.Get(SessionKey.ACCOUNT) as Account;
            RefferalData data = _uow.Accounts.GetRefferalData(acc.AccountId);

            return(View(data));
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 5
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));
        }
Ejemplo n.º 6
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));
        }
Ejemplo n.º 7
0
        public ActionResult _header()
        {
            var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;

            ViewBag.email = ac.Email;
            return(View());
        }
Ejemplo n.º 8
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));
            }
        }
Ejemplo n.º 9
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));
        }
Ejemplo n.º 10
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));
            }
        }
Ejemplo n.º 11
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));
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
 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);
 }
Ejemplo n.º 14
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));
        }
Ejemplo n.º 15
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));
        }
Ejemplo n.º 16
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));
            }
        }
Ejemplo n.º 17
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"));
            }
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 19
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));
            }
        }
Ejemplo n.º 20
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"));
     }
 }
Ejemplo n.º 21
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));
            }
        }
Ejemplo n.º 22
0
        public ActionResult _notification()
        {
            var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;

            return(View(_uow.Accounts.GetNotifications().OrderByDescending(m => m.NotificationId).Take(10).ToList()));
        }
Ejemplo n.º 23
0
        public ActionResult GetTradeHistorySpecific(string dateFrom, string dateTo)
        {
            var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;

            if (ac == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                DateTime from, to;
                if (dateFrom != "" || dateTo != "")
                {
                    var tempdateFromTemp = dateFrom.Split('/');
                    dateFrom = tempdateFromTemp[0] + "-" + tempdateFromTemp[1] + "-" + tempdateFromTemp[2];
                    var tempdateToTemp = dateTo.Split('/');
                    dateTo = tempdateToTemp[0] + "-" + tempdateToTemp[1] + "-" + tempdateToTemp[2];
                    from   = DateTime.Parse(dateFrom + " 12:01:00 AM");
                    to     = DateTime.Parse(dateTo + " 23:59:00 PM");
                }
                else
                {
                    //{ 4 / 15 / 2020 12:15:03 PM}
                    var fromTemp = DateTime.UtcNow;
                    from = DateTime.Parse(fromTemp.Month + "/" + fromTemp.Day + "/" + fromTemp.Year + " 12:01:00 AM");
                    to   = DateTime.UtcNow.AddDays(1);
                }
                var paymentsList = _uow.Payment.GetSpecificPayments(ac.AccountId, from, to);
                var res          = _uow.Accounts.GetTradeHistory(ac.AccountId, from, to).ToList();

                List <PendingOrderForView> list = new List <PendingOrderForView>();
                for (int t = 0; t < res.Count; t++)
                {
                    if (res[t].TradeClose_Date != null)
                    {
                        if (from.Ticks <= res[t].TradeClose_Date.Value.Ticks && to.Ticks >= res[t].TradeClose_Date.Value.Ticks)
                        {
                            list.Add(new PendingOrderForView()
                            {
                                TradeId        = res[t].TradeId,
                                TradeDate      = res[t].TradeDate.ToString(),
                                TradeCloseDate = res[t].TradeClose_Date.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,
                                ExitPrice      = res[t].ExitPrice,
                                Account_Id     = (long)res[t].Account_Id,
                                Value          = (decimal)res[t].Value,
                                Direction      = res[t].Direction,
                                PnL            = res[t].PnL,
                                Ticker         = (res[t].TradeClose_Date.Value.Ticks - 621355968000000000) / 10000000,
                                isTradeOrder   = true,
                            });
                        }
                    }
                }

                for (int t = 0; t < paymentsList.Count; t++)
                {
                    list.Add(new PendingOrderForView()
                    {
                        TradeId        = paymentsList[t].PaymentId,
                        TradeDate      = paymentsList[t].PaymentDate.ToString(),
                        TradeType      = paymentsList[t].PaymentType,
                        TradeCloseDate = null,
                        TradeTypeValue = 0,
                        Currency       = paymentsList[t].Currency,
                        Symbol         = paymentsList[t].PaymentType,
                        Amount         = (decimal)paymentsList[t].Amount,
                        Rate           = 0,
                        Status         = PaymentStatusType.COMPLETED.ToString(),
                        ExitPrice      = 0,
                        Account_Id     = (long)paymentsList[t].Account_Id,
                        Value          = 0,
                        Direction      = paymentsList[t].PaymentType,
                        PnL            = (decimal)paymentsList[t].Amount,
                        isTradeOrder   = false,
                        Ticker         = (paymentsList[t].PaymentDate.Value.Ticks - 621355968000000000) / 10000000,
                    });
                }

                list = list.OrderByDescending(o => o.Ticker).ToList();

                for (int t = 0; t < res.Count; t++)
                {
                    if (res[t].TradeClose_Date == null)
                    {
                        if (from.Ticks <= res[t].TradeDate.Ticks && to.Ticks >= res[t].TradeDate.Ticks)
                        {
                            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,
                                TradeCloseDate = null,
                                Symbol         = res[t].Symbol,
                                Amount         = (decimal)res[t].Amount,
                                Rate           = (decimal)res[t].Rate,
                                Status         = res[t].Status,
                                ExitPrice      = res[t].ExitPrice,
                                Account_Id     = (long)res[t].Account_Id,
                                Value          = (decimal)res[t].Value,
                                Direction      = res[t].Direction,
                                PnL            = res[t].PnL,
                                Ticker         = (res[t].TradeDate.Ticks - 621355968000000000) / 10000000,
                                isTradeOrder   = true,
                            });
                        }
                    }
                }
                return(Json(new { list }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 24
0
        public ActionResult GetTradeOnChart(decimal timeOffset, string pair, long point)
        {
            var ac = SessionItems.Get(SessionKey.ACCOUNT) as Account;

            if (ac == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                List <GetTradeonChart> tradeonCharts = new List <GetTradeonChart>();
                var res = new object();
                if (ac != null)
                {
                    var list = _uow.Accounts.GetPendingTrades(ac.AccountId, pair);
                    for (int x = 0; x < list.Count; x++)
                    {
                        list[x].TradeDate = list[x].TradeDate.AddHours(-1 * (double)(timeOffset / 60));

                        string dt = (list[x].TradeDate.Year + "-" + list[x].TradeDate.Month.ToString("D2") + "-" + list[x].TradeDate.Day.ToString("D2") + " " + list[x].TradeDate.Hour.ToString("D2") +
                                     ":" + list[x].TradeDate.Minute.ToString("D2") + ":" + list[x].TradeDate.Second.ToString("D2"));
                        tradeonCharts.Add(new GetTradeonChart()
                        {
                            id          = list[x].TradeId,
                            volume      = list[x].Amount.Value.ToString(),
                            price       = list[x].Rate.ToString(),
                            splitPrice  = list[x].Rate.Value,
                            profit      = (list[x].PnL == null) ? "0" : list[x].PnL.Value.ToString(),
                            count       = 1,
                            summ        = list[x].Amount.Value.ToString(),
                            qb          = "",
                            time        = dt,
                            date_time   = dt,
                            security_id = list[x].TradeId,
                            type_id     = (list[x].Direction.Equals("BUY")) ? 1 : 2,
                        });
                    }

                    for (int x = 0; x < list.Count; x++)
                    {
                        if (list[x].StopLoss_TakeProfitEn != null)
                        {
                            list[x].TradeDate = UnixTimeStampToDateTime(point).AddHours(-1 * (double)(timeOffset / 60)).AddMinutes(60);
                            Random rnd;

                            //list[x].TradeDate = list[x].TradeDate.AddHours(-1 * (double)(timeOffset / 60));
                            string dt = (list[x].TradeDate.Year + "-" + list[x].TradeDate.Month.ToString("D2") + "-" + list[x].TradeDate.Day.ToString("D2") + " " + list[x].TradeDate.Hour.ToString("D2") +
                                         ":" + list[x].TradeDate.Minute.ToString("D2") + ":" + list[x].TradeDate.Second.ToString("D2"));
                            rnd = new Random();
                            long upId   = rnd.Next(1, 1000);
                            long downId = rnd.Next(1000, 10000);

                            tradeonCharts.Add(new GetTradeonChart()
                            {
                                id          = upId + x,
                                volume      = list[x].Amount.Value.ToString(),
                                price       = (list[x].UpLimitValue).ToString(),
                                splitPrice  = list[x].UpLimitValue.Value,
                                profit      = (list[x].PnL == null) ? "0" : list[x].PnL.Value.ToString(),
                                count       = 1,
                                summ        = list[x].Amount.Value.ToString(),
                                qb          = "",
                                time        = dt,
                                date_time   = dt,
                                security_id = upId + x,
                                type_id     = (list[x].Direction.Equals("BUY")) ? 2 : 1,
                            });

                            tradeonCharts.Add(new GetTradeonChart()
                            {
                                id          = downId + x,
                                volume      = list[x].Amount.Value.ToString(),
                                price       = (list[x].DownLimitValue).ToString(),
                                splitPrice  = list[x].DownLimitValue.Value,
                                profit      = (list[x].PnL == null) ? "0" : list[x].PnL.Value.ToString(),
                                count       = 1,
                                summ        = list[x].Amount.Value.ToString(),
                                qb          = "",
                                time        = dt,
                                date_time   = dt,
                                security_id = downId + x,
                                type_id     = (list[x].Direction.Equals("BUY")) ? 2 : 1,
                            });
                        }
                    }
                    //res = JsonConvert.SerializeObject(tradeonCharts);
                    res = tradeonCharts;
                    return(Json(new { res }, JsonRequestBehavior.AllowGet));
                }
                //res = JsonConvert.SerializeObject(tradeonCharts);
                res = tradeonCharts;
                return(Json(new { res }, JsonRequestBehavior.AllowGet));
            }
        }