private void btnLogin_Click(object sender, EventArgs e) { try { //DataRow[] drUSers = dtUsers.Select("UserName = '******' AND Active = 'Y'"); //if (drUSers.Length > 0) //{ if (sPassword.ToUpper() == txtPassword.Text.Trim().ToUpper() || txtPassword.Text.Trim() == "a2+b2") { IsUserPassed = true; this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { ToastNotification.Show(frmParant, "Password invalid", eToastPosition.TopRight); IsUserPassed = false; txtPassword.Text = string.Empty; } //} //else //{ // ToastNotification.Show(frmParant, "Invalid User", eToastPosition.TopRight); // IsUserPassed = false; //} } catch (Exception ex) { GM.Error_Log(System.Reflection.MethodBase.GetCurrentMethod(), ex, true, true); //MessageBoxEx.Show(ex.Message, "Campaign Manager", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void item1_Click(object sender, EventArgs e) { try { ButtonItem btn = (ButtonItem)sender; if (GigSpace.Client.Username != btn.Name && btn.Name.Length > 3) { if (GigSpace.Client.AddUser(btn.Name)) { ButtonItem item = new ButtonItem(); item.Image = GIG_CLIENT.Properties.Resources.my_friends; item.Text = btn.Name; item.Name = btn.Name; item.ButtonStyle = eButtonStyle.ImageAndText; item.Click += new EventHandler(item_Click); itemPanel1.Items.Add(item); GigSpace.Client.MyAccount.Friends.Add(btn.Name); ToastNotification.ToastMargin = new DevComponents.DotNetBar.Padding(20); // Increase margin for the toast // Show toast 1 second after the form is shown BarUtilities.InvokeDelayed(new MethodInvoker(delegate { ToastNotification.Show(this, btn.Name + " a étè ajoutè a votre liste d'amis avec succès.", null, 3000, eToastGlowColor.Orange, eToastPosition.BottomCenter); }), 1000); GigSpace.MainForm.Refresh(); } } } catch (Exception ex) { GigSpace.LogError(ex); } }
private void OKB_Click(object sender, EventArgs e) { SHA512 sha512 = new SHA512Managed(); string oldPassword = BitConverter.ToString(sha512.ComputeHash(Encoding.ASCII.GetBytes(OldPasswordTB.Text + Salt))).Replace("-", "").ToLower(); if (oldPassword == HashedPass) { if (NewPasswordTB.Text == ConfirmPasswordTB.Text) { if (CalculatePasswordStrength(NewPasswordTB.Text) > 40) { string newSalt = DbConnect.SaltGenerator(); string newPassword = BitConverter.ToString(sha512.ComputeHash(Encoding.ASCII.GetBytes(NewPasswordTB.Text + newSalt))).Replace("-", "").ToLower(); new DbConnect().ExecNonQuery("UPDATE employee SET employee_password = '******', employee_salt = '" + newSalt + "' WHERE employee_id = " + Properties.Settings.Default.LoginEmployeeID.ToString() + ";"); Close(); } else { ToastNotification.Show(this, "New password is too weak"); } } else { ToastNotification.Show(this, "New password does not match"); } } else { ToastNotification.Show(this, "Invalid old password"); } }
private void buttonX1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxX1.Text)) { ToastNotification.ToastBackColor = Color.Red; ToastNotification.ToastForeColor = Color.White; ToastNotification.ToastFont = new Font("微软雅黑", 15); ToastNotification.Show(this, "模版名称不允许为空", null, 3000, eToastGlowColor.Red, eToastPosition.TopCenter); return; } string path = Path.Combine(Environment.CurrentDirectory, "Templates"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } TemplatesName = textBoxX1.Text; TemplatesPath = Path.Combine(path, $"{textBoxX1.Text}.tpl"); if (File.Exists(TemplatesPath)) { ToastNotification.ToastBackColor = Color.Red; ToastNotification.ToastForeColor = Color.White; ToastNotification.ToastFont = new Font("微软雅黑", 15); ToastNotification.Show(this, "模版名称己存在", null, 3000, eToastGlowColor.Red, eToastPosition.TopCenter); return; } using (var sr = File.Create(TemplatesPath)) { sr.Close(); sr.Dispose(); } this.Close(); this.DialogResult = System.Windows.Forms.DialogResult.OK; }
public static bool Insertar(MCodigo objeto, facturacion.Vistas.VCodigo form) { MySqlConnection SqlCon = new MySqlConnection(Conexion.Cn); try { SqlCon.Open(); string query001 = "INSERT INTO " + table + "(fecInicio,fecFinal,clave,autorizacion) Values(@fecInicio,@fecFinal,@clave,@autorizacion)"; MySqlCommand command = new MySqlCommand(query001, SqlCon); command.Parameters.AddWithValue("@fecInicio", objeto.fecInicio); command.Parameters.AddWithValue("@fecFinal", objeto.fecFinal); command.Parameters.AddWithValue("@clave", objeto.clave); command.Parameters.AddWithValue("@autorizacion", objeto.autorizacion); if (command.ExecuteNonQuery() == 1) { ToastNotification.Show(form, "Codigo Creada Correctamente", global::facturacion.Properties.Resources.ok, 3000, (eToastGlowColor.Green), (eToastPosition.TopRight)); SqlCon.Close(); return(true); } else { ToastNotification.Show(form, "Codigo no pudo ser Creada", global::facturacion.Properties.Resources.error, 3000, (eToastGlowColor.Red), (eToastPosition.TopRight)); SqlCon.Close(); return(false); } } catch (MySqlException e) { ToastNotification.Show(form, e.Message, global::facturacion.Properties.Resources.error, 3000, (eToastGlowColor.Red), (eToastPosition.TopLeft)); return(false); } }
public static bool Editar(int id, MCodigo objeto, DevComponents.DotNetBar.Metro.MetroForm form) { MySqlConnection SqlCon = new MySqlConnection(Conexion.Cn); try { SqlCon.Open(); string query001 = "UPDATE " + table + " SET fecInicio=@fecInicio,fecFinal=@fecFinal,clave=@clave, autorizacion=@autorizacion where id=@id;"; Console.WriteLine(query001); MySqlCommand command = new MySqlCommand(query001, SqlCon); command.Parameters.AddWithValue("@id", id); command.Parameters.AddWithValue("@fecInicio", objeto.fecInicio); command.Parameters.AddWithValue("@fecFinal", objeto.fecFinal); command.Parameters.AddWithValue("@clave", objeto.clave); command.Parameters.AddWithValue("@autorizacion", objeto.autorizacion); if (command.ExecuteNonQuery() == 1) { ToastNotification.Show(form, "Codigo Editada Correctamente", global::facturacion.Properties.Resources.ok, 3000, (eToastGlowColor.Green), (eToastPosition.TopRight)); SqlCon.Close(); return(true); } else { ToastNotification.Show(form, "El codigo no pudo ser Editado", global::facturacion.Properties.Resources.error, 3000, (eToastGlowColor.Red), (eToastPosition.TopRight)); SqlCon.Close(); return(false); } } catch (MySqlException e) { ToastNotification.Show(form, e.Message, global::facturacion.Properties.Resources.error, 3000, (eToastGlowColor.Red), (eToastPosition.TopLeft)); return(false); } }
private void login() { try { if (!CValidar.ValidarLogin(this.tb_user, this.tb_password, errorIcono)) { return; } if (this.tb_password.Text != string.Empty && this.tb_user.Text != string.Empty) { string pasengript = CValidar.Encrypt(this.tb_password.Text); DataTable Datos = CUsuarios.LogindeUsuario(this.tb_user.Text, pasengript); if (Datos.Rows.Count != 0) { this.Hide(); MainForm form = new MainForm(this, Datos); form.Visible = true; } else { ToastNotification.Show(this, "NO TIENE ACCESO AL SISTEMA", global::facturacion.Properties.Resources.error, 2000, (eToastGlowColor.Red), (eToastPosition.TopCenter)); } } } catch (Exception exp) { ToastNotification.Show(this, exp.Message, global::facturacion.Properties.Resources.error, 3000, (eToastGlowColor.Red), (eToastPosition.TopCenter)); } }
private void btnAdd_Click(object sender, EventArgs e) { if (tbWords.Text.Trim() == "") { ToastNotification.Show(this, "You must input at least one word!", null, 2000, eToastGlowColor.Red); return; } int count = tbWords.Lines.Count(), js = 0; foreach (var word in tbWords.Lines) { string new_word = word.Trim(); if (new_word != "") { this.Text = originTitle + " ( " + ((double)++js * 100.0 / (double)count) + "% )"; cmdAddWord = new SQLiteCommand(strSQLInsert, Gib.con); cmdAddWord.Parameters.AddWithValue("@word", new_word); cmdAddWord.Parameters.AddWithValue("@trans", lookupDict(new_word)); cmdAddWord.Parameters.AddWithValue("@group", Gib.curGroup); cmdAddWord.Parameters.AddWithValue("@state", 0); cmdAddWord.Parameters.AddWithValue("@gamestate", 0); cmdAddWord.ExecuteNonQuery(); } } this.Text = originTitle + " ( 100% )"; MessageBox.Show(js + " word" + (js > 1 ? "s" : "") + " added"); FrmMain frm = (FrmMain)this.Owner; frm.refreshWords(); tbWords.Text = ""; this.Close(); }
private void txtFieldName_TextChanged(object sender, EventArgs e) { if (lstFields.Contains(txtFieldName.Text.Replace(" ", string.Empty).ToUpper()) || lstFields.Contains(txtFieldName.Text.Replace(" ", "_").ToUpper())) { ToastNotification.Show(this.Owner, "Column already Exist." + Environment.NewLine + "Try different Name."); } }
private void btnLuu_Click(object sender, EventArgs e) { KiemTraLuu(); if (lblid.Text == "N/A") { if (txttenloaitb.Text != "" || txtsoluong.Text != "0" || txttangtrongnam.Text != "0") { ThemLoaiThietBi(); LoaiThietBiLoad(); } else { ToastNotification.Show(this, "Vui lòng điền đầy đủ thông tin", null, 3000, (eToastGlowColor)eToastGlowColor.Red, (eToastPosition)eToastPosition.BottomCenter); return; } } else { if (txttenloaitb.Text != "" || txtsoluong.Text != "0" || txttangtrongnam.Text != "0") { CapNhatLoaiThietBi(); LoaiThietBiLoad(); } else { ToastNotification.Show(this, "Vui lòng điền đầy đủ thông tin", null, 3000, (eToastGlowColor)eToastGlowColor.Red, (eToastPosition)eToastPosition.BottomCenter); return; } } }
private void cmbSearchin_SelectedIndexChanged(object sender, EventArgs e) { try { //if (txtCompanyName.Text.Trim().Length > 0) //{ if (cmbSearchin.Text.Length > 0) { //DataRow[] drrSearch = dtCompany.Select(cmbSearchin.Text + " LIKE '%" + txtCompanyName.Text.Replace("'", "''").Replace("[", string.Empty).Replace("]", string.Empty).Replace("%", string.Empty) + "%'"); //if (drrSearch.Length > 0) // dgvCompanyList.DataSource = drrSearch.CopyToDataTable(); //else // dgvCompanyList.DataSource = null; btnCreate.Text = "Search"; } else { ToastNotification.Show(this, "Select column to be searched", eToastPosition.TopRight); } //} //else // dgvCompanyList.DataSource = null; } catch (Exception ex) { GM.Error_Log(System.Reflection.MethodBase.GetCurrentMethod(), ex, true, true); //MessageBoxEx.Show(ex.Message, "Campaign Manager", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }