public NewOrderInput(newLogSaved Updatedeleagte, AlsiWebDataContext _dc,bool AdminRights)
 {
     InitializeComponent();
     _onSaved = Updatedeleagte;
     dc = _dc;
     admin = AdminRights;
 }
Beispiel #2
0
            private static void SetMANUAL_CLOSE_TRIGGER(bool Triggered)
            {
                AlsiWebDataContext dc = new AlsiWebDataContext();
                var setting           = dc.tblSettings.Where(z => z.SettingName == "MANUAL_CLOSE_TRIGGER").First();

                setting.ValueString = Triggered.ToString();
                dc.SubmitChanges();
            }
Beispiel #3
0
            private static void Set_ENABLE_SMS(bool Triggered)
            {
                AlsiWebDataContext dc = new AlsiWebDataContext();
                var setting           = dc.tblSettings.Where(z => z.SettingName == "ENABLE_SMS").First();

                setting.ValueString = Triggered.ToString();
                dc.SubmitChanges();
            }
 public static void CheckUncheckSmsListUser(int UserID)
 {
     var dc = new AlsiWebDataContext();
     var user = dc.tblSMs.Where(z => z.SMS_ID == UserID).First();
     user.Active = !user.Active;
     dc.SubmitChanges();
     GetSmsList();
 }
 public static void DeleteUserFromSmsList(int UserID)
 {
     var dc = new AlsiWebDataContext();
     var user = dc.tblSMs.Where(z => z.SMS_ID == UserID).First();
     dc.tblSMs.DeleteOnSubmit(user);
     dc.SubmitChanges();
     GetSmsList();
 }
 public NewOrderInput(newLogSaved Updatedeleagte, WebTradeLog Log, AlsiWebDataContext _dc, bool AdminRights)
 {
     InitializeComponent();
     _onSaved = Updatedeleagte;
     loadExisting = true;
     EX = Log;
     dc = _dc;
     admin = AdminRights;
 }
 public static bool InsertNewUsertoEmailList(tblEmail user)
 {
     var dc = new AlsiWebDataContext();
     var insert = (!dc.tblEmails.Any(z => z.Email == user.Email));
     if (insert)
     {
         user.Active = true;
         dc.tblEmails.InsertOnSubmit(user);
         dc.SubmitChanges();
         GetEmailList();
     }
     return insert;
 }
        private void LoadListview()
        {
            dc = new AlsiWebDataContext();
            tradeListView.Items.Clear();
            var log = dc.WebTradeLogs.OrderByDescending(z => z.Time).Take(25);

            foreach (var t in log)
            {
                ListViewItem lvi = new ListViewItem(t.Time.ToString());
                lvi.Tag = t;
                lvi.SubItems.Add(t.BuySell);
                lvi.SubItems.Add(t.Price.ToString());
                lvi.SubItems.Add(t.Reason);
                lvi.SubItems.Add(t.Volume.ToString());
                lvi.SubItems.Add(t.Matched.ToString());
                lvi.SubItems.Add(t.PriceMatched.ToString());
                tradeListView.Items.Add(lvi);
            }
        }
            static void BW_DoWork(object sender, DoWorkEventArgs e)
            {
                var dc = new AlsiWebDataContext();

                bool smsON = WebSettings.General.ENABLE_SMS;
                List<string> sms = WebUpdate._SMSList.Where(z => z.Active == true).Select(z => z.TelNr).ToList();
                foreach (var s in sms)
                   if(smsON) Communicator.SMS.sendSMS(s, _Msg.text + "\n"+ _SMSTrade);

            }
            static void BW_DoWork(object sender, DoWorkEventArgs e)
            {
                var dc = new AlsiWebDataContext();

               // List<string> emails = dc.EmailLists.Where(z=>z.Active==true).Select(z => z.Email).ToList();
                List<string> emails = WebUpdate._EmailList.Where(z => z.Active == true).Select(z => z.Email).ToList();

                if (_Admin) Communicator.Gmail.SendEmail(emails[0], _Msg.Title, _Msg.Body, null, "*****@*****.**", "1rachelle", "Alsi Trade System", false);
                else
                    Communicator.Gmail.SendEmail(emails, _Msg.Title, _Msg.Body, null, "*****@*****.**", "1rachelle", "Alsi Trade System", false);
            }
 private static void Set_ENABLE_SMS(bool Triggered)
 {
     AlsiWebDataContext dc = new AlsiWebDataContext();
     var setting = dc.tblSettings.Where(z => z.SettingName == "ENABLE_SMS").First();
     setting.ValueString = Triggered.ToString();
     dc.SubmitChanges();
 }
 private static bool GetENABLE_SMS()
 {
     AlsiWebDataContext dc = new AlsiWebDataContext();
     return bool.Parse(dc.tblSettings.Where(z => z.SettingName == "ENABLE_SMS").First().ValueString);
 }
 private static void SetMANUAL_CLOSE_TRIGGER(bool Triggered)
 {
     AlsiWebDataContext dc = new AlsiWebDataContext();
     var setting = dc.tblSettings.Where(z => z.SettingName == "MANUAL_CLOSE_TRIGGER").First();
     setting.ValueString = Triggered.ToString();
     dc.SubmitChanges();
 }
 public static void ClearTradeLog()
 {
     var dc = new AlsiWebDataContext();
     var delall = dc.WebTradeLogs;
     dc.WebTradeLogs.DeleteAllOnSubmit(delall);
     dc.SubmitChanges();
 }
 public static bool InsertNewUsertoSmsList(tblSM user)
 {
     var dc = new AlsiWebDataContext();
     var insert = (!dc.tblSMs.Any(z => z.TelNr == user.TelNr));
     if (insert)
     {
         user.Active = true;
         dc.tblSMs.InsertOnSubmit(user);
         dc.SubmitChanges();
         GetSmsList();
     }
     return insert;
 }
        public static void SendOrderToWebDB(Trade trade)
        {
            var dc = new AlsiWebDataContext();
            string bs = "none";
            if (trade.BuyorSell == Trade.BuySell.Buy) bs = "Buy";
            if (trade.BuyorSell == Trade.BuySell.Sell) bs = "Sell";
            if (!CheckDbCount(dc, trade)) return;

            if (!trade.xlMatched)
            {
                WebTradeLog wtl = new WebTradeLog()
                {
                    Time = trade.TimeStamp,
                    BuySell = trade.BuyorSell.ToString(),
                    Price = (int)trade.TradedPrice,
                    Reason = trade.Reason.ToString(),
                    Volume = trade.TradeVolume,
                    PriceMatched = 0,
                    Matched = false,
                };
               // dc.WebTradeLogs.InsertOnSubmit(wtl);
                //dc.SubmitChanges();
            }
            else
            {
                int c = dc.WebTradeLogs.Count();
                var last = dc.WebTradeLogs.Skip(c - 1).Take(1).Single();
                last.Time = trade.TimeStamp;
                last.Matched = true;
                dc.SubmitChanges();
            }

        }
 private static bool CheckDbCount(AlsiWebDataContext dc, Trade trade)
 {
     int c = dc.WebTradeLogs.Count();
     if (c > 0)
     {
         //var  last = dc.WebTradeLogs.Skip(c - 10).Take(10);
     }
     else
     {//create new if db is empty
         WebTradeLog wtl = new WebTradeLog()
         {
             Time = trade.TimeStamp,
             BuySell = trade.BuyorSell.ToString(),
             Price = (int)trade.TradedPrice,
             Reason = trade.Reason.ToString(),
             Volume = trade.TradeVolume,
             PriceMatched = (int)trade.TradedPrice,
             Matched = false,
         };
         dc.WebTradeLogs.InsertOnSubmit(wtl);
         dc.SubmitChanges();
         return false;
     }
     return true;
 }
 public static void GetSmsList()
 {
     var dc = new AlsiWebDataContext();
     _SMSList = dc.tblSMs.OrderBy(z => z.SMS_ID).ToList();
 }
 public static void GetEmailList()
 {
     var dc = new AlsiWebDataContext();
     _EmailList = dc.tblEmails.OrderBy(z => z.Email_ID).ToList();
 }
Beispiel #20
0
            private static bool GetENABLE_SMS()
            {
                AlsiWebDataContext dc = new AlsiWebDataContext();

                return(bool.Parse(dc.tblSettings.Where(z => z.SettingName == "ENABLE_SMS").First().ValueString));
            }
 private static bool GetMANUAL_CLOSE_TRIGGER()
 {
     AlsiWebDataContext dc = new AlsiWebDataContext();
     return bool.Parse(dc.tblSettings.Where(z => z.SettingName == "MANUAL_CLOSE_TRIGGER").First().ValueString);
 }
Beispiel #22
0
            private static bool GetMANUAL_CLOSE_TRIGGER()
            {
                AlsiWebDataContext dc = new AlsiWebDataContext();

                return(bool.Parse(dc.tblSettings.Where(z => z.SettingName == "MANUAL_CLOSE_TRIGGER").First().ValueString));
            }
 public static void ClearEmailList()
 {
     var dc = new AlsiWebDataContext();
     var delall = dc.tblEmails;
     dc.tblEmails.DeleteAllOnSubmit(delall);
     dc.SubmitChanges();
 }