public bool InsertStaff(StaffModel newStaff) { if (!File.Exists(SqliteBaseRepository.DbLocation)) { SqliteBaseRepository.CreateDatabase(); } string sql = "insert into staff(branch_id, firstname, lastname, fingerPrint) values(@branch_id, @firstname, @lastname, @fingerPrint)"; Dictionary <string, object> parameters = new Dictionary <string, object> { { "@branch_id", newStaff.branch_id }, { "@firstname", newStaff.firstName }, { "@lastname", newStaff.lastName }, { "@fingerPrint", newStaff.fingerPrint } }; bool output = true; try { SqliteDataAccess.SaveData(sql, parameters); } catch { output = false; } return(output); }
public void updateStaff(StaffModel model, int id) { using (SqlConnection connection = new SqlConnection(Constants.CONNECTION_STRING)) { string command_text = "UPDATE dbo.Staff SET FirstName = @FirstName, LastName = @LastName, UserName = @UserName, Password = @Password, EMail = @EMail, AccessLevel = @AccessLevel WHERE ID = @ID"; using (SqlCommand command = new SqlCommand(command_text)) { command.Connection = connection; command.Parameters.Add("@FirstName", System.Data.SqlDbType.NVarChar, 100).Value = model.FirstName.value; command.Parameters.Add("@LastName", System.Data.SqlDbType.NVarChar, 100).Value = !string.IsNullOrEmpty(model.LastName.value) ? model.LastName.value : (object)DBNull.Value; command.Parameters.Add("@UserName", System.Data.SqlDbType.VarChar, 100).Value = model.UserName.value; command.Parameters.Add("@Password", System.Data.SqlDbType.VarChar, 128).Value = model.Password.value; command.Parameters.Add("@EMail", System.Data.SqlDbType.VarChar, 100).Value = !string.IsNullOrEmpty(model.EMail.value) ? model.EMail.value : (object)DBNull.Value; command.Parameters.Add("@AccessLevel", System.Data.SqlDbType.TinyInt).Value = model.AccessLevel.value; command.Parameters.Add("@ID", System.Data.SqlDbType.Int).Value = id; try { connection.Open(); command.ExecuteNonQuery(); CoreApp.logger.log("Successfully staff updated in database"); } catch (Exception ex) { throw new Exception(ex.Message); } finally { try { connection.Close(); CoreApp.logger.log("Successfully connection closed"); } catch (Exception ex) { throw new Exception(ex.Message); } } } } }
public virtual ActionResult Unbind(StaffModel model) { var result = new Dictionary <string, object>(); var entity = new StaffEntity { Id = model.Id.Convert <long>(), Account = new AccountEntity { Id = 0 }, SaveType = SaveType.Modify }; entity.SetProperty(it => it.Account.Id); var rev = this.SaveEntity(entity); if (rev) { result.Add("Id", entity.Id.ToString()); } else { result.Add("Message", entity.Errors?.FirstOrDefault()?.Message); } result.Add("Status", rev); return(this.Jsonp(result)); }
public ActionResult AddStaff(int id = 0) { StaffTable staffTable = new StaffTable(); if (id > 0) { staffTable = staffRepository.GetStaffById(id); } ViewBag.Session = StaticData.GetStaffAT(); StaffModel staffModel = new StaffModel() { ID = staffTable.ID, ACDetails = staffTable.ACDetails, DateOfBirth = staffTable.DateOfBirth, DateOfJoin = staffTable.DateOfJoin, Designation = staffTable.Designation, Salary = staffTable.Salary, Experience = staffTable.Experience, SchoolMatric = staffTable.SchoolMatric, Name = staffTable.Name, PhotoGraph = staffTable.PhotoGraph, Staff = staffTable.Staff, Qualification = staffTable.Qualification }; return(View(staffModel)); }
public async Task <ActionResult <StaffModel> > PutStaffMember(int id, StaffModel staffMember) { try { var existingTeamMember = await _teamMemberRepository.GetStaffMemberAsync(id); if (existingTeamMember == null) { return(NotFound($"Could not find the team member by the name {staffMember.FirstName} {staffMember.LastName}")); } existingTeamMember.EditDate = DateTime.Now; _mapper.Map(staffMember, existingTeamMember); if (await _teamMemberRepository.SaveChangesAsync()) { return(_mapper.Map <StaffModel>(existingTeamMember)); } return(BadRequest("Failed to update the team member")); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Database Failure")); } }
private void ButtonAgregarEliminar_Click(object sender, RoutedEventArgs e) { StaffModel staff = DataGridStaff.SelectedItem as StaffModel; if (staff != null) { GRDialogConsultation _var = new GRDialogConsultation(); _var.Message = "Eliminar Registro Selecionado?"; if (_var.ShowDialog() == true) { int id = staff.Id; var result = services.DeleteUpdate(id); if (result) { MyCollection.Remove(staff); DataGridStaff.ItemsSource = MyCollection; DataGridStaff.Items.Refresh(); lblTotalReg.Content = "Cantidad de Registro: " + MyCollection.Count; } } } else { GRDialogInformation _msg = new GRDialogInformation(); _msg.Message = "Debe Seleccionar un Registro"; _msg.ShowDialog(); } }
void btnDeleteUser_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Messenger", "Do you want delete user ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { Button btnDelete = (Button)sender; StaffModel data = (StaffModel)(btnDelete.Tag); if (data.StaffID > 0) { var result = UserService.RemoveStaff(data.StaffID, userid); var messenger = "Delete user fail."; if (result == 1) { addUserList("User List", 2); pDetail.Controls.Clear(); messenger = "Delete user successful."; } frmMessager frm = new frmMessager("Messenger", messenger); frmOpacity.ShowDialog(this, frm); } } }
public void Setup() { new DataStoreTableHelper().clearAllTables(); ProgramVarietyModel programeVarietyModel = new ProgramVarietyModel(); programeVarietyModel.depositAmount = 20.0; programeVarietyModel.sessionCost = 20.0; programeVarietyModel.fullPaymentPercentageDiscount = 20; programeVarietyModel.name = "Regular"; programeVarietyModel.dogSpacesMaximum = 50; programeVarietyModel.noOfClasses = 50; ProgramVarietyTable programVarietyTable = new ProgramVarietyTable(); programeCostId = programVarietyTable.create(programeVarietyModel); ProgramModel programModel = new ProgramModel(); programModel.programVarietyId = programeCostId; ProgramTable programTable = new ProgramTable(); programId = programTable.create(programModel); StaffModel staffModel = new StaffModel(); staffModel.name = "Bob"; StaffTable staffTable = new StaffTable(); staffId = staffTable.create(staffModel); }
private void btnDelete_Click(object sender, EventArgs e) { //If this is 0 then there is nothing to show. The model is blank if (selectedStaff.id == 0) { return; } //Don't let them delete it by accident DialogResult result = MessageBox.Show( "Wow!! Wait...are you sure?", "Important Question", MessageBoxButtons.YesNo); //Abort!! if (result == DialogResult.No) { return; } //Delete the reord from the table and update the ListView try { new StaffTable().delete(selectedStaff.id); //reset everything ClearInputs(); RefreshList(); selectedStaff = new StaffModel(); } catch (Exception ex) { new ExceptionMessageGenerator().generateMessage(ex.Message); } }
public LogoutForm(StaffModel model) { sm = model; InitializeComponent(); //this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; }
public IHttpActionResult DELETE(string username) { var identity = User.Identity as ClaimsIdentity; string authenticatedUser = identity.FindFirst("sub").Value; if (username == null) { return(BadRequest("Username may not be null")); } try { StaffModel user = _staffServices.Get(authenticatedUser); if (user.isAdmin) { _staffServices.Delete(username); AuthRepository _repo = new AuthRepository(); _repo.Delete(username); return(Ok("User Deleted")); } return(BadRequest("Permission denied")); } catch (Exception e) { return(BadRequest(e.Message)); } }
/// <summary> /// Method to produce the timetable of the selected member of staff, on the selected date. /// </summary> /// <param name="dateTime">Date to view the time table for (same as date selected for register viewing)</param> /// <param name="staffMember">Name of the staff member to retrieve the tiemtable for</param> /// <returns>String list of times mapped to patient names which the member of staff has an appointment for.</returns> public static List <string> ProduceTimetable(DateTime dateTime, string staffMember) { List <string> staff = new List <string>(); staffMember = staffMember.Split('.').Last().Trim(); var date = Convert.ToString(dateTime);//DateTimeFormatter.ConvertToUkFormat(dateTime.ToString()); var results = StaffModel.getStaffMemberTimetable(staffMember, date); foreach (DataRow row in results.Rows) { var time = DateTimeFormatter.RemoveSeconds(row["Time"].ToString()); var patient = row["Patient Name"].ToString(); var item = String.Concat(time, ": ", patient); if (staff.Contains(item)) { continue; } staff.Add(item); } return(staff); }
public StaffDetailsViewModel() { Staff = new StaffModel(); ListWorkingProcess = new List <WorkingProcessModel>(); ListRole = new List <StaffRoleModel>(); ListOrganization = new List <OrganizationModel>(); ListStaffRelationShips = new TableViewModel(); ListReward = new TableViewModel(); ListDiscipline = new TableViewModel(); ListWorkingProcess = new List <WorkingProcessModel>(); WorkingProcess = new WorkingProcessModel(); ListWorkingProcessTable = new TableViewModel(); ListSalary = new TableViewModel(); ListAllowance = new TableViewModel(); ListBenefit = new TableViewModel(); ListTable = new TableViewModel(); SocialInsurance = new StaffSocialInsuranceModel(); HealthInsurance = new HealthInsuranceModel(); ListExperience = new List <StaffExperienceModel>(); ListCertificate = new List <StaffCertificateModel>(); StaffOnboardInfo = new StaffOnboardInfoModel(); StaffRelationships = new List <StaffRelationShipsModel>(); StaffWorkingDayMachine = new List <StaffWorkingDayMachineModel>(); StaffAllowancePopupWorkingprocess = new List <StaffAllowanceModel>(); StaffBenefitPopupWorkingprocess = new List <StaffBenefitsModel>(); }
private void BindParams(MySqlCommand cmd, StaffModel model) { cmd.Parameters.Add(new MySqlParameter { ParameterName = "@firstname", DbType = DbType.String, Value = model.firstname, }); cmd.Parameters.Add(new MySqlParameter { ParameterName = "@lastname", DbType = DbType.String, Value = model.lastname, }); cmd.Parameters.Add(new MySqlParameter { ParameterName = "@email", DbType = DbType.String, Value = model.email, }); cmd.Parameters.Add(new MySqlParameter { ParameterName = "@phone", DbType = DbType.String, Value = model.phone, }); }
private void MakeStaffButton_Click(object sender, RoutedEventArgs e) { if (!Staff.Can(StaffModel.Permission.AccessEmployeeData)) { MessageBox.Show("You do not have permission to do this!", "Not Authorised!", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (selectedRow == null) { return; } CustomerModel selected = selectedRow as CustomerModel; var toStaff = new StaffModel() { ID = selected.ID, FirstName = selected.FirstName, LastName = selected.LastName, PhoneNumber = selected.PhoneNumber, EmailAddress = selected.EmailAddress, Address = selected.Address }; toStaff.Permissions = DBAccessHelper.CalculatePermissions(1); DBAccessHelper.AlterStaff(toStaff, 1); }
private void btnSave_Click(object sender, EventArgs e) { try { //fill up the model with all the input fields selectedStaff.name = txtStaffName.Text; //The id will be 0 if New button was clicked if (selectedStaff.id == 0) { new StaffTable().create(selectedStaff); } else { new StaffTable().update(selectedStaff); } //reset everything ClearInputs(); RefreshList(); selectedStaff = new StaffModel(); } catch (Exception ex) { String message = new ExceptionMessageGenerator().generateMessage(ex.Message); MessageBox.Show(message); } }
public StaffModel GetTranslatorById(string translatorId, string cultureId) { StaffModel _model = null; try { IUnitOfWork ouw = new UnitOfWork(); IStaffRepository rep = new StaffRepository(ouw); IStaffService service = new StaffService(rep); var data = service.GetTranslatorByID(new BaseViewModel() { ID = Guid.Parse(translatorId), CurrentCulture = cultureId }); if (data != null) { _model = data; } } catch (Exception ex) { throw new Exception(ex.Message); } return(_model); }
private void populateStaff() { StaffTable staffTable = new StaffTable(); StaffModel staffModelAllison = new StaffModel(); staffModelAllison.name = "Allison"; staffIdAllison = staffTable.create(staffModelAllison); StaffModel staffModelBeth = new StaffModel(); staffModelAllison.name = "Beth"; staffIdBeth = staffTable.create(staffModelAllison); StaffModel staffModelCarol = new StaffModel(); staffModelCarol.name = "Carol"; staffIdCarol = staffTable.create(staffModelCarol); StaffModel staffModelDiane = new StaffModel(); staffModelDiane.name = "Diane"; staffIdDiane = staffTable.create(staffModelDiane); StaffModel staffModelEva = new StaffModel(); staffModelEva.name = "Eva"; staffIdEva = staffTable.create(staffModelDiane); }
public static MessageResult Phonenumber(StaffModel staff, string AddedBy) { try { using (SqlConnection conn = new SqlConnection(DBConn)) { querry = $@"Update tblStaff set PhoneNumber = @PhoneNumber where UserID = @Id "; using (SqlCommand cmd = new SqlCommand(querry, conn)) { conn.Open(); cmd.Parameters.AddWithValue("@UserID", staff.UserID); cmd.Parameters.AddWithValue("@PhoneNumber", staff.PhoneNumber); cmd.Parameters.AddWithValue("@UpdatedAt", DateTime.Now); cmd.Parameters.AddWithValue("@UpdatedBy", AddedBy); cmd.ExecuteScalar(); mes.Status = "success"; mes.Message = "Phone number updated successfully"; OcelotLog.AuditLogs($"{Constant.GetUserID()} at {DateTime.Now} updated {staff.UserID} to {staff.PhoneNumber}.", "StaffSQL", "Phonenumber"); } } } catch (Exception e) { mes.Status = "warning"; mes.Message = "Failed! reload and try again later"; OcelotLog.ErrorLogs(e.Message.ToString(), "StaffSQL", "Phonenumber"); } return(mes); }
/// <summary> /// The add new staff member. /// </summary> /// <param name="staff"> /// The staff. /// </param> public void AddNewStaffMember(StaffModel staff) { Check.Require(staff.FirstName); Check.Require(staff.LastName); this.context.StaffMembers.Add(staff); this.context.SaveChanges(); }
/// <summary> /// Constructor which accepts Client TCP object. /// </summary> /// <param name="parentForm"></param> /// <param name="tcpClient"></param> public ChatDialogForm(StaffChatForm parentForm, TcpClient tcpClient, StaffModel s) { InitializeComponent(); this.ownerForm = parentForm; staffMember = s; connectedStudent = null; //Get stream object connectedClient = tcpClient; clientStream = tcpClient.GetStream(); //Create the state object state = new StateObject(); state.workSocket = connectedClient.Client; //Set properties remoteEndPoint = ((IPEndPoint)state.workSocket.RemoteEndPoint).Address.ToString(); remotePort = ((IPEndPoint)state.workSocket.RemoteEndPoint).Port.ToString(); //Send the RSA public key SendPublicKey(); //Call asynchronous receive function connectedClient.Client.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, new AsyncCallback(OnReceive), state); TextBoxConnectionStatus.BackColor = Color.Green; }
/// <summary> /// The edit staff member. /// </summary> /// <param name="staff"> /// The staff. /// </param> public void EditStaffMember(StaffModel staff) { Check.Require(staff.FirstName); Check.Require(staff.LastName); this.context.Entry(staff).State = EntityState.Modified; this.context.SaveChanges(); }
public async Task <ActionResult <StaffModel> > CreateStaffMember(StaffModel model) { try { // To -Do check if there is a Team Member with the same first and last name in the db // Create new team member var staffMember = _mapper.Map <Staff>(model); _teamMemberRepository.Add(staffMember); var location = _linkGenerator.GetPathByAction( action: "CreateStaffMember", controller: "Staff", values: new { staffId = staffMember.StaffId }); if (await _teamMemberRepository.SaveChangesAsync()) { return(Created(location, _mapper.Map <StaffModel>(staffMember))); } return(BadRequest()); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Database Failure")); } }
// GET: Admin/AStaffStundent public ActionResult StaffCreate(int id = 0) { Staff staff = new Staff(); if (id > 0) { staff = staffRepository.GetStaffById(id); } StaffModel staffModel = new StaffModel { ID = staff.ID, AadharNumber = staff.AadharNumber, DateOfBirth = staff.DateOfBirth, DateOfJoin = staff.DateOfJoin, Salary = staff.Salary, StaffName = staff.StaffName, StaffType = staff.StaffType, Subject = staff.Subject, SubjectNumFirst = staff.SubjectNumFirst, SubjectNumSecond = staff.SubjectNumSecond, TeachSubFirst = staff.TeachSubFirst, TeachSubSecond = staff.TeachSubSecond, Designation = staff.Designation, Experience = staff.Experience, FatherName = staff.FatherName, PanNumber = staff.PanNumber }; return(View(staffModel)); }
public void addStaff(StaffModel model) { using (SqlConnection connection = new SqlConnection(Constants.CONNECTION_STRING)) { string command_text = "INSERT INTO dbo.Staff (FirstName, LastName, UserName, Password, EMail, AccessLevel) VALUES (@FirstName, @LastName, @UserName, @Password, @EMail, @AccessLevel)"; using (SqlCommand command = new SqlCommand(command_text)) { command.Connection = connection; command.Parameters.Add("@FirstName", System.Data.SqlDbType.NVarChar, 100).Value = model.FirstName.value; command.Parameters.Add("@LastName", System.Data.SqlDbType.NVarChar, 100).Value = !string.IsNullOrEmpty(model.LastName.value) ? model.LastName.value : (object)DBNull.Value; command.Parameters.Add("@UserName", System.Data.SqlDbType.VarChar, 100).Value = model.UserName.value; command.Parameters.Add("@Password", System.Data.SqlDbType.VarChar, 128).Value = model.Password.value; command.Parameters.Add("@EMail", System.Data.SqlDbType.VarChar, 100).Value = !string.IsNullOrEmpty(model.EMail.value) ? model.EMail.value : (object)DBNull.Value; command.Parameters.Add("@AccessLevel", System.Data.SqlDbType.TinyInt).Value = model.AccessLevel.value; try { connection.Open(); command.ExecuteNonQuery(); CoreApp.logger.log("Successfully staff added to database"); } catch (Exception ex) { throw new Exception(ex.Message); } finally { try { connection.Close(); CoreApp.logger.log("Successfully connection closed"); } catch (Exception ex) { throw new Exception(ex.Message); } } } } }
public ActionResult AddStaff(StaffModel staff) { if (Session["important"] != null || Session["juststaff"] != null) { int count = 0; if (ModelState.IsValid) { count = dao.InsertStaff(staff); if (count > 0) { return(RedirectToAction("Index", "Staff")); } else { ViewBag.Message = "Error! " + dao.message; } ModelState.Clear(); return(View()); } else { return(View("AddStaff", staff)); } } else { return(RedirectToAction("Index", "Home")); } }
public virtual ActionResult Modify(StaffModel model) { var result = new Dictionary <string, object>(); var rev = true; AccountEntity account = null; if (!string.IsNullOrWhiteSpace(model.LoginName) && !string.IsNullOrEmpty(model.LoginPassword)) { rev = Ioc.Resolve <IPasswordApplicationService>().CheckPassword(model.LoginName, model.LoginPassword, out account); } if (!rev) { result.Add("Message", "绑定的用户名或密码错误"); } else { var entity = model.CreateEntity(SaveType.Modify, account); rev = this.SaveEntity(entity); if (rev) { result.Add("Id", entity.Id.ToString()); result.Add("AccountId", entity.Account == null ? 0 : entity.Account.Id); } else { result.Add("Message", entity.Errors?.FirstOrDefault()?.Message); } } result.Add("Status", rev); return(this.Jsonp(result)); }
public EntityEditorPage(StaffModel staff, EntityType entityType) { InitializeComponent(); Staff = staff; Entity = entityType; SetupPage(); }
private StaffDetail _populateValues(StaffDetail entity, StaffModel model) { if (null == entity) { entity = new StaffDetail(); entity.ID = model.ID; entity.StaffId = model.StaffId; entity.SchoolId = model.SchoolId; } entity.ClassId = model.ClassId; entity.DepartmentId = model.DepartmentId; entity.PrimaryTagId = model.PrimaryTagId; entity.ReportingEmailId = model.ReportingEmailId; entity.SectionId = model.SectionId; entity.StaffMobileNo = model.StaffMobileNo; entity.StaffName = model.StaffName; entity.Address1 = model.Address1; entity.Address2 = model.Address2; entity.City = model.City; entity.Country = model.Country; entity.DateOfBirthh = model.DateOfBirthh; entity.DepartmentId = model.DepartmentId; entity.Gender = model.Gender; entity.StateId = model.StateId; entity.ZipCode = model.ZipCode; return(entity); }
public ChangePinNumPad(StaffModel staff) { sm = staff; InitializeComponent(); nameLabel.Text = $"{sm.name} Enter A New Pin"; this.TopMost = true; }