private void Fill() { StaffPositionsLogic positions = new StaffPositionsLogic(manager); DataGV.AutoGenerateColumns = false; DataGV.DataSource = positions.GetAll(); DataGV.Update(); }
private void DeleteSB_Click(object sender, EventArgs e) { StaffPositionsLogic positions = new StaffPositionsLogic(manager); positions.Delete(Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value)); manager.Save(); Fill(); }
private void DeleteSB_Click(object sender, EventArgs e) { StaffPositionsLogic positions = new StaffPositionsLogic(manager); positions.Delete(Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value)); manager.Save(); Fill(); }
private void Fill() { StaffPositionsLogic positions = new StaffPositionsLogic(manager); DataGV.AutoGenerateColumns = false; DataGV.DataSource = positions.GetAll(); DataGV.Update(); }
private void Fill() { StaffPositionsLogic positions = new StaffPositionsLogic(manager); StaffPosition position = positions.Get(Convert.ToInt32(id)); if (position != null) { NameTB.Text = position.Name; ActiveCB.Checked = position.Active; } //StaffTeam team = teams.Get(Convert.ToInt32(id)); //NameTB.Text = team.Name; }
private void Fill() { StaffPositionsLogic positions = new StaffPositionsLogic(manager); StaffPosition position = positions.Get(Convert.ToInt32(id)); if (position != null) { NameTB.Text = position.Name; ActiveCB.Checked = position.Active; } //StaffTeam team = teams.Get(Convert.ToInt32(id)); //NameTB.Text = team.Name; }
private void SaveBt_Click(object sender, EventArgs e) { StaffPositionsLogic positions = new StaffPositionsLogic(manager); if (mode == "new") { positions.Create(NameTB.Text, ActiveCB.Checked); } if (mode == "edit") { positions.Update(Convert.ToInt32(id), NameTB.Text, ActiveCB.Checked); } manager.Save(); this.Close(); }
private void SaveBt_Click(object sender, EventArgs e) { StaffPositionsLogic positions = new StaffPositionsLogic(manager); if (mode == "new") { positions.Create(NameTB.Text, ActiveCB.Checked); } if (mode == "edit") { positions.Update(Convert.ToInt32(id), NameTB.Text, ActiveCB.Checked); } manager.Save(); this.Close(); }
private void FillPositions() { StaffPositionsLogic positions = new StaffPositionsLogic(manager); PositionsCB.ValueMember = "ID"; PositionsCB.DisplayMember = "Name"; PositionsCB.DropDownStyle = ComboBoxStyle.DropDownList; StaffPosition none = new StaffPosition(); //none.ID = -1; none.Name = "- не вибрано -"; List <StaffPosition> list = new List <StaffPosition>(); list.Add(none); int StructureObjectId = Convert.ToInt32(PositionsCB.SelectedValue); list.AddRange(positions.GetAll()); PositionsCB.DataSource = list; }
private void FillPositions() { StaffPositionsLogic positions = new StaffPositionsLogic(manager); PositionsCB.ValueMember = "ID"; PositionsCB.DisplayMember = "Name"; PositionsCB.DropDownStyle = ComboBoxStyle.DropDownList; StaffPosition none = new StaffPosition(); //none.ID = -1; none.Name = "- не вибрано -"; List<StaffPosition> list = new List<StaffPosition>(); list.Add(none); int StructureObjectId = Convert.ToInt32(PositionsCB.SelectedValue); list.AddRange(positions.GetAll()); PositionsCB.DataSource = list; }
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++; } } } }