private Assignation BuildAssgination(Assignation ass) { ReserveDutyEntity man = manpower[comboBox_Soldier.SelectedIndex]; string pn = textBox_PersonalNumber.Text; DateTime start = dateTimePicker_startDate.Value.Date; DateTime end = dateTimePicker_Endate.Value.Date; string shiftIndexes = ""; for (int i = 0; i < checkedListBox_Tasks.CheckedItems.Count; i++) { int modifiedIndex = checkedListBox_Tasks.Items.IndexOf(checkedListBox_Tasks.CheckedItems[i]); if (i == 0) { shiftIndexes += (man.qualifiedShiftsIndexes[modifiedIndex]); } else { shiftIndexes += (Program.metadata["MultifieldDeliminator"].ToString() + man.qualifiedShiftsIndexes[modifiedIndex]); } } if (ass == null) { ass = new Assignation("זימון חדש", man, start, end, shiftIndexes, AssignationStatus.PendingApproval.ToString()); } else { ass.startDate = start; ass.endDate = end; ass.shiftsIndexes = shiftIndexes.Split(new string[] { Program.metadata["MultifieldDeliminator"].ToString() }, StringSplitOptions.RemoveEmptyEntries); } return(ass); }
public void PopulateComboBox() { var values = Enum.GetValues(typeof(Rank)).Cast <Rank>(); foreach (var item in values) { Rank r = (Rank)item; comboBox_rank.Items.Add(ReserveDutyEntity.TranslateToRank(r)); } if (this.manpower == null) { comboBox_rank.SelectedIndex = 0; } else { int i = 0; foreach (var item in values) { Rank r = (Rank)item; if (r.ToString() == this.manpower.rank.ToString()) { comboBox_rank.SelectedIndex = i; break; } i++; } } }
private ReserveDutyEntity BuildManPower() { string pn = textBox_PersonalNumber.Text; string fn = textBox_FirstName.Text; string ln = textBox_LastName.Text; DateTime rd = dateTimePicker_ResignDate.Value; string rankLiteral = comboBox_rank.Text; bool inManPower = checkBox_InManPower.Checked; List <string> shiftIndexes = new List <string>(); for (int i = 0; i < checkedListBox_Tasks.CheckedItems.Count; i++) { int modifiedIndex = checkedListBox_Tasks.Items.IndexOf(checkedListBox_Tasks.CheckedItems[i]); shiftIndexes.Add(shifts[modifiedIndex].ID); } ReserveDutyEntity temp; if (this.manpower != null) { temp = this.manpower; } else { temp = new ReserveDutyEntity(); } temp.ID = pn; temp.firstName = fn; temp.lastName = ln; temp.resignmentDate = rd; temp.SetRankLiteral(rankLiteral); temp.inManPower = inManPower; temp.qualifiedShiftsIndexes = shiftIndexes.ToArray(); return(temp); }
public AddManpower(ReserveDutyEntity manPower, List <ShiftEntity> shifts) { InitializeComponent(); textBox_PersonalNumber.Enabled = false; this.manpower = manPower; this.shifts = shifts; PopulateFields(); }
private void comboBox_Soldier_SelectedIndexChanged(object sender, EventArgs e) { ReserveDutyEntity man = manpower[comboBox_Soldier.SelectedIndex]; textBox_PersonalNumber.Text = man.ID; dateTimePicker_startDate.Value = DateTime.Now.Date.AddDays(7); dateTimePicker_Endate.Value = DateTime.Now.Date.AddDays(7); PopulateCheckboxlist(man); button_add.Enabled = true; button_Validate.Enabled = true; }
public Assignation(string id, ReserveDutyEntity reserverDutyEntity, DateTime start, DateTime end, string shiftsString, string assignStatusString) { this.ID = id; this.reserverDutyEntity = reserverDutyEntity; this.startDate = start; this.endDate = end; this.reserveDays = (endDate.Date - startDate.Date).Days + 1; this.shiftsIndexes = ReserveDutyEntity.MultiValuedParser(shiftsString); this.status = TranslateAssignationStatus(assignStatusString); this.IsFaulty = false; this.comments = new List <string>(); }
public ProgramUser(string firstName, string lastName, string pn, string position, string rank, string department, string teamsIndexes) { this.department = department; this.firstName = firstName; this.lastName = lastName; this.fullName = firstName + " " + lastName; this.personalNumber = pn; this.position = position; this.teamsIndexes = ReserveDutyEntity.MultiValuedParser(teamsIndexes); this.rank = ReserveDutyEntity.TranslateRankLiteral(rank); this.rankLiteral = rank; }
public void PopulateComboBox(ReserveDutyEntity selected) { int selectIndex = 0; comboBox_Soldier.Items.Clear(); foreach (ReserveDutyEntity item in this.manpower) { selectIndex = comboBox_Soldier.Items.Add(item.GetFullName()); if (item.ID == selected.ID) { comboBox_Soldier.SelectedIndex = selectIndex; } } }
public void PopulateCheckboxlist(ReserveDutyEntity man) { checkedListBox_Tasks.Items.Clear(); foreach (string item in man.qualifiedShiftsIndexes) { ShiftEntity s = this.shifts.Where(sh => sh.ID == item).FirstOrDefault(); if (s != null) { checkedListBox_Tasks.Items.Add(s.shiftName); } else { checkedListBox_Tasks.Items.Add("לא מזוהה"); } } }
public AddAssignation(List <ReserveDutyEntity> manPower, List <ShiftEntity> shifts, Assignation ass) { InitializeComponent(); comboBox_Soldier.Enabled = false; textBox_PersonalNumber.Enabled = false; this.manpower = manPower; this.shifts = shifts; ReserveDutyEntity res = manPower.Where(pn => pn.ID == ass.reserverDutyEntity.ID).FirstOrDefault(); PopulateComboBox(res); PopulateCheckboxlist(res, ass.shiftsIndexes); textBox_PersonalNumber.Text = ass.reserverDutyEntity.ID; dateTimePicker_startDate.Value = ass.startDate; dateTimePicker_Endate.Value = ass.endDate; currentAssignation = ass; }
public void PopulateCheckboxlist(ReserveDutyEntity man, string[] shiftIndexes) { checkedListBox_Tasks.Items.Clear(); foreach (string item in man.qualifiedShiftsIndexes) { ShiftEntity s = this.shifts.Where(sh => sh.ID == item).FirstOrDefault(); int i; if (s == null) { i = checkedListBox_Tasks.Items.Add("לא מזוהה"); } else { i = checkedListBox_Tasks.Items.Add(s.shiftName); } if (shiftIndexes.Contains(item)) { checkedListBox_Tasks.SetItemChecked(i, true); } } }