Example #1
0
        internal static IEnumerable <string> GetOrderNumbers()
        {
            List <string> OrdNumbers = new List <string>();
            string        query      = "SELECT `Order` FROM custodian.orderholders";

            using (MySqlConnection conn = new MySqlConnection(ConnectionString))
            {
                try
                {
                    MySqlCommand comm = new MySqlCommand(query, conn);
                    conn.Open();
                    MySqlDataReader reader = comm.ExecuteReader();
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            OrdNumbers.Add(reader.GetString(0));
                        }
                    }
                    else
                    {
                        OrdNumbers.Add("Clients list is Empty");
                    }
                }
                catch (Exception ex)
                {
                    BOX.ShowError(ex.Message, ex.Source);
                }
            }


            return(OrdNumbers);
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var hwnd = new WindowInteropHelper(this).Handle;

            SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);

            pathToFolder = Directory.GetCurrentDirectory();
            Uri     ftp              = new Uri("ftp://[email protected]/Versions/Last_Version.txt");
            Version newUpdate        = new Version(pathToFolder, ftp, password, user);
            var     installedVersion = newUpdate.getCurrentVersion();

            if (installedVersion != 0)
            {
                newUpdate.SetRemoteVersion();

                if (newUpdate.ConnectFlag != false)
                {
                    var remoteVersion = newUpdate.getRemoteVersionsXML();
                    if (installedVersion < remoteVersion)
                    {
                        if (BOX.ShowQuestion("You have old version of application."
                                             + Environment.NewLine +
                                             "Would you like install the new version?", "Update") == true)
                        {
                            Process.Start(System.IO.Path.Combine(pathToFolder, "Updater.exe"));
                            Environment.Exit(0);
                        }
                    }
                }
            }
        }
 internal static void AddPlatformActive(string Order, string PlatformName, string Money, string Date, string AdminID, decimal cashafter, string value)
 {
     using (MySqlConnection conn = new MySqlConnection(ConnectionString))
     {
         string       _admin = AdminID.Trim(sign);
         string       query  = "insert into activest () values (uuid(),@order,@platform,@money,@dateinst,now(), @AdminID,@_value)";
         MySqlCommand comm   = new MySqlCommand(query, conn);
         comm.Parameters.AddWithValue("@order", Order);
         comm.Parameters.AddWithValue("@platform", PlatformName);
         comm.Parameters.AddWithValue("@money", Money);
         comm.Parameters.AddWithValue("@dateinst", Date);
         comm.Parameters.AddWithValue("@AdminID", _admin);
         comm.Parameters.AddWithValue("@_value", value);
         try
         {
             conn.Open();
             comm.ExecuteNonQuery();
             CashAccountReset(cashafter, Order);
         }
         catch (Exception ex)
         {
             BOX.ShowError(ex.Message, ex.Source);
         }
     }
 }
        // Only Money Funding
        internal static void ResetCashAllocationCashAccount_Funding(string id, string Security, string cashAccount, string cashAllocation, string Summ, string DateGetInst)
        {
            using (MySqlConnection conn = new MySqlConnection(ConnectionString))
            {
                decimal _cashAccount    = Convert.ToDecimal(cashAccount);
                decimal _cashAllocation = Convert.ToDecimal(cashAllocation);
                string  query           = "update `orderholders` set `Cash Account` = @CashAcc  where `Order` = @numer;"
                                          +
                                          "insert into `activesfunding` (`OperationID`, `Order`, `Security`,`CashAmount`,`Date`,`DateGetInst`) values(uuid(), @numer, @_security, @_Summ, @_dategetInst, now())";
                MySqlCommand comm = new MySqlCommand(query, conn);
                comm.Parameters.AddWithValue("@numer", id);

                comm.Parameters.AddWithValue("@CashAcc", _cashAccount.ToString("0.00", CultureInfo.GetCultureInfo("en-US")));

                comm.Parameters.AddWithValue("@_security", Security);
                comm.Parameters.AddWithValue("@_Summ", Summ);
                comm.Parameters.AddWithValue("@_dategetInst", DateGetInst);
                try
                {
                    conn.Open();
                    comm.ExecuteNonQuery();
                    BOX.ShowInformation("Funding update Sucsessfull");
                }
                catch (Exception ex) { BOX.ShowError(ex.Message, ex.Source); }
            }
        }
Example #5
0
        public static List <string> GetAdvisers()
        {
            List <string> advisers = new List <string>();

            using (MySqlConnection conn = new MySqlConnection(ConnectionString))
            {
                string query = "SELECT * FROM custodian.administrators where `Level` =2";
                try
                {
                    conn.Open();
                    MySqlCommand    comm   = new MySqlCommand(query, conn);
                    MySqlDataReader reader = comm.ExecuteReader();
                    while (reader.Read())
                    {
                        if (reader.HasRows)
                        {
                            advisers.Add(reader.GetValue(1).ToString() + " " + reader.GetValue(2).ToString());
                        }
                        else
                        {
                            advisers.Add("Advisers List is Empty");
                        }
                    }
                }
                catch (Exception ex)
                {
                    BOX.ShowError(ex.Message, ex.Source);
                }
            }

            return(advisers);
        }
Example #6
0
 private static Task GetDataChat(string from, string to)
 {
     return(Task.Run(() =>
     {
         using (MySqlConnection conn = new MySqlConnection(ConnectionString))
         {
             string query = $"SELECT  `text`,`message_date`,`from`,`path` FROM messengers WHERE(`from` = '{from}' and `to` = '{to}') or (`from` = '{to}' and `to` = '{from}') or (`From` = 'System' and `to`='{from}') LIMIT 100";
             MySqlCommand comm = new MySqlCommand(query, conn);
             MySqlDataAdapter adapter = new MySqlDataAdapter(comm);
             DataTable table = new DataTable();
             try
             {
                 conn.Open();
                 adapter.Fill(table);
                 chatTable = table;
             }
             catch (Exception ex)
             {
                 System.Windows.Application.Current.Dispatcher.Invoke(() =>
                 {
                     if (ErrorMessageCount == false)
                     {
                         ErrorMessageCount = true;
                         BOX.ShowError("Internet Connect Failed!", "Error");
                     }
                 });
                 Logger.WriteLog(ex.Message, ex.Source);
             }
             return null;
         }
     }));
 }
        // Paper Funding
        internal static void ResetCashAllocationCashAccount_Funding(string id, string security, string isin, string count, string aqprise, string dynamik, DateTime DateGet, string cashAccountAfter, string cashAllocationAfter, string paperName)
        {
            decimal _cashAccount    = Convert.ToDecimal(cashAccountAfter);
            decimal _cashAllocation = Convert.ToDecimal(cashAllocationAfter);
            decimal _dynamik        = Convert.ToDecimal(dynamik);
            decimal _aqprise        = Convert.ToDecimal(aqprise);
            decimal _count          = Convert.ToDecimal(count);

            using (MySqlConnection conn = new MySqlConnection(ConnectionString)) //PurPrice = Dynamik = CashAmount
            {
                string query = "update `orderholders` set `Cash Account` = @CashAcc  where `Order` = @numer;" +

                               "insert into `activesfunding` (`OperationID`, `Order`, `Security`, `Isin`,`CashAmount`,`AqPrice`,`CountPaper`, `DateGetInst`,`Date`,`TitlePaper`) " +
                               "" +
                               "values(uuid(), @numer, @_security, @_isin, @_PurPrice, @_aqprice, @_count, @_dateGetInst, now(),@_title)";
                MySqlCommand comm = new MySqlCommand(query, conn);

                comm.Parameters.AddWithValue("@numer", id);
                comm.Parameters.AddWithValue("@CashAcc", _cashAccount.ToString("0.00", CultureInfo.GetCultureInfo("en-US")));
                comm.Parameters.AddWithValue("@_security", security);
                comm.Parameters.AddWithValue("@_isin", isin);
                comm.Parameters.AddWithValue("@_PurPrice", _dynamik.ToString("0.00", CultureInfo.GetCultureInfo("en-US")));
                comm.Parameters.AddWithValue("@_aqprice", _aqprise.ToString("0.00", CultureInfo.GetCultureInfo("en-US")));
                comm.Parameters.AddWithValue("@_count", _count.ToString("0.00", CultureInfo.GetCultureInfo("en-US")));
                comm.Parameters.AddWithValue("@_dateGetInst", DateGet.ToString("yyyy.MM.dd"));
                comm.Parameters.AddWithValue("@_title", paperName);
                try
                {
                    conn.Open();
                    comm.ExecuteNonQuery();
                    BOX.ShowInformation("Funding update Sucsessfull");
                }
                catch (Exception e) { BOX.ShowError(e.Message, e.Source); }
            }
        }
Example #8
0
        /// <summary>
        ///  Добавить строку о покупке
        /// </summary>
        /// <param name="NumbersOrders">Номер договора</param>
        /// <param name="OperationType">Тип операции - продажа.покупка.трансфер</param>
        /// <param name="Security">Тип ценной бумаги</param>
        /// <param name="isin">ISIN код</param>
        /// <param name="value">Валюта</param>
        /// <param name="Money">Всего денег потрачено</param>
        /// <param name="Count">Всего бумаг куплено</param>
        /// <param name="AqPrice">Стоимость одной бумаги</param>
        /// <param name="DatePicer">Дата совершения сделки</param>
        /// <param name="AdminID">Имя Фамилия админа</param>
        /// <param name="paperName">Название бумаги</param>
        /// <param name="cashafteroperm">Остаток после операции</param>
        internal static void AddNewInstruction(string NumbersOrders, string OperationType, string Security,
                                               string isin, string value, decimal Money, decimal Count,
                                               decimal AqPrice, string DatePicer, string AdminID, string paperName, decimal cashafteroperm)
        {
            using (MySqlConnection conn = new MySqlConnection(ConnectionString))
            {
                try
                {
                    string query = String.Format(@"insert into custodian.activesb  values (uuid(),'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}',now(),'{9}','{10}')",
                                                 NumbersOrders, OperationType, Security, isin, value,
                                                 Money.ToString("0.00", CultureInfo.GetCultureInfo("en-US")),
                                                 Count.ToString("0.00", CultureInfo.GetCultureInfo("en-US")),
                                                 AqPrice.ToString("0.00", CultureInfo.GetCultureInfo("en-Us")),
                                                 DatePicer, AdminID.Trim(sign), paperName);


                    MySqlCommand comm = new MySqlCommand(query, conn);
                    conn.Open();
                    comm.ExecuteNonQuery();
                    CashAccountReset(cashafteroperm, NumbersOrders);
                }
                catch (Exception ex)
                {
                    BOX.ShowError(ex.Message, ex.Source);
                }
            }
        }
Example #9
0
 internal static void GetISINTable()
 {
     using (MySqlConnection conn = new MySqlConnection(ConnectionString))
     {
         string           query   = "select * from custodian.isin_quote";
         MySqlDataAdapter adapter = new MySqlDataAdapter(query, conn);
         try
         {
             conn.Open();
             if (Storage.dataset.Tables.Contains("ISIN"))
             {
                 Storage.dataset.Tables.Remove("ISIN");
                 DataTable table = Storage.dataset.Tables.Add("ISIN");
                 adapter.Fill(table);
             }
             else
             {
                 DataTable table = Storage.dataset.Tables.Add("ISIN");
                 adapter.Fill(table);
             }
         }
         catch (Exception ex)
         {
             BOX.ShowError(ex.Message, ex.Source);
         }
     }
 }
Example #10
0
        public static DataTable ShowAllClient()
        {
            try
            {
                DataTable        clients = Storage.dataset.Tables.Add("Clients");
                MySqlDataAdapter adapter = new MySqlDataAdapter();

                using (MySqlConnection conn = new MySqlConnection(ConnectionString))
                {
                    string query = "SELECT * FROM orderholders";

                    try
                    {
                        MySqlCommand comm = new MySqlCommand(query, conn);
                        adapter.SelectCommand = comm;
                        conn.Open();
                        adapter.Fill(clients);
                    }
                    catch (Exception ex)
                    {
                        BOX.ShowError(ex.Message, ex.Source);
                    }
                    return(clients);
                }
            }
            catch (DuplicateNameException)
            {
                Storage.dataset.Tables.Remove("Clients");
                ShowAllClient();
            }
            return(Storage.dataset.Tables["Clients"]);
        }
Example #11
0
        internal static void UpdateISIN()
        {
            using (MySqlConnection conn = new MySqlConnection(ConnectionString))
            {
                MySqlDataAdapter adapter    = new MySqlDataAdapter();
                string           queryUpp   = "update custodian.isin_quote set `Quote`= @Quote, `Title`= @Title where `ISIN`=@ISIN";
                MySqlCommand     updatecomm = new MySqlCommand(queryUpp, conn);

                updatecomm.Parameters.Add(@"Quote", MySqlDbType.VarChar, 10, "Quote");
                updatecomm.Parameters.Add(@"title", MySqlDbType.VarChar, 10, "Title");

                MySqlParameter parametr = updatecomm.Parameters.Add(@"ISIN", MySqlDbType.VarChar, 10, "ISIN");
                parametr.SourceVersion = DataRowVersion.Original;
                try
                {
                    adapter.UpdateCommand = updatecomm;
                    conn.Open();
                    adapter.Update(Storage.dataset.Tables["ISIN"]);
                    BOX.ShowInformation("ISIN Parameters successful update!");
                }
                catch (Exception ex)
                {
                    BOX.ShowError(ex.Message, ex.Source);
                }
            }
        }
        /// <summary>
        /// Возвращает коллекцю строк с полными именами тех активов, чей риск ниже или равен принятому и которые не входят в уже имеющиеся
        /// </summary>
        /// <param name="riscMax"></param>
        /// <returns></returns>
        public List <string> RiscDivide(int riscMax, List <string> currentGood)
        {
            try
            {
                List <string> GoodNamesList = new List <string>();

                foreach (Case cs in cases)
                {
                    if (cs.RiscLevel <= riscMax)
                    {
                        if (!currentGood.Contains(cs.CompleteClassName))
                        {
                            GoodNamesList.Add(cs.CompleteClassName);
                        }
                    }
                }
                return(GoodNamesList);
            }



            catch (Exception ex)
            {
                BOX.ShowError(ex.Message, ex.Source);
            }
            return(null);
        }
Example #13
0
        private void Parse()
        {
            try
            {
                Parser pars = new Parser();
                pars.GetValuesFromSber();

                List <decimal> _values  = Parser.Values;
                string         GBPtoUSD = String.Format("1 GBP = " + "{0:0.00}", _values[0] / _values[1]);
                ValuesTOUSD.Add(Convert.ToDecimal(_values[0] / _values[1]));

                string EURtoUSD = String.Format("1 EUR = " + "{0:0.00}", _values[2] / _values[1]);
                ValuesTOUSD.Add(Convert.ToDecimal(_values[2] / _values[1]));

                string SGDtoUSD = String.Format("1 SGD = " + "{0:0.00}", _values[3] / _values[1]);
                ValuesTOUSD.Add(Convert.ToDecimal(_values[3] / _values[1]));

                string AUDtoUSD = String.Format("1 SGD = " + "{0:0.00}", _values[4] / _values[1]);
                ValuesTOUSD.Add(Convert.ToDecimal(_values[4] / _values[1]));

                Dispatcher.BeginInvoke
                    (System.Windows.Threading.DispatcherPriority.Normal, (ThreadStart) delegate()
                {
                    ParseCurses.Content = GBPtoUSD + " USD \r\n" + EURtoUSD + " USD \r\n" + SGDtoUSD + " USD\r\n" + AUDtoUSD + "USD";
                }
                    );
            }
            catch (Exception ex)
            {
                BOX.ShowError(ex.Message, ex.Source);
            }
        }
Example #14
0
        /// <summary>
        /// Получить таблицу с данными клиента
        /// </summary>
        /// <param name="log">Логин</param>
        /// <param name="pass">Пароль</param>
        /// <returns></returns>
        internal static DataTable GetClientInfo(string log, string pass)
        {
            using (MySqlConnection conn = new MySqlConnection(ConnectionString))
            {
                string query = @"select * from order_holders where `login` = @login and `password` = @pass;";

                MySqlDataAdapter adapter = new MySqlDataAdapter();
                MySqlCommand     comm    = new MySqlCommand(query, conn);
                comm.Parameters.AddWithValue("@login", log);
                comm.Parameters.AddWithValue("@pass", pass);
                adapter.SelectCommand = comm;
                try
                {
                    DataTable table = Storage.datasetKlient.Tables.Add("ClientInfo");
                    conn.Open();
                    adapter.Fill(table);
                    ClientFundingSumm(table);
                    ClientCashAllPluss(table.Rows[0][6].ToString()); //Передает идентификатор клиента (номер договора)  в ClientCashAllPluss
                    return(table);
                }
                catch (DuplicateNameException)
                {
                    Storage.datasetKlient.Tables.Remove("ClientInfo");
                    GetClientInfo(log, pass);
                }
                catch (MySqlException) { BOX.ShowInformation("Internet Connection Failed"); }
                catch (Exception ex)
                {
                    //BOX.ShowError(er.Message, er.Source);
                    Logger.WriteLog(ex.Message, ex.Source);
                    return(null);
                }
            }
            return(null);
        }
Example #15
0
        internal static List <string> GetQuoteForISIN(string ISIN)
        {
            List <string> Quote = new List <string>();

            using (MySqlConnection conn = new MySqlConnection(ConnectionString))
            {
                string       query = "Select `Quote`,`Title` from custodian.isin_quote where `ISIN` = @_isin;";
                MySqlCommand comm  = new MySqlCommand(query, conn);
                comm.Parameters.AddWithValue(@"_isin", ISIN);
                try
                {
                    conn.Open();
                    MySqlDataReader reader = comm.ExecuteReader();
                    reader.Read();
                    if (!reader.HasRows)
                    {
                        Quote.Add("ISIN not Found");
                    }
                    else
                    {
                        Quote.Add(reader.GetValue(0).ToString());
                        Quote.Add(reader.GetValue(1).ToString());
                    }
                }
                catch (MySqlException)
                {
                    BOX.ShowError("Connection Error", "Custodian");
                }
            }
            return(Quote);
        }
Example #16
0
        internal static void AddNewSale(string OrderNumber, decimal CountToSale, decimal CashAccountNew,
                                        string Isin, string Title, string DateGetInst, string Admin, decimal AqPrise)
        {
            string thisAdmin = Admin.Trim(sign);

            using (MySqlConnection conn = new MySqlConnection(ConnectionString))
            {
                string       query = "insert into custodian.activessale values(uuid(),@_orderN, @_isin, @_title, @_countPapeToSale, @_AqPrise, @_dateGInst,now(),@_admin)";
                MySqlCommand comm  = new MySqlCommand(query, conn);
                string       convertDecimalCountSale = CountToSale.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));
                string       convertDecimalAqPrise   = AqPrise.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));

                comm.Parameters.AddWithValue("@_orderN", OrderNumber);
                comm.Parameters.AddWithValue("@_isin", Isin);
                comm.Parameters.AddWithValue("@_title", Title);
                comm.Parameters.AddWithValue("@_countPapeToSale", convertDecimalCountSale);
                comm.Parameters.AddWithValue("@_AqPrise", convertDecimalAqPrise);
                comm.Parameters.AddWithValue("@_dateGInst", DateGetInst);
                comm.Parameters.AddWithValue("@_admin", thisAdmin);
                try
                {
                    conn.Open();
                    comm.ExecuteNonQuery();
                    CashAccountReset(CashAccountNew, OrderNumber);
                }
                catch (Exception ex)
                {
                    BOX.ShowError(ex.Message, ex.Source);
                }
            }
            //CashAccountReset(CashAccountNew, OrderNumber);
        }
 private void CloseT(object sender, RoutedEventArgs e)
 {
     if (BOX.ShowQuestion("Do you realy want to close Application ?", "Exit") == true)
     {
         this.WindowState            = WindowState.Maximized;
         Settings1.Default.ReadMess += CounterMessages.ReadedNowSess;
         Settings1.Default.Save();
         Environment.Exit(0);
     }
 }
Example #18
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     this.Hide();
     if (BOX.ShowInformation(min) == true)
     {
         Settings1.Default.CurrentRiscProfil = min;
         userDAL.AddRiskTest(Storage.datasetKlient.Tables["ClientInfo"].Rows[0][6].ToString(), min);
         BOX.ShowInformation("Please, Restart the program to change took effect.");
     }
 }
Example #19
0
 private void exit(EventArgs e)
 {
     if (BOX.ShowQuestion("Are you wishct to exit now?", "Custodian") == MessageBoxResult.Yes)
     {
         Storage.datasetAdmin.Tables.Clear();
         MainWindow M = new MainWindow();
         this.Hide();
         M.Show();
         adminDAL.EndSession();
     }
 }
Example #20
0
        private void newTasks(object sender, System.EventArgs e)
        {
            newTasksTable = adminDAL.GetOnlyNewTasks();
            int row = newTasksTable.Rows.Count;

            if (currTasks != row)
            {
                int rasniza = (currTasks - row);
                currTasks = newTasksTable.Rows.Count;
                BOX.ShowInformation("You Have are " + rasniza.ToString() + " new Tasks!");
            }
        }
Example #21
0
        public void GetValuesFromSber()
        {
            try
            {
                string   data    = string.Empty;
                string   url     = "http://www.cbr.ru/currency_base/D_print.aspx?date_req=";
                string   html    = string.Empty;
                string[] pattern =
                {
                    "Австралийский доллар</td>\r\n<td>(.*)</td>",
                    "Фунт стерлингов Соединенного королевства</td>\r\n<td>(.*)</td>",
                    "Доллар США</td>\r\n<td>(.*)</td>",
                    "Евро</td>\r\n<td>(.*)</td>",
                    "Сингапурский доллар</td>\r\n<td>(.*)</td>"
                };

                DateTime today = DateTime.Now;
                data = today.Date.ToShortDateString();
                url += data;
                HttpWebRequest  myHttpWebRequest  = (HttpWebRequest)HttpWebRequest.Create(url);
                HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
                StreamReader    myStreamReader    = new StreamReader(myHttpWebResponse.GetResponseStream());
                html = myStreamReader.ReadToEnd();
                Match match;

                for (int i = 0; i < pattern.Length; i++)
                {
                    match = Regex.Match(html, pattern[i]);
                    string result = match.Groups[1].ToString();
                    Values.Add(Convert.ToDecimal(result));
                }
            }
            catch (WebException)
            {
                Values.Add(1);
                Values.Add(1);
                Values.Add(1);
                Values.Add(1);
                Values.Add(1);
                BOX.ShowInformation("The CB server found an error (xxx). File not available. Please contact us for more information.");
            }
            catch (Exception ex)
            {
                Values.Add(1);
                Values.Add(1);
                Values.Add(1);
                Values.Add(1);
                Values.Add(1);

                BOX.ShowInformation(ex.Message);
            }
        }
        public static void AddNewCashAccount(string order, string USDNew, string EURNew, string GBPNew, string SGDNew, string AUDNew, string Date, string adviser, string AddUSD, string AddEUR, string AddGBP, string AddSGD, string AddAUD)
        {
            decimal newusd = Convert.ToDecimal(USDNew);
            decimal neweur = Convert.ToDecimal(EURNew);
            decimal newgbp = Convert.ToDecimal(GBPNew);
            decimal newsgd = Convert.ToDecimal(SGDNew);
            decimal newaud = Convert.ToDecimal(AUDNew);

            decimal Addnewusd = Convert.ToDecimal(AddUSD);
            decimal Addneweur = Convert.ToDecimal(AddEUR);
            decimal Addnewgbp = Convert.ToDecimal(AddGBP);
            decimal Addnewsgd = Convert.ToDecimal(AddSGD);
            decimal Addnewaud = Convert.ToDecimal(AddAUD);

            string USD = newusd.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));
            string EUR = neweur.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));
            string GBP = newgbp.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));
            string SGD = newsgd.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));
            string AUD = newaud.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));

            string addUSD = Addnewusd.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));
            string addEUR = Addneweur.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));
            string addGBP = Addnewgbp.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));
            string addSGD = Addnewsgd.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));
            string addAUD = Addnewaud.ToString("0.00", CultureInfo.GetCultureInfo("en-US"));

            using (MySqlConnection conn = new MySqlConnection(ConnectionString))
            {
                string updatecomm = $"update orderholders set `Cash Account_USD` = '{USD}',  `Cash Account_EUR`= '{EUR}', `Cash Account_GBP`= '{GBP}' ,`Cash Account_SGD`= '{SGD}',`Cash Account_AUD`= '{AUD}' where `Order`= '{order}'; ";

                string insertcomm = $"insert into `addcashaccountoperations` values(uuid(),'{order}', {addUSD},{addEUR},{addGBP},{addSGD},{addAUD}, '{Date}', now(),'{adviser}'); ";

                string       query = updatecomm + insertcomm;
                MySqlCommand comm  = new MySqlCommand(query, conn);
                try
                {
                    conn.Open();
                    comm.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    BOX.ShowError(ex.Message, ex.Source);
                }
            }
        }
Example #23
0
        // ---------------------ИМЯ АДМИНИСТРАТОРА ......................
        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                string AdminName = Storage.datasetAdmin.Tables[0].Rows[0][2].ToString() + " " + Storage.datasetAdmin.Tables[0].Rows[0][1].ToString();
                lbl_Name.Content = "Signed in : " + AdminName;
            }
            catch (Exception ex)
            {
                BOX.ShowError(ex.Message, ex.Source);
            }
            Thread ValueCursParce = new Thread(Parse);

            ValueCursParce.Start();

            adminDAL.StartSession(lbl_Name.Content.ToString());
            Storage.EnteredUserID = Storage.datasetAdmin.Tables["AdminInfo"].Rows[0][0].ToString();
        }
        /// <summary>
        /// ОТПРАВИТЬ СООБЩЕНИЕ КЛИЕНТУ ОТ АДМИНА(МАНАГЕРА)
        /// </summary>
        /// <param name="admin"></param>
        /// <param name="client"></param>
        /// <param name="text"></param>
        internal static void SendToClientMessFromAdmin(string admin, string client, string text)
        {
            string query = $"insert into messengers  values('{admin}','{client}','{text}',now()); ";

            using (MySqlConnection conn = new MySqlConnection(ConnectionString))
            {
                MySqlCommand comm = new MySqlCommand(query, conn);
                try
                {
                    conn.Open();
                    comm.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    BOX.ShowError(ex.Message, ex.Source);
                }
            }
        }
Example #25
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         text        = text_bx.Text;
         subjectCurl = subjct_cmb.SelectedItem.ToString();
         subject     = subjectCurl.Remove(0, subjectCurl.IndexOf(':') + 1);
         MailSendMessage mail = new MailSendMessage(text, subject);
         mail.SendMessage();
         BOX.ShowInformation("Message was sended");
         text_bx.Text             = string.Empty;
         subjct_cmb.SelectedIndex = -1;
     }
     catch (NullReferenceException)
     {
         BOX.ShowInformation("Subject are not Select");
     }
 }
Example #26
0
 internal static void EndSession()
 {
     using (MySqlConnection conn = new MySqlConnection(ConnectionString))
     {
         string       query = @"update custodian.loggs set `SessionEnd` =  now() where `SessionID` = @SessionUUID ";
         MySqlCommand comm  = new MySqlCommand(query, conn);
         comm.Parameters.AddWithValue("@SessionUUID", Storage.sessionGuid);
         try
         {
             conn.Open();
             comm.ExecuteNonQuery();
         }
         catch (Exception ex)
         {
             BOX.ShowError(ex.Message, ex.Source);
         }
     }
 }
 /// <summary>
 /// Возвращает кортеж из уровня риска и имени класса по подклассу
 /// </summary>
 /// <param name="SubClass"></param>
 /// <returns></returns>
 public Tuple <int, string> IntegerDivide(string SubClass)
 {
     try
     {
         foreach (Case ThisCase in cases)
         {
             if (SubClass.Contains(ThisCase.SubClass))
             {
                 return(new Tuple <int, string>(ThisCase.RiscLevel, ThisCase.Class));
             }
         }
         return(null);
     }
     catch (Exception ex)
     {
         BOX.ShowError(ex.Message, ex.Source);
         return(null);
     }
 }
 internal static void ResetCashAccount_Withdraw(string id, decimal summ, decimal ost, string DataGetIns)
 {
     using (MySqlConnection conn = new MySqlConnection(ConnectionString))
     {
         string       query = "update `orderholders` set `Cash Account` = @ost where `Order` = @numer;" + "insert into `activeswichdraw` values(uuid(), @numer, @summ, @DateInstr, now())";
         MySqlCommand comm  = new MySqlCommand(query, conn);
         comm.Parameters.AddWithValue("@ost", ost);
         comm.Parameters.AddWithValue("@numer", id);
         comm.Parameters.AddWithValue("@summ", summ);
         comm.Parameters.AddWithValue("@DateInstr", DataGetIns);
         try
         {
             conn.Open();
             comm.ExecuteReader();
             BOX.ShowInformation("Whithdraw Operation Added sucsessfull");
         }
         catch (Exception ex) { BOX.ShowError(ex.Message, ex.Source); }
     }
 }
 /// <summary>
 /// Возвращает кортеж из уровня риска и имени класса по подклассу
 /// </summary>
 /// <param name="PassesSubClass"></param>
 /// <returns></returns>
 public Tuple <int, string> IntegerDivide(string PassesSubClass)
 {
     PassesSubClass = (PassesSubClass == "cash") ? "Cash" : PassesSubClass;
     try
     {
         foreach (Case ThisCase in cases)
         {
             if (PassesSubClass.Contains(ThisCase.FullSubClassName))
             {
                 return(new Tuple <int, string>(ThisCase.RiscLevel, ThisCase.FullClassName));
             }
         }
         return(null);
     }
     catch (Exception ex)
     {
         BOX.ShowError(ex.Message, ex.Source);
         return(null);
     }
 }
Example #30
0
 /// <summary>
 /// Сохраняет новый пароль пользователя
 /// </summary>
 /// <param name="order">Номер договора</param>
 /// <param name="nPass">Новый пароль</param>
 internal static void SaveNewKlientPass(string order, string nPass)
 {
     using (MySqlConnection conn = new MySqlConnection(ConnectionString))
     {
         string       Query = "update orderholders set `password` = @newPass where `order` = @Korder;";
         MySqlCommand comm  = new MySqlCommand(Query, conn);
         comm.Parameters.AddWithValue("@Korder", order);
         comm.Parameters.AddWithValue("@newPass", Hash.GetHash(nPass));
         try
         {
             conn.Open();
             comm.ExecuteNonQuery();
             BOX.ShowInformation("Your password has been successfully updated.");
         }
         catch (Exception ex)
         {
             Logger.WriteLog(ex.Message, ex.Source);
         }
     }
 }