示例#1
0
        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);
        }
示例#2
0
        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;
        }
示例#3
0
        //private void BuildAssgination()
        //{
        //    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]);


        //    }
        //    AssignationStatus status = AssignationStatus.Approved;
        //    return (new Assignation("זימון חדש", pn, start, end, shiftIndexes, status.ToString()));


        //}
        private void button_Validate_Click(object sender, EventArgs e)
        {
            listBox_Log.Visible = false;
            listBox_Log.Items.Clear();
            Assignation temp = BuildAssgination(this.currentAssignation);

            AssignationStatus last = temp.status;

            temp.status = AssignationStatus.Approved;
            List <string> warnings = Program.f.ValidateAssignation(temp);

            if (warnings.Count > 0)
            {
                listBox_Log.Visible = true;
                foreach (string item in warnings)
                {
                    listBox_Log.Items.Add(item);
                }
            }
            temp.status = last; //Very cludgey
        }