コード例 #1
0
        //Calculates the monthly salary that the mothr should give for the nanny
        public Double salary(BE.Contract contract)
        {
            DateTime[,] matrix = convert(contract.workHoursTimestring);
            Double costForHour = contract.CostForHour;
            int    weekHours = 0, weekMinutes = 0;
            Double salary, temp;

            for (int i = 0; i < 6; i++)
            {
                weekHours   += matrix[i, 1].Hour - matrix[i, 0].Hour;
                weekMinutes += matrix[i, 1].Minute - matrix[i, 0].Minute;
            }
            weekHours   += weekMinutes / 60;
            weekMinutes %= 60;

            salary = weekHours * costForHour;
            temp   = (weekMinutes / 60) * costForHour;
            salary = (salary + temp) * 4;
            return(salary);
        }
コード例 #2
0
        public UpdateContract_Window()
        {
            InitializeComponent();
            contract         = new BE.Contract();
            this.DataContext = contract;
            bl = BL.FactoryBL.GetBL();
            this.numContract_comboBox.ItemsSource       = bl.GetAllContracts();
            this.numContract_comboBox.DisplayMemberPath = "NumContract";
            this.numContract_comboBox.SelectedValuePath = "NumContract";

            this.idChildComboBox.ItemsSource       = bl.GetAllChildren();
            this.idChildComboBox.DisplayMemberPath = "Id";
            this.idChildComboBox.SelectedValuePath = "Id";

            this.idNannyComboBox.ItemsSource       = bl.GetAllNannies();
            this.idNannyComboBox.DisplayMemberPath = "Id";
            this.idNannyComboBox.SelectedValuePath = "Id";

            this.howToPayComboBox.ItemsSource = Enum.GetValues(typeof(BE.Payment));
        }
コード例 #3
0
ファイル: DAL_IMP_XML.cs プロジェクト: hchirit/Csharp.net
        private XElement ConvertContract(BE.Contract C)
        {
            XElement newCONTRAT = new XElement("Contract",
                                               new XElement("contractNumber", C.ContractNumber),
                                               new XElement("EmployerID", C.EmployerId),
                                               new XElement("EmployeeId", C.EmployeeId),
                                               new XElement("DoInterview", C.DoInterview),
                                               new XElement("ContractIsSigned", C.ContractIsSigned),
                                               new XElement("BrutSalary", C.BrutSalary),
                                               new XElement("NetSalary", C.NetSalary),
                                               new XElement("JobBegins", C.JobBegins),
                                               new XElement("JobEndsup", C.JobEndsup),
                                               new XElement("HourPerWeek", C.HourPerWeek),
                                               new XElement("CompanyDateCreation", C.CompanyDateCreation),
                                               new XElement("City", C.city),
                                               new XElement("domain", C.Domain),
                                               new XElement("Commission", C.Commission)
                                               );

            return(newCONTRAT);
        }
コード例 #4
0
        public AddingContracts()
        {
            InitializeComponent();
            bl = FactoryBL.GetBL();

            str = new List <Nanny>();
            this.comboBoxChild.Text              = "-";
            this.comboBoxChild.ItemsSource       = bl.NeedNanny();
            this.comboBoxChild.SelectedValuePath = "id";
            this.comboBoxChild.DisplayMemberPath = "FullName";


            this.TypecomboBox.ItemsSource = Enum.GetValues(typeof(BE.ContractType));
            Cont             = new Contract();
            this.DataContext = Cont;
            Cont.DateEnd     = DateTime.Now;
            Cont.DateEnd     = Cont.DateEnd.AddYears(1);
            ContDatePicker.DisplayDateStart   = DateTime.Now.AddDays(1);
            this.TypecomboBox.IsEnabled       = false;
            dataGridNannies.ItemsSource       = str.AsEnumerable();
            dataGridNannies.SelectedValuePath = "id";
        }
コード例 #5
0
        //c-tor
        public ContractWindow()
        {
            InitializeComponent();
            bl = BL.FactoryBl.getBl();
            option.SelectionChanged += Option_SelectionChanged;
            contract = new BE.Contract();
            this.gridContract.DataContext         = contract;
            numContractComboBox.ItemsSource       = null;
            this.numContractComboBox.ItemsSource  = bl.getContracts();
            numContractComboBox.DisplayMemberPath = "NumContract";
            numContractComboBox.SelectedValuePath = "NumContract";
            this.idChildComboBox.ItemsSource      = bl.getChildren();
            idChildComboBox.DisplayMemberPath     = "idAndName";
            idChildComboBox.SelectedValuePath     = "id";
            this.idNannyComboBox.ItemsSource      = bl.getNannies();
            idNannyComboBox.DisplayMemberPath     = "idAndName";
            idNannyComboBox.SelectedValuePath     = "id";
            contract.BeginWork = DateTime.Now;
            contract.EndWork   = DateTime.Now.AddYears(1);
            this.hourOrMonthComboBox.ItemsSource = Enum.GetValues(typeof(BE.EHourOrMonth));

            errorMessages = new List <string>();
        }
コード例 #6
0
 //בחירת מספר חוזה
 private void numContractComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.numContractComboBox.SelectedItem is Contract)
     {
         this.contract = ((Contract)this.numContractComboBox.SelectedItem).GetCopy();
         this.gridContract.DataContext = contract;
         idChildComboBox.SelectedItem  = bl.getChildren(x => x.id == contract.IdChild).First();
         idNannyComboBox.SelectedItem  = bl.getNannies(x => x.id == contract.IdNanny).First();
         if (contract.HourOrMonth)
         {
             hourOrMonthComboBox.SelectedIndex = 0;
         }
         else
         {
             hourOrMonthComboBox.SelectedIndex = 1;
         }
         BestNannies.IsEnabled = true;
         BestNannies_WithCompromise.IsEnabled = true;
         bestNanniesComboBox.IsEnabled        = true;
         bestNanniesComboBox.ItemsSource      = null;
         bl.updateDataContract(contract);
     }
 }
        public UpdateContractWindow()
        {
            try
            {
                InitializeComponent();
                contract      = null;
                errorMessages = new List <string>();


                bl = BL.FactoryBL.GetBL();

                refreshData();

                this.updateContractConboBox.DisplayMemberPath = "ContractNum";
                this.updateContractConboBox.SelectedValuePath = "ContractNum";

                this.hourOrMonthComboBox.ItemsSource = Enum.GetValues(typeof(BE.Salary));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #8
0
ファイル: BL_imp.cs プロジェクト: elisheva100/DotNetProject
        public String addContract(BE.Contract c)
        {
            validContract(c);
            //try
            //{
            //    dal.addContract(c);
            //}
            //catch (InvalidCastException e)
            //{
            //    throw e;
            //}
            netSalary(c);
            try
            {
                properSalary(c);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            employeeVacation(c);
            car(c);
            try
            {
                c.signed = true;
                dal.addContract(c);
                //dal.updateEmployee(getEmployee(c.EmployeeId));
            }
            catch (InvalidCastException e)
            {
                throw e;
            }

            String str = homeWorker(c);

            return(str);
        }
コード例 #9
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string errorMassage = "";
                if (this.idChildComboBox.Text == "0")
                {
                    errorMassage += "You must enter identity number of child.\n";
                }
                if (this.idNannyComboBox.Text == "0")
                {
                    errorMassage += "You must enter identity number of nanny.\n";
                }
                if (this.startingDateDatePicker.Text == "01/01/0001")
                {
                    errorMassage += "You must enter a date of start working.\n";
                }
                if (this.endDateDatePicker.Text == "0")
                {
                    errorMassage += "You must enter a date of end working.\n";
                }
                if (errorMassage != "")
                {
                    throw new Exception(errorMassage);
                }

                bl.addContract(contract);
                contract          = new BE.Contract();
                grid1.DataContext = contract;
                MessageBox.Show("The contract successfully added ", "Informaion", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "missing!!", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
コード例 #10
0
 public void removeContract(BE.Contract contract)
 {
     ds.contracts.Remove(contract);
 }
コード例 #11
0
 public void addContract(BE.Contract contract)
 {
     ds.contracts.Add(contract);
 }
コード例 #12
0
 public void updateContract(BE.Contract contract)
 {
     removeContract(contract);
     addContract(contract);
 }
コード例 #13
0
 public void updateContract(BE.Contract contract)
 {
     dal.updateContract(contract);
 }
コード例 #14
0
        public void addContract(BE.Contract contract)
        {
            BE.Nanny  nannyTemp  = searchNanny(contract.IdOfNanny);
            BE.Mother motherTemp = searchMother(contract.IdOfMother);
            BE.Child  childTemp  = searchChild(contract.IdOfChild);
            contract.ContractNum = dal.configcontract();

            if (searchNanny(contract.IdOfNanny) != null) //if the nanny not exist
            {
                if (motherTemp != null)                  //if the mother not exist
                {
                    if (childTemp != null)               //if the child not exist
                    {
                        if (nannyTemp.CountChildren == nannyTemp.MxChildren)
                        {
                            throw (new Exception("There is no room for additional children by this nanni"));
                        }

                        if (contract.ContractByHour != nannyTemp.ByHour && nannyTemp.ByHour == false)
                        {
                            throw (new Exception("Nanny dont work by hour"));
                        }

                        if (childTemp.AgeYear > nannyTemp.MaxAge || childTemp.AgeYear < nannyTemp.MinAge || childTemp.AgeMonth < 3)
                        {
                            throw (new Exception("The child is not in the age that the nanni is willing to take"));
                        }

                        if (childTemp.IdOfNanny != "0")
                        {
                            throw (new Exception("The child is alredy on the contracts list"));
                        }


                        //if the contract sighned by hour, calculate the salary according the mothers hours
                        if (contract.ContractByHour == true)
                        {
                            contract.CostForHour         = nannyTemp.CostForHour;
                            contract.workHoursTimestring = motherTemp.workHoursTimestring;
                            contract.dayOfWork           = motherTemp.dayOfWork;
                            contract.Salary = salary(contract);
                        }
                        //if the contract sighned by month, calculate the salary according the nannys hours
                        else
                        {
                            contract.workHoursTimestring = nannyTemp.workHoursTimestring;
                            contract.dayOfWork           = nannyTemp.dayOfWork;
                            contract.Salary = nannyTemp.CostForMounth;
                        }
                        //If the mother has a contract with this nanny, there is a two percent discount for each child
                        foreach (var item in getChildOfNanni(nannyTemp))
                        {
                            if (item.IdOfMom == motherTemp.Id)
                            {
                                contract.Salary -= (2 / 100) * contract.Salary;
                            }
                        }
                        nannyTemp.CountChildren++;
                        updateNanny(nannyTemp);

                        childTemp.IdOfNanny   = contract.IdOfNanny;
                        childTemp.ContractNum = contract.ContractNum;
                        updateChild(childTemp);

                        contract.AddressOfNanny          = nannyTemp.Address;
                        contract.AddressOfMother         = motherTemp.AreaOfLookFor;
                        contract.IsTheContractBeenSigned = true;
                        dal.addContract(contract);
                    }
                    else
                    {
                        throw (new Exception("The child is not yet on the children's list"));
                    }
                }
                else
                {
                    throw (new Exception("The mother is not yet on the mother's list"));
                }
            }
            else
            {
                throw (new Exception("The nanni is not yet on the nanni's list"));
            }
        }
コード例 #15
0
 public void UpdateContract(Contract contract)
 {
     dal.UpdateContract(contract);
 }
コード例 #16
0
 private void DeleteContractComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     contract = DeleteContractComboBox.SelectedItem as Contract;
 }