private void UempInsert_Click(object sender, RoutedEventArgs e) { Entities1 entity = new Entities1(); try { User t = new User(); t.UserName = txtname.Text; t.FirstName = txtfirstname.Text; t.LastName = txtlastname.Text; t.Pass = txtpassword.Password; Admin_BAL obj = new Admin_BAL(); obj.insert_Employee(t); MessageBoxResult result = MessageBox.Show(this, "Employee " + t.UserName + " Registered Successfully", "Information", MessageBoxButton.OK, MessageBoxImage.Information); loademp(); txtname.Clear(); txtfirstname.Clear(); txtlastname.Clear(); txtpassword.Clear(); } catch (Exception ex) { MessageBoxResult result = MessageBox.Show(this, "" + ex.Message + "", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void btnempUpdate_Click(object sender, RoutedEventArgs e) { try { btnempuupdate.IsEnabled = true; tbemp.IsSelected = true; UempInsert.IsEnabled = false; User p = new User(); var obje = new List <User>(); object item = dtgrid.SelectedItem; if (item != null) { id = (dtgrid.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text; Admin_BAL obj = new Admin_BAL(); p = obj.view_Employee(int.Parse(id)); txtname.Text = p.UserName; txtfirstname.Text = p.FirstName; txtlastname.Text = p.LastName; txtpassword.Password = p.Pass; } else { MessageBoxResult result = MessageBox.Show(this, "Please Select a Row to Update", "Information", MessageBoxButton.OK, MessageBoxImage.Information); tbuser.IsSelected = true; } } catch (Exception ex) { MessageBoxResult result = MessageBox.Show(this, "" + ex.Message + "", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } }
protected void Unnamed9_Click(object sender, EventArgs e) { Entities1 entity = new Entities1(); try { User t = new User(); t.UserName = UserName.Text; t.FirstName = FirstName.Text; t.LastName = LastName.Text; t.Pass = Password.Text; Admin_BAL obj = new Admin_BAL(); obj.insert_Employee(t); Response.Write("<script type = 'text/javascript'>alert('Inserted successfully')</script>"); UserName.Text = ""; FirstName.Text = ""; LastName.Text = ""; Password.Text = ""; } catch (Exception ex) { throw ex; } }
public Admin Post([FromBody] Login objLogin) { Admin objReturn = null; objLogin.Password = EncryptionLibrary.EncryptText(objLogin.Password); using (Admin_BAL objBAL = new Admin_BAL()) { objReturn = objBAL.Validate(objLogin.EmailId, objLogin.Password); } return(objReturn); }
private void btnempDelete_Click(object sender, RoutedEventArgs e) { try { object item = dtgrid.SelectedItem; if (item != null) { MessageBoxResult result = MessageBox.Show(this, "Do you want to Remove", "warning", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { id = (dtgrid.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text; int obje; Admin_BAL obj = new Admin_BAL(); obje = obj.delete_Employee(int.Parse(id)); if (obje == 1) { MessageBoxResult res = MessageBox.Show(this, "Data Removed Successfully", "Information", MessageBoxButton.OK, MessageBoxImage.Information); loademp(); } else { MessageBoxResult res = MessageBox.Show(this, "Deletion Failed", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } else { MessageBoxResult result = MessageBox.Show(this, "Please Select a Row to delete", "Information", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { MessageBoxResult result = MessageBox.Show(this, "" + ex.Message + "", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void btnempuUpdate_Click(object sender, RoutedEventArgs e) { try { object item = dtgrid.SelectedItem; if (item != null) { id = (dtgrid.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text; User t = new User(); t.UserId = int.Parse(id); t.UserName = txtname.Text; t.FirstName = txtfirstname.Text; t.LastName = txtlastname.Text; t.Pass = txtpassword.Password; Admin_BAL obj = new Admin_BAL(); int x = obj.update_Employee(t); if (x == 1) { MessageBoxResult result = MessageBox.Show(this, "Employee " + t.UserName + " Updated Successfully", "Information", MessageBoxButton.OK, MessageBoxImage.Information); UempInsert.IsEnabled = true; tbuser.IsSelected = true; loademp(); } } else { MessageBoxResult result = MessageBox.Show(this, "Please Select a Row to update", "Information", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { MessageBoxResult result = MessageBox.Show(this, "" + ex.Message + "", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } }