public UserRolesForm(int EmployeeID) { InitializeComponent(); employeeId = EmployeeID; manager = new ContextManager(); StaffEmployeeLogic employeeLogic = new StaffEmployeeLogic(manager); StaffEmployee employee = employeeLogic.Get(EmployeeID); if (employee != null) { if (employee.UserID != null) { userId = Convert.ToInt32(employee.UserID); SecurityUsersLogic usersLogic = new SecurityUsersLogic(manager); SecurityUser user = usersLogic.Get(Convert.ToInt32(userId)); LoginL.Text = user.Login; } else { MessageBox.Show("Логін користувача відсутній"); } } LFML.Text = employee.LastName + " " + employee.FirstName + " " + employee.MiddleName; FillRoles(); }
public UserRolesForm(int EmployeeID) { InitializeComponent(); employeeId = EmployeeID; manager = new ContextManager(); StaffEmployeeLogic employeeLogic = new StaffEmployeeLogic(manager); StaffEmployee employee = employeeLogic.Get(EmployeeID); if (employee != null) { if (employee.UserID != null) { userId = Convert.ToInt32(employee.UserID); SecurityUsersLogic usersLogic = new SecurityUsersLogic(manager); SecurityUser user = usersLogic.Get(Convert.ToInt32(userId)); LoginL.Text = user.Login; } else MessageBox.Show("Логін користувача відсутній"); } LFML.Text = employee.LastName + " " + employee.FirstName + " " + employee.MiddleName; FillRoles(); }
private void FillData() { StaffEmployeeLogic employees = new StaffEmployeeLogic(manager); StaffEmployee employee = employees.Get(Convert.ToInt32(id)); LastNameTB.Text = employee.LastName; FirstNameTB.Text = employee.FirstName; MiddleNameTB.Text = employee.MiddleName; CityTB.Text = employee.City; StreetTB.Text = employee.Street; BuildingTB.Text = employee.Building; FlatTB.Text = employee.Flat; PhoneTB.Text = employee.Phone; MobPhoneTB.Text = employee.MobPhone; HireDateDTP.Value = Convert.ToDateTime(employee.HireDate); if (employee.ReleaseDate != null) { ReleasedCB.Checked = true; ReleaseDateDTP.Value = Convert.ToDateTime(employee.ReleaseDate); } }
private void Fill() { StaffEmployeeSalariesLogic salariesLogic = new StaffEmployeeSalariesLogic(manager); DataGV.AutoGenerateColumns = false; if (employeeId != null) { DataGV.DataSource = salariesLogic.GetViewByEmployeeID(Convert.ToInt32(employeeId)); } else { DataGV.DataSource = salariesLogic.GetView(); } StaffEmployeeLogic employees = new StaffEmployeeLogic(manager); if (employeeId != null) { StaffEmployee employee = employees.Get(Convert.ToInt32(employeeId)); EmployeeL.Text = employee.LastName + " " + employee.FirstName + " " + employee.MiddleName; } else { EmployeeL.Text = "Всі працівники"; } DataGV.Update(); }
private void FillInfo() { if (DataGV.SelectedRows.Count > 0) { StaffEmployeePositionsLogic employeePositionsLogic = new StaffEmployeePositionsLogic(manager); StaffEmployeeLogic employeeLogic = new StaffEmployeeLogic(manager); SecurityUserRolesLogic userRoles = new SecurityUserRolesLogic(manager); int employeeId = Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value); PositionsLB.DataSource = employeePositionsLogic.GetPositionsByEmployeeID(employeeId).ToList(); PositionsLB.DisplayMember = "Name"; PositionsLB.ValueMember = "ID"; PositionsLB.Update(); StaffEmployee employee = employeeLogic.Get(employeeId); if (employee.UserID != null) { int userId = Convert.ToInt32(employee.UserID); RolesLB.DataSource = userRoles.GetAll(userId).Select(a => a.SecurityRole).ToList(); RolesLB.DisplayMember = "Name"; RolesLB.ValueMember = "ID"; RolesLB.Update(); } } }
private void Fill() { StaffEmployeePositionsLogic positions = new StaffEmployeePositionsLogic(manager); DataGV.AutoGenerateColumns = false; DataGV.DataSource = positions.GetByEmployeeID(employeeId).Select(a => new { a.ID, Name = a.StaffPosition.Name, a.StartDate, a.EndDate, a.Active }).ToList(); StaffEmployeeLogic employees = new StaffEmployeeLogic(manager); StaffEmployee employee = employees.Get(employeeId); EmployeeL.Text = employee.LastName + " " + employee.FirstName + " " + employee.MiddleName; DataGV.Update(); }
/// <summary> /// конструктор /// </summary> /// <param name="_mode"></param> /// <param name="_id">ідентифікатор користувача </param> /// <param name="_id">ідентифікатор працівника </param> public UserForm(string _mode, int?_id, int?_employeeId) { InitializeComponent(); manager = new ContextManager(); mode = _mode; id = _id; employeeId = _employeeId; if ((id == null) & (employeeId != null)) { StaffEmployeeLogic employees = new StaffEmployeeLogic(manager); StaffEmployee employee = employees.Get(Convert.ToInt32(employeeId)); if (employee != null) { id = employee.UserID; } } if (_mode == "manage") { FillData(); } }
private void Fill() { StaffEmployeeSalariesLogic employeeSalaries = new StaffEmployeeSalariesLogic(manager); //StaffStructureObjectsLogic StructureObjects = new StaffStructureObjectsLogic(manager); StaffEmployeeSalary employeeSalary = employeeSalaries.Get(Convert.ToInt32(id)); StaffEmployeeLogic employees = new StaffEmployeeLogic(manager); StaffEmployee employee = employees.Get(employeeId); EmployeeL.Text = employee.LastName + " "+ employee.FirstName + " " + employee.MiddleName; //заповнюємо поле відділу StaffStructureObjectsLogic StructureObjects = new StaffStructureObjectsLogic(manager); int objectId = Convert.ToInt32(employee.StructureObjectID); List<Item> list = new List<Item>(); //Item defaultItem = new Item(); //defaultItem.ID = ""; //defaultItem.Name = " - всі відділи - "; //list.Add(defaultItem); int selectedObjectIndex = 0; int counter = 0; foreach (var a in StructureObjects.GetHeirarchyView()) { Item i = new Item(); i.ID = a.ID.ToString(); i.Name = a.Name; if (employee.StructureObjectID == a.ID) selectedObjectIndex = counter; list.Add(i); counter++; } StructureObjectsCB.DisplayMember = "Name"; StructureObjectsCB.ValueMember = "ID"; StructureObjectsCB.DataSource = list; StructureObjectsCB.SelectedIndex = selectedObjectIndex; if (mode == "new") { //очищаємо поле EndDate //set the format to custom } if (mode == "edit") { //заповнюємо відділ по якому нараховується зарплата if (employeeSalary.StructureObjectID != null) { int n = 0; foreach (Item i in StructureObjectsCB.Items) { if (i.ID == employeeSalary.StructureObjectID.ToString()) StructureObjectsCB.SelectedIndex = n; n++; } } dateTimePicker1.Value = employeeSalary.Month; SalaryNUD.Value = employeeSalary.Salary; SaleSumNUD.Value = employeeSalary.SumSale; ExtraPercentNUD.Value = employeeSalary.ExtraPercent; } }
private void Fill() { StaffEmployeeSalariesLogic salariesLogic = new StaffEmployeeSalariesLogic(manager); DataGV.AutoGenerateColumns = false; if (employeeId != null) DataGV.DataSource = salariesLogic.GetViewByEmployeeID(Convert.ToInt32(employeeId)); else DataGV.DataSource = salariesLogic.GetView(); StaffEmployeeLogic employees = new StaffEmployeeLogic(manager); if (employeeId != null) { StaffEmployee employee = employees.Get(Convert.ToInt32(employeeId)); EmployeeL.Text = employee.LastName + " " + employee.FirstName + " " + employee.MiddleName; } else EmployeeL.Text = "Всі працівники"; DataGV.Update(); }
private void Fill() { StaffEmployeePositionsLogic employeePositions = new StaffEmployeePositionsLogic(manager); //StaffStructureObjectsLogic StructureObjects = new StaffStructureObjectsLogic(manager); StaffEmployeePosition employeePosition = employeePositions.Get(Convert.ToInt32(id)); StaffPositionsLogic positions = new StaffPositionsLogic(manager); StaffEmployeeLogic employees = new StaffEmployeeLogic(manager); StaffEmployee employee = employees.Get(employeeId); EmployeeL.Text = employee.LastName + " "+ employee.FirstName + " " + employee.MiddleName; PositionsCB.DataSource = positions.GetAll(); PositionsCB.DisplayMember = "Name"; PositionsCB.ValueMember = "ID"; PositionsCB.Update(); //заповнюємо поле відділу StaffStructureObjectsLogic StructureObjects = new StaffStructureObjectsLogic(manager); int objectId = Convert.ToInt32(employee.StructureObjectID); List<Item> list = new List<Item>(); Item defaultItem = new Item(); defaultItem.ID = ""; defaultItem.Name = " - всі відділи - "; list.Add(defaultItem); foreach (var a in StructureObjects.GetHeirarchyView()) { Item i = new Item(); i.ID = a.ID.ToString(); i.Name = a.Name; list.Add(i); } StructureObjectsCB.DisplayMember = "Name"; StructureObjectsCB.ValueMember = "ID"; StructureObjectsCB.DataSource = list; if (mode == "new") { //очищаємо поле EndDate //set the format to custom EndDateDTP.Format = DateTimePickerFormat.Custom; // set custom format to empty EndDateDTP.CustomFormat = " "; ActiveCB.Checked = true; } if (mode == "edit") { StartDateDTP.Value = employeePosition.StartDate; if (employeePosition.EndDate != null) { EndDateDTP.Value = Convert.ToDateTime(employeePosition.EndDate); } else { //очищаємо поле EndDate //set the format to custom EndDateDTP.Format = DateTimePickerFormat.Custom; // set custom format to empty EndDateDTP.CustomFormat = " "; } PositionsCB.SelectedItem = positions.GetAll().Where(a => a.ID == employeePosition.PositionID).FirstOrDefault(); ActiveCB.Checked = employeePosition.Active; if (employeePosition.StructureObjectID != null) { int n = 0; foreach (Item i in StructureObjectsCB.Items) { if (i.ID == employeePosition.StructureObjectID.ToString()) StructureObjectsCB.SelectedIndex = n; n++; } } } }
private void Fill() { StaffEmployeePositionsLogic employeePositions = new StaffEmployeePositionsLogic(manager); //StaffStructureObjectsLogic StructureObjects = new StaffStructureObjectsLogic(manager); StaffEmployeePosition employeePosition = employeePositions.Get(Convert.ToInt32(id)); StaffPositionsLogic positions = new StaffPositionsLogic(manager); StaffEmployeeLogic employees = new StaffEmployeeLogic(manager); StaffEmployee employee = employees.Get(employeeId); EmployeeL.Text = employee.LastName + " " + employee.FirstName + " " + employee.MiddleName; PositionsCB.DataSource = positions.GetAll(); PositionsCB.DisplayMember = "Name"; PositionsCB.ValueMember = "ID"; PositionsCB.Update(); //заповнюємо поле відділу StaffStructureObjectsLogic StructureObjects = new StaffStructureObjectsLogic(manager); int objectId = Convert.ToInt32(employee.StructureObjectID); List <Item> list = new List <Item>(); Item defaultItem = new Item(); defaultItem.ID = ""; defaultItem.Name = " - всі відділи - "; list.Add(defaultItem); foreach (var a in StructureObjects.GetHeirarchyView()) { Item i = new Item(); i.ID = a.ID.ToString(); i.Name = a.Name; list.Add(i); } StructureObjectsCB.DisplayMember = "Name"; StructureObjectsCB.ValueMember = "ID"; StructureObjectsCB.DataSource = list; if (mode == "new") { //очищаємо поле EndDate //set the format to custom EndDateDTP.Format = DateTimePickerFormat.Custom; // set custom format to empty EndDateDTP.CustomFormat = " "; ActiveCB.Checked = true; } if (mode == "edit") { StartDateDTP.Value = employeePosition.StartDate; if (employeePosition.EndDate != null) { EndDateDTP.Value = Convert.ToDateTime(employeePosition.EndDate); } else { //очищаємо поле EndDate //set the format to custom EndDateDTP.Format = DateTimePickerFormat.Custom; // set custom format to empty EndDateDTP.CustomFormat = " "; } PositionsCB.SelectedItem = positions.GetAll().Where(a => a.ID == employeePosition.PositionID).FirstOrDefault(); ActiveCB.Checked = employeePosition.Active; if (employeePosition.StructureObjectID != null) { int n = 0; foreach (Item i in StructureObjectsCB.Items) { if (i.ID == employeePosition.StructureObjectID.ToString()) { StructureObjectsCB.SelectedIndex = n; } n++; } } } }
private void Fill() { StaffEmployeeSalariesLogic employeeSalaries = new StaffEmployeeSalariesLogic(manager); //StaffStructureObjectsLogic StructureObjects = new StaffStructureObjectsLogic(manager); StaffEmployeeSalary employeeSalary = employeeSalaries.Get(Convert.ToInt32(id)); StaffEmployeeLogic employees = new StaffEmployeeLogic(manager); StaffEmployee employee = employees.Get(employeeId); EmployeeL.Text = employee.LastName + " " + employee.FirstName + " " + employee.MiddleName; //заповнюємо поле відділу StaffStructureObjectsLogic StructureObjects = new StaffStructureObjectsLogic(manager); int objectId = Convert.ToInt32(employee.StructureObjectID); List <Item> list = new List <Item>(); //Item defaultItem = new Item(); //defaultItem.ID = ""; //defaultItem.Name = " - всі відділи - "; //list.Add(defaultItem); int selectedObjectIndex = 0; int counter = 0; foreach (var a in StructureObjects.GetHeirarchyView()) { Item i = new Item(); i.ID = a.ID.ToString(); i.Name = a.Name; if (employee.StructureObjectID == a.ID) { selectedObjectIndex = counter; } list.Add(i); counter++; } StructureObjectsCB.DisplayMember = "Name"; StructureObjectsCB.ValueMember = "ID"; StructureObjectsCB.DataSource = list; StructureObjectsCB.SelectedIndex = selectedObjectIndex; if (mode == "new") { //очищаємо поле EndDate //set the format to custom } if (mode == "edit") { //заповнюємо відділ по якому нараховується зарплата if (employeeSalary.StructureObjectID != null) { int n = 0; foreach (Item i in StructureObjectsCB.Items) { if (i.ID == employeeSalary.StructureObjectID.ToString()) { StructureObjectsCB.SelectedIndex = n; } n++; } } dateTimePicker1.Value = employeeSalary.Month; SalaryNUD.Value = employeeSalary.Salary; SaleSumNUD.Value = employeeSalary.SumSale; ExtraPercentNUD.Value = employeeSalary.ExtraPercent; } }