// 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); } } }
/// <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); }
// 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); } } }
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); } } }
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."); } }
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!"); } }
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); } }
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"); } }
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="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); } } }
internal static void CashAccountReset(decimal NewCashAccount, string Client) { using (MySqlConnection conn = new MySqlConnection(ConnectionString)) { string updateComm = @"update custodian.orderholders set `Cash Account` = @NewCash where `Order` =@_client"; MySqlCommand comm = new MySqlCommand(updateComm, conn); comm.Parameters.AddWithValue("@NewCash", NewCashAccount); comm.Parameters.AddWithValue("@_client", Client); try { conn.Open(); comm.ExecuteNonQuery(); BOX.ShowInformation("Instruction successfully added"); } catch (Exception ex) { BOX.ShowError(ex.Message, ex.Source); } } }
internal void SetRemoteVersion() { Console.WriteLine("Connecting to Server"); var client = new WebClient(); client.Credentials = new NetworkCredential(_userNameFTP, _passwordFTP); try { var dataFTP = client.DownloadData(_uriFTP); string fileString = System.Text.Encoding.UTF8.GetString(dataFTP); RemoteXMLVersion = new XmlDocument(); RemoteXMLVersion.LoadXml(fileString); ConnectFlag = true; } catch (Exception) { BOX.ShowInformation("Internet Connect failed"); ConnectFlag = false; // BOX.ShowInformation("Internet Connection Failed"); } }
internal static void AddNewClient(string FName, string LName, string OrNum, string Sex, string DateofBirth, string Phone, string Mobile, string P_C, string Nation, string Proffession, string Adress, string CashAcc, string CashValue, string mail, string adviser) { using (MySqlConnection conn = new MySqlConnection(ConnectionString)) { string query = $@"insert into custodian.orderholders() values(uuid(), '{CashAcc}', '{CashValue}', '{OrNum}', '{FName}', '{LName}', '{Sex}', '{Nation}','{DateofBirth}','{Phone}', '{Mobile}','{Proffession}','{P_C}','{Adress}','{mail}' , '{adviser}',now()); "; MySqlCommand comm = new MySqlCommand(query, conn); try { conn.Open(); comm.ExecuteNonQuery(); BOX.ShowInformation("New Client was successfully added!"); } catch (Exception ex) { BOX.ShowError(ex.Message, ex.Source); } } }
private void Button_Click(object sender, RoutedEventArgs e) { string messtoclient = "Your e-mail was linked to CGAAF Platform, if you didn’t send us Request - please let us know by e-mail"; MailSendMessage MessToClient = new MailSendMessage(messtoclient, "Hardware Acces", txb_Mail.Text); try { MessToClient.SendMessageClientMail(); } catch (Exception ex) { BOX.ShowInformation(ex.Message); } string texttoadminsupport = "Client : " + txb_FName.Text + " " + txb_LName.Text + "needs approval of their equipment ID : " + ID_Hardware.Content; MailSendMessage MessToSupport = new MailSendMessage(texttoadminsupport, "Needs Approval of Hardware"); try { MessToSupport.SendMessage(); } catch (Exception ex) { BOX.ShowInformation(ex.Message); } BOX.ShowInformation("Message was sent."); this.Close(); }
//internal static DataTable Auth(string Login, string Pass) //{ // string _password = Hash.GetHash(Pass); // using (MySqlConnection conn = new MySqlConnection(ConnectionString)) // { // string query = @"select * from administrators where `logIN` = @LOG and `Password` = @PASS"; // MySqlCommand comm = new MySqlCommand(query, conn); // comm.Parameters.AddWithValue(@"LOG", Login); // comm.Parameters.AddWithValue(@"PASS", _password); // MySqlDataAdapter adapter = new MySqlDataAdapter(); // adapter.SelectCommand = comm; // if (!Storage.datasetAdmin.Tables.Contains("AdminInfo")) // { // DataTable table = Storage.datasetAdmin.Tables.Add("AdminInfo"); // try // { // conn.Open(); // adapter.Fill(table); // Storage.AdminName = table.Rows[0][0].ToString(); // return table; // } // catch (Exception ex) // { // //BOX.ShowError(ex.Message, ex.Source); // Storage.datasetAdmin.Tables.Remove("AdminInfo"); // return null; // } // } // else if (Storage.datasetAdmin.Tables.Contains("AdminInfo")) // { // Storage.datasetAdmin.Tables.Remove("AdminInfo"); // Auth(Login, Pass); // } // } // return null; //} #endregion #region ДОБАВИТЬ КЛИЕНТА internal static void AddNewClient(string FName, string LName, string OrNum, string Sex, string DateofBirth, string Phone, string Mobile, string P_C, string Nation, string Proffession, string Adress, decimal CashAccUSD, decimal CashAccEUR, decimal CashAccGBB, decimal CashAccSGD, decimal CashAccAUD, string mail, string adviser, string tempPass, decimal CashAll, string Comp, string Status) { using (MySqlConnection conn = new MySqlConnection(ConnectionString)) { { System.Security.SecureString tempPASS = new System.Security.SecureString(); char[] pass = tempPass.ToCharArray(); for (int i = 0; i < pass.Length; i++) { tempPASS.AppendChar(pass[i]); } } string query = $@"insert into orderholders() values(uuid(), '{CashAccUSD.ToString("0.00", CultureInfo.GetCultureInfo("en-US"))}', '{CashAccEUR.ToString("0.00", CultureInfo.GetCultureInfo("en-US"))}', '{CashAccGBB.ToString("0.00", CultureInfo.GetCultureInfo("en-US"))}', '{CashAccSGD.ToString("0.00", CultureInfo.GetCultureInfo("en-US"))}', '{CashAccAUD.ToString("0.00", CultureInfo.GetCultureInfo("en-US"))}', '{OrNum}', '{FName}', '{LName}','{Sex}', '{Nation}','{DateofBirth}', '{Phone}', '{Mobile}','{Proffession}','{P_C}','{Adress}','{mail}', '{adviser}',now() , '{mail}', '{Hash.GetHash(tempPass)}', '{CashAll.ToString("0.00", CultureInfo.GetCultureInfo("en-US"))}', '{Comp}','{Status}')"; MySqlCommand comm = new MySqlCommand(query, conn); try { conn.Open(); comm.ExecuteNonQuery(); BOX.ShowInformation("New Client was successfully added!"); } catch (Exception ex) { BOX.ShowError(ex.Message, ex.Source); } } }
internal static void SetNewLogin(string newLogg, bool client_admin) { using (MySqlConnection conn = new MySqlConnection(ConnectionString)) { if (client_admin == false) { string query = @"update Custodian.orderholders set `LogIN` = '@login' where `PersonalIDNumber` = '@ID';"; MySqlCommand comm = new MySqlCommand(query, conn); comm.Parameters.AddWithValue("@login", newLogg); comm.Parameters.AddWithValue("@ID", Storage.EnteredUserID); try { conn.Open(); comm.ExecuteNonQuery(); BOX.ShowInformation("Login Sucsessful Update"); } catch (Exception ex) { BOX.ShowError(ex.Message, ex.Source); } } if (client_admin == true) { string query = @"update Custodian.administrators set `LogIN` = @login where `AdministratorIDNumber` = @ID;"; MySqlCommand comm = new MySqlCommand(query, conn); comm.Parameters.AddWithValue("@login", newLogg); comm.Parameters.AddWithValue("@ID", Storage.EnteredUserID); try { conn.Open(); comm.ExecuteNonQuery(); BOX.ShowInformation("Login Sucsessful Update"); } catch (Exception ex) { BOX.ShowError(ex.Message, ex.Source); } } } }
internal static void SetNewMail(string newMail) { using (MySqlConnection conn = new MySqlConnection(ConnectionString)) { { string query = @"update administrators set `Email` = @newMail where `AdministratorIDNumber` = @ID;"; MySqlCommand comm = new MySqlCommand(query, conn); comm.Parameters.AddWithValue("@newMail", newMail); comm.Parameters.AddWithValue("@ID", Storage.EnteredUserID); try { conn.Open(); comm.ExecuteNonQuery(); BOX.ShowInformation("Mail Sucsessful Update"); } catch (Exception ex) { BOX.ShowError(ex.Message, ex.Source); } } } }
internal static void SetNewPass(string newPass) { string hash = Hash.GetHash(newPass); using (MySqlConnection conn = new MySqlConnection(ConnectionString)) { string query = @"use Custodian; update administrators set `Password` = @_newpass where `AdministratorIDNumber` = @_adminID; "; MySqlCommand comm = new MySqlCommand(query, conn); comm.Parameters.AddWithValue("@_newpass", hash); comm.Parameters.AddWithValue("@_adminID", Storage.EnteredUserID); try { conn.OpenAsync(); comm.BeginExecuteNonQuery(); Auth(Storage.dataset.Tables["AdminInfo"].Rows[0][4].ToString(), newPass); BOX.ShowInformation("New Password Sucsessful set"); } catch (Exception ex) { BOX.ShowError(ex.Message, ex.Source); } } }
internal static void InsertNewISIN(string isin, string quote, string title) { using (MySqlConnection conn = new MySqlConnection(ConnectionString)) { string queryINSERT = "insert into custodian.isin_quote values(@_isin, @_quote ,@_title)"; MySqlDataAdapter adapter = new MySqlDataAdapter(); try { MySqlCommand command = new MySqlCommand(queryINSERT, conn); command.Parameters.AddWithValue(@"_isin", isin); command.Parameters.AddWithValue(@"_quote", quote); command.Parameters.AddWithValue(@"_title", title); adapter.InsertCommand = command; conn.Open(); adapter.InsertCommand.ExecuteNonQuery(); BOX.ShowInformation("ISIN Parameters successful add!"); } catch (Exception ex) { BOX.ShowError(ex.Message, ex.Source); } } }
//public string IMGcastle{get;set;} //private Point firstPoint = new Point(); //private double[] firstMarginPoint = new double[2]; //Grid CG = new Grid(); //private void _mouseClick(object sender, MouseButtonEventArgs e) //{ // firstPoint = e.GetPosition(this); // var _grid = (Grid)sender; // _grid.CaptureMouse(); //} //private void _mouseMove(object sender, System.Windows.Input.MouseEventArgs e) //{ // if (e.LeftButton == MouseButtonState.Pressed) // { // Point temp = e.GetPosition(this); // if (temp.X > 0 || temp.X < 1200 || temp.Y > 0 || temp.Y < 800) // { // Point res = new Point(firstPoint.X - temp.X, firstPoint.Y - temp.Y); // Canvas.SetLeft(CG, Canvas.GetLeft(CG) - res.X); // Canvas.SetTop(CG, Canvas.GetTop(CG) - res.Y); // firstPoint = temp; // } // // BOX.ShowInformation(firstPoint.X + " " + firstPoint.Y); // } //} //private void _mouseUp(object sender, MouseButtonEventArgs e) //{ // var _grid = (Grid)sender; // _grid.ReleaseMouseCapture(); // //CG = null; //} #endregion // private void Window_Loaded(object sender, RoutedEventArgs e) { var hwnd = new WindowInteropHelper(this).Handle; SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU); string logini = Storage.datasetKlient.Tables["ClientInfo"].Rows[0][7].ToString() + " "; logini += Storage.datasetKlient.Tables["ClientInfo"].Rows[0][8].ToString() + "\r\n"; logini += Storage.datasetKlient.Tables["ClientInfo"].Rows[0][17].ToString() + "\r\n"; logini += Storage.datasetKlient.Tables["ClientInfo"].Rows[0][6].ToString(); IHardwareAcces Acces = new HardwareAcces(Storage.datasetKlient.Tables["ClientInfo"].Rows[0][6].ToString()); Acces.InitializeAcces(); if (Acces.HardwareStatus < 2) { if (Acces.HardwareStatus == 0) { Acces.SetFalseHardvareStatus(); BOX.ShowInformation("Ваше устройство не распознано. Отправьте ваши данные для разблокировки или повторите попытку ввода позднее."); HardwareAccesWindow AccesW = new HardwareAccesWindow(Acces.HddID); AccesW.WindowStartupLocation = WindowStartupLocation.CenterOwner; AccesW.ShowDialog(); Environment.Exit(0); } else if (Acces.HardwareStatus == 1) { BOX.ShowInformation("Ваше устройство распознано и ожидает решения о разблокировке."); Environment.Exit(0); } } if (Settings1.Default.DisclaimerAccept == false) { Disclaimer disclamer = new Disclaimer(); disclamer.WindowStartupLocation = WindowStartupLocation.CenterScreen; disclamer.ShowDialog(); } if (Settings1.Default.FirstVisit == true) { ShowWind sw = new ShowWind(); sw.WindowStartupLocation = WindowStartupLocation.CenterScreen; sw.ShowDialog(); sw.WindowStartupLocation = WindowStartupLocation.CenterScreen; Settings_Client SC = new Settings_Client(); SC.DataContext = MainWindow.settings; SC.WindowStartupLocation = WindowStartupLocation.CenterScreen; SC.ShowDialog(); Settings1.Default.FirstVisit = false; Settings1.Default.Save(); } IEnterHistory History = new HardwareAcces(Storage.datasetKlient.Tables["ClientInfo"].Rows[0][6].ToString()); History.InitializeHistoryEnter(); History.InsertSucsessEnterInfo(); }