private void ChangeVisibility() { if (!Certify.CheckName(tb_firstname.Text)) { firstname_state_icon.Kind = PackIconMaterialKind.CloseCircleOutline; } else { firstname_state_icon.Kind = PackIconMaterialKind.CheckCircleOutline; } if (!Certify.CheckName(tb_lastname.Text)) { lastname_state_icon.Kind = PackIconMaterialKind.CloseCircleOutline; } else { lastname_state_icon.Kind = PackIconMaterialKind.CheckCircleOutline; } if (!Certify.CheckPassword(tb_pw.Password)) { password_state_icon.Kind = PackIconMaterialKind.CloseCircleOutline; } else { password_state_icon.Kind = PackIconMaterialKind.CheckCircleOutline; } if (!Certify.CheckMail(tb_mail.Text)) { mail_state_icon.Kind = PackIconMaterialKind.CloseCircleOutline; } else { mail_state_icon.Kind = PackIconMaterialKind.CheckCircleOutline; } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { Account temp = MainWindow.account; tb_firstname.Text = temp.firstName; tb_lastname.Text = temp.lastName; tb_mail.Text = temp.email; lbl_mail.Content = temp.email; tb_password.Password = Certify.Decrypt(temp.password); TextRange textRange = new TextRange(tb_desc.Document.ContentStart, tb_desc.Document.ContentEnd); if (temp.description != null) { textRange.Text = temp.description; } if (temp.businessusage) { btn_upgrade.Visibility = Visibility.Hidden; lbl_abu.Visibility = Visibility.Visible; lbl_license.Content = (string)FindResource("bu_account"); lbl_lastpayment.Content = temp.lastpay.ToString("dd-MM-yyyy"); } else { lbl_lastpayment.Content = (string)FindResource("lifetime_license_account"); } lbl_name.Content = temp.firstName + " " + temp.lastName; }
private void RunStatement() { while (!threadHasToStop) { if (sqlStatementIsRunning) { sqlStatementIsRunning = false; try { SqlCommand command = cnn.CreateCommand(); command.CommandText = "select acc_id, firstname, lastname, email, password, businessusage, CONVERT(varchar, lastpayment, 105), description from accounts where email='" + mail + "';"; SqlDataReader reader; bool correctInformations = false; string accLine = ""; cnn.Open(); reader = command.ExecuteReader(); while (reader.Read()) { for (short i = 0; i < reader.FieldCount; i++) { if (i == 4 && Certify.Decrypt(reader.GetValue(i).ToString()) == password) { correctInformations = true; } accLine += reader.GetValue(i).ToString() + ';'; } } cnn.Close(); Dispatcher.Invoke(new Action(() => { progring.IsActive = false; if (correctInformations) { accountLine = accLine; MainWindow.account = new Account(accountLine); MainWindow mpw = new MainWindow(); mpw.Show(); this.Close(); } else { lbl_msg.Foreground = Brushes.Red; lbl_msg.Visibility = Visibility.Visible; } })); } catch (Exception ex) { } } } }
public async Task InitTests() { _client = new Certify(); // TODO : create API server instance instead of invoking directly if (_apiService == null) { _apiService = Process.Start(@"C:\Work\GIT\certify\src\Certify.Service\bin\Debug\net462\CertifySSLManager.Service.exe"); await Task.Delay(2000); } }
private void btn_save_Click(object sender, RoutedEventArgs e) { string accountString = "update accounts set "; bool updateable = true; if (tb_firstname.Text != "") { accountString += "firstname = '" + tb_firstname.Text + "', "; } else { updateable = false; } if (tb_lastname.Text != "") { accountString += "lastname = '" + tb_lastname.Text + "', "; } else { updateable = false; } if (tb_mail.Text != "") { accountString += "email = '" + tb_mail.Text + "'"; } else { updateable = false; } if (tb_password.Password != "") { if (tb_password.Password == tb_confpassword.Password) { accountString += ", password = '******'"; } } if (new TextRange(tb_desc.Document.ContentStart, tb_desc.Document.ContentEnd).Text != "'") { accountString += ", description = '" + new TextRange(tb_desc.Document.ContentStart, tb_desc.Document.ContentEnd).Text + "'"; } if (!worker_saveAccountSettings.IsBusy && updateable) { btn_save.IsEnabled = false; accountString += " where acc_id = " + MainWindow.account.id + ";"; worker_saveAccountSettings.RunWorkerAsync(accountString); } }
public MainWindow() { InitializeComponent(); this.ShowIconOnTitleBar = false; this.HamburgerMenuControl.SelectedIndex = 0; this.selectedIndex = 0; MainWindow.instance = this; cnn = new SqlConnection(connectionString); worker = new BackgroundWorker(); worker.DoWork += Worker_AddProjectToDatabase; Properties.Settings.Default.RememberUserName = Certify.Encrypt(MainWindow.account.email); Properties.Settings.Default.Save(); }
public async Task <FileUploadDetails> Post(string memberId) { // file path var fileuploadPath = HttpContext.Current.Server.MapPath("~/UploadFile/sertifikat"); // var multiFormDataStreamProvider = new MultiFileUploadProvider(fileuploadPath); // Read the MIME multipart asynchronously await Request.Content.ReadAsMultipartAsync(multiFormDataStreamProvider); string uploadingFileName = multiFormDataStreamProvider .FileData.Select(x => x.LocalFileName).FirstOrDefault(); var nameFile = Path.GetFileName(uploadingFileName); // var random = RandomString(10); // System.Diagnostics.Debug.WriteLine(nameFile); using (SignatureDBEntities entities = new SignatureDBEntities()) { Certify certi = new Certify(); certi.certificate = nameFile; certi.memberId = memberId; entities.Certifys.Add(certi); entities.SaveChanges(); int idSign = certi.id; return(new FileUploadDetails { FilePath = uploadingFileName, FileName = Path.GetFileName(uploadingFileName), FileLength = new FileInfo(uploadingFileName).Length, FileCreatedTime = DateTime.Now.ToLongDateString(), IdSign = idSign }); } }
public LoginWindow() { InitializeComponent(); this.ShowIconOnTitleBar = false; if (Properties.Settings.Default.RememberUserName != null && Properties.Settings.Default.RememberUserName != "") { tb_mail.Text = Certify.Decrypt(Properties.Settings.Default.RememberUserName); tb_pw.Focus(); } else { tb_mail.Focus(); } cnn = new SqlConnection(connectionString); thread = new Thread(RunStatement); thread.Start(); }
private void RunStatement() { while (!threadHasToStop) { if (sqlStatementIsRunning) { sqlStatementIsRunning = false; try { bool registered = false; SqlCommand command = cnn.CreateCommand(); command.CommandText = "select email from accounts;"; SqlDataReader reader; cnn.Open(); reader = command.ExecuteReader(); while (reader.Read()) { for (int i = 0; i < reader.FieldCount; i++) { if (mail == reader.GetValue(i).ToString()) { registered = true; } } } if (!registered) { reader.Close(); command.CommandText = "insert into accounts(firstname, lastname, email, password, businessusage, lastpayment, description) values('" + firstname + "', '" + lastname + "', '" + mail + "', '" + Certify.Encrypt(password) + "', '" + businessusage + "', CONVERT (date, GETDATE()), null);"; command.ExecuteNonQuery(); Dispatcher.Invoke(new Action(() => { lbl_msg.Content = (string)FindResource("msg_succ"); lbl_msg.Foreground = Brushes.Green; lbl_msg.Visibility = Visibility.Visible; progring.IsActive = false; threadHasToStop = true; })); } } catch (Exception ex) { } } } }