private void buttonLogin_Click(object sender, EventArgs e) { if (ValidateChildren(ValidationConstraints.Enabled)) { if (_helper.LoggedIn(textUsername.Text, textPassword.Text, checkBoxRememberMe.Checked)) { Form mainForm = null; switch (AuthUser.Model.RoleId) { case Role.Admin: mainForm = new AdminForm(); break; case Role.Operator: mainForm = new OperatorForm(); break; default: mainForm = new StaffForm(); break; } this.Hide(); mainForm.Show(); } else { MetroFramework.MetroMessageBox.Show(this, "Kredenciale te gabuara!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private async void LoadForm(string transaction, Staff staff = null) { StaffForm form = new StaffForm() { TransactionForm = transaction, StaffData = (staff == null) ? new Staff() : staff, PrimaryButtonText = (transaction == "Add Herbarium Staff") ? "Save" : "Update" }; var result = await form.ShowAsync(); if (result == ContentDialogResult.Primary) { string message = ""; switch (form.TransactionResult) { case 0: message = (form.TransactionForm == "Add Herbarium Staff") ? "Herbarium Staff Inserted to the Database" : "Herbarium Staff Updated in the Database"; break; case 1: message = "The System had run to an Error"; break; case 2: message = "Information is Already Exists in the Database"; break; } MessageDialog dialog = new MessageDialog(message); await dialog.ShowAsync(); this.InitializePage(); } }
private void btnOK_Click(object sender, EventArgs e) { Employess employess = new Employess(); employess.ID = int.Parse(txtEmployeeID.Text); employess.Name = txtNameStaff.Text; employess.LastName = txtLastNameStaff.Text; employess.Username = txtUsernameStaff.Text; employess.Password = txtPasswordStaff.Text; employess.PersonalID = txtPersonalID.Text; employess.Adress = txtAddress.Text; employess.Birthday = DateTime.Parse(rdDatetimepicker.Text); employess.Email = txtEmail.Text; employess.PhoneNumber = txtPhoneNumber.Text; employess.Salary = double.Parse(txtSalary.Text); employess.UpdatedBy = txtUpdateBy.Text; employess.UpdateDate = DateTime.Parse(txtUpdateDate.Text); employess.LastUpdate = int.Parse(txtUpdateNo.Text); var result = employessBll.Modify(employess); if (result != null) { StaffForm sf = new StaffForm(); sf.FillGrid(); this.Close(); } }
private void StaffAddressBtn_Click(object sender, RibbonControlEventArgs e) { try { StaffForm myForm = new StaffForm(); myForm.ShowDialog(); XLMain.Staff contact = myForm.selectedContact; string str = ""; if (contact.addresses[0].addressBlock != null) { if (contact.salutations.Count > 0) { str += contact.salutations[0].addressee + Environment.NewLine; } str += contact.addresses[0].addressBlock; XLDocument.InsertText(str); //insert the status text box; //XLDocument.AddStatusBox(); //XLDocument.ChangeStatus("Draft"); } else { MessageBox.Show(contact.name + " does not have an address in the system."); } } catch (Exception ex) { MessageBox.Show("Unable to get staff address"); XLtools.LogException("StaffAddressBtn", ex.ToString()); } }
private void btn2_click(object o, EventArgs a) { parentForm.Visible = false; tagetForm = new StaffForm(); tagetForm.StartPosition = FormStartPosition.CenterParent; tagetForm.FormClosed += new FormClosedEventHandler(Exit_click); tagetForm.Show(); }
public JsonResult LoadAddStaff() { StaffForm model = new StaffForm(); IEnumerable <deductions> list = _repo.getSalaryDeductions(); model = new StaffForm { Deductions = list }; return(Json(model)); }
//Checks phone no for incorrect data public void StaffFormPhoneNoErroneusdate() { //create instance to test StaffForm stForm = new StaffForm(ref mainform, true); //define a test input and output value bool expectedResult = false; stForm.SetPhoneNoAdded("63927086202"); //run the method under test bool actualResult = stForm.ValidateFields(); //checks results Assert.AreEqual(expectedResult, actualResult); }
//checks email for incorrect data public void StaffFormEmailErroneusdate() { //create instance to test StaffForm stForm = new StaffForm(ref mainform, true); //define a test input and output value bool expectedResult = false; stForm.SetEmailAdded("*****@*****.**"); //run the method under test bool actualResult = stForm.ValidateFields(); //checks results Assert.AreEqual(expectedResult, actualResult); }
//checks id image for inccrect data public void StaffFormIdImageErroneusdate() { //create instance to test StaffForm stForm = new StaffForm(ref mainform, true); //define a test input and output value bool expectedResult = false; stForm.SetIdImagedded("https:blackpool/301893060373"); //run the method under test bool actualResult = stForm.ValidateFields(); //checks results Assert.AreEqual(expectedResult, actualResult); }
public void EnrolmentFormNullDateTest() { //create instane to test StaffForm stForm = new StaffForm(ref mainform, true); //define a test input and output value bool expectedResult = false; stForm.SetDateAdded("0000-00-00"); //run the method under test bool actualResult = stForm.ValidateFields(); //checks results Assert.AreEqual(expectedResult, actualResult); }
public object[] getStaffSearchParam() { StaffForm staffForm = Program.MainForm.StaffForm; object[] arr = new object[10]; arr[0] = getValueOfTextBox(staffForm.searchID); arr[1] = getValueOfTextBox(staffForm.searchUsername); arr[2] = getValueOfComboBox(staffForm.searchRank); arr[3] = getValueOfComboBox(staffForm.searchStatus); arr[4] = getValueOfTextBox(staffForm.searchRealname); arr[5] = staffForm.searchBirthday.getDateTimeSQL(); arr[6] = getValueOfComboBox(staffForm.searchSex); arr[7] = getValueOfTextBox(staffForm.searchSDT); arr[8] = getValueOfTextBox(staffForm.searchLocation); arr[9] = 100; return(arr); }
private void StaffSig_Click(object sender, RibbonControlEventArgs e) { //get current user XLMain.Staff user = XLMain.Staff.StaffFromUser(Environment.UserName); bool auth = AuthCheck(user); if (auth) { StaffForm myForm = new StaffForm(); myForm.ShowDialog(); XLMain.Staff contact = myForm.selectedContact; //get current user bool success = XLDocument.AddSignature(contact.username); if (success) { success = XLDocument.AddSignatureMetaData(user, contact); } } else { MessageBox.Show("You do not have authority to use this feature"); } }
private void ValidateFields() { if (txtUsernameStaff.Text == "") { erpUsername.SetError(txtUsernameStaff, "This cannot be blank"); } if (txtPasswordStaff.Text == "") { erpPassword.SetError(txtPasswordStaff, "This cannot be blank"); } if (txtNameStaff.Text == "") { erpName.SetError(txtNameStaff, "This cannot be blank"); } if (txtLastNameStaff.Text == "") { erpLastName.SetError(txtLastNameStaff, "This cannot be blank"); } if (rdDatetimepicker.Text == "") { erpBirthday.SetError(rdDatetimepicker, "This cannot be blank"); } if (txtPhoneNumber.Text == "") { erpPhone.SetError(txtPhoneNumber, "This cannot be blank"); } if (txtEmail.Text == "") { erpMail.SetError(txtEmail, "This cannot be blank"); } if (txtInsertBy.Text == "") { erpInsertby.SetError(txtInsertBy, "This cannot be blank"); } if (txtInsertDate.Text == "") { erpInsertDate.SetError(txtInsertDate, "This cannot be blank"); } if (txtAddress.Text == "") { erpAdress.SetError(txtAddress, "This cannot be blank"); } if (txtSalary.Text == "") { erpSalary.SetError(txtSalary, "This cannot be blank"); } if (txtPersonalID.Text == "") { erpPersonalID.SetError(txtPersonalID, "This cannot be Blank"); } else if (ValidateNullFields() == true) { employess.Name = txtNameStaff.Text; employess.LastName = txtLastNameStaff.Text; employess.Username = txtUsernameStaff.Text; employess.Password = txtPasswordStaff.Text; employess.PersonalID = txtPersonalID.Text; employess.Adress = txtAddress.Text; employess.Birthday = DateTime.Parse(rdDatetimepicker.Text); employess.Email = txtEmail.Text; employess.PhoneNumber = txtPhoneNumber.Text; employess.Salary = double.Parse(txtSalary.Text); employess.Insertby = txtInsertBy.Text; employess.InserDate = DateTime.Parse(txtInsertDate.Text); employessbll.ADD(employess); StaffForm sf = new StaffForm(); sf.FillGrid(); this.Close(); } }
public async Task <JsonResult> Staff([FromBody] StaffForm model) { string err = ""; string status = ""; bool r = false; _logger.LogInformation("creating staff"); _loggedinuser = await _manager.GetUserAsync(User); if (!ModelState.IsValid) { _logger.LogInformation("Model error while creating staff"); err = "Model error while creating student"; status = "Staff/Teacher could not be created"; } ImgDoc pic = new ImgDoc(); if (!string.IsNullOrEmpty(model.StaffPic)) { string fname = model.StaffPic.Split('~')[0]; string type = model.StaffPic.Split('~')[1].Split(',')[0].Split(':')[1]; string base64 = model.StaffPic.Split('~')[1].Split(',')[1]; pic.name = fname.Split('.')[0]; pic.fileExtension = fname.Split('.')[fname.Split('.').Length - 1];; pic.contentType = type; pic.content = base64; } else { pic = null; } var u = new mpsUser { FirstName = model.FirstName, MiddleName = model.MiddleName, LastName = model.LastName, Email = model.Email, UserName = model.UserName, PhoneNumber = model.PhoneNumber, Gender = model.Gender, DOB = model.DOB, Address1 = model.Address1, Address2 = model.Address2, UserPic = pic }; try{ mpsUserResult res = await u.CreatempsUserAsync(_manager, u, model.Password, model.staffrole); if (!String.IsNullOrEmpty(res.newUserId)) { string sd = ""; foreach (deductions v in model.Deductions) { sd += sd.Length > 0? string.Concat("~", sd, v.name, ": ", v.value, v.type): string.Concat(sd, v.name, ": ", v.value, v.type); } model.DeductionsString = sd; bool b = await _repo.SaveStaffAsync(model, res.newUserId, "", _loggedinuser); if (b) { status = "New staff/teacher " + model.FirstName + " is created"; r = true; // try{ // bool mail = _mailer.SendUserEmail(MAILTYPE.StaffCreated,model); // bool text = _msg91.SendUserText(TEXTTYPE.StaffCreated,model); // if(!mail){ // _logger.LogError($"error sending mail to { model.Email }"); // status += "\n Not able to send confirmation email"; // } // if(!text){ // _logger.LogError($"error sending sms to { model.PhoneNumber }"); // status += "\n Not able to send confirmation text message"; // } // } // catch(Exception ex) // { // _logger.LogError($"Exception when sending confirmation{ex.Message}"); // status += "\n But not able to send confirmation"; // } } } else { status = "staff/teacher could not be created"; foreach (IdentityError s in res.errors) { err += s.Code + " - " + s.Description + " "; } } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } return(Json(new { res = r, status = status, errors = err })); }
public async Task <JsonResult> UpdateStaff([FromBody] StaffForm staff) { string err = ""; string status = ""; bool r = false; _logger.LogInformation($"update started for {staff.FirstName} {staff.LastName}"); if (ModelState.IsValid) { _loggedinuser = await _manager.GetUserAsync(User); _logger.LogInformation($"By {_loggedinuser.UserName}"); bool res = await _repo.updateStaffAsync(staff, _loggedinuser); if (res) { status = "Staff " + staff.FirstName + " is Updated"; r = true; //update the role var su = await _manager.FindByNameAsync(staff.UserName); var roles = await _manager.GetRolesAsync(su); if (!roles.Contains(staff.staffrole)) { await _manager.RemoveFromRolesAsync(su, roles); var result = await _manager.AddToRoleAsync(su, staff.staffrole); if (!result.Succeeded) { status = "\n The role could not be updated"; foreach (var e in result.Errors) { string.Concat(err, ", "); string.Concat(err, e.Description); } } else { _logger.LogError($"Error while updating role {err}"); } } // try{ // bool mail = _mailer.SendUserEmail(MAILTYPE.StaffEdited,staff); // bool text = _msg91.SendUserText(TEXTTYPE.StaffEdited,staff); // if(!mail){ // _logger.LogError($"error sending mail to { staff.Email }"); // status += "\n Not able to send confirmation email"; // } // if(!text){ // _logger.LogError($"error sending sms to { staff.PhoneNumber }"); // status += "\n Not able to send confirmation text message"; // } // } // catch(Exception ex) // { // _logger.LogError($"Exception when sending confirmation{ex.Message}"); // status += "\n But not able to send any confirmation"; // } } else { status = "Staff/Teacher could not be updated"; } } else { err = "Model error while updating Staff/Teacher"; status = "Staff/Teacher could not be updated"; } _logger.LogInformation(status); return(Json(new { res = r, status = status, errors = err })); }
public static StaffForm initStaffForm() { return(staffForm = new StaffForm()); }
public static BaseForm getForm(string name) { BaseForm f = new ObjectForm(); switch (name) { case "Object": f = new ObjectForm(); break; case "Linq": f = new LinqForm(); break; case "People": f = new PeopleForm(); break; case "ConnectToUniversityPeople": f = new ConnectToUniversityPeopleForm(); break; case "Worker": f = new Workers(); break; case "Leadership": f = new LeadershipForm(); break; case "Teacher": f = new TeacherForm(); break; case "Staff": f = new StaffForm(); break; case "Student": f = new StudentForm(); break; case "Entrant": f = new EntrantForm(); break; case "Thing": f = new ThingForm(); break; case "CultureThing": f = new CultureThingForm(); break; case "MatherialThing": f = new MatherialThingForm(); break; case "Building": f = new BuildingForm(); break; case "Room": f = new RoomForm(); break; case "PersonalThing": f = new RersonalThingForm(); break; case "Literature": f = new LiteratureForm(); break; case "Electronic": f = new ElectronicForm(); break; case "NotMatherialThing": f = new NotMatherialForm(); break; case "GroupOfPeople": f = new GroupOfPeopleForm(); break; case "Faculty": f = new FacultyForm(); break; case "Group": f = new GroupForm(); break; case "ManageOfPeople": f = new ManageOfPeopleForm(); break; case "Mark": f = new MarkForm(); break; case "Award": f = new AwardForm(); break; //case "Event": // f = new EventForm(); // break; //case "ControlKnowledge": // f = new ControlKnowledgeForm(); // break; case "Subject": f = new SubjectForm(); break; } return(f); }
private void radMenuItem17_Click(object sender, EventArgs e) { StaffForm staffForm = new StaffForm(); staffForm.ShowDialog(); }
private async void rbtnPersonelList_Click(object sender, RibbonControlEventArgs e) { var frm = new StaffForm(); await Task.Run(() => frm.ShowDialog()); }
private void DMCanBo_Click(object sender, EventArgs e) { StaffForm sf = new StaffForm(); sf.ShowDialog(); }
protected override void dataGridView_SelectedItems_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { Form CallForm = new StaffForm("View", GetSelectedItemInSelectedDataGridView <Staff>()); CallForm.ShowDialog(); }