コード例 #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            int id;

            try
            {
                if (contrat.contractID != 0 && contrat.numHours != 0 && contrat.professionalID != 0 && contrat.salaryBrute != 0)
                {
                    int.TryParse(comboBox.SelectedItem.ToString(), out id);
                    contrat.employerID = id;
                    bl.addcontract(contrat);
                    contrat          = new BE.contract();
                    this.DataContext = contrat;
                    showDataGridView();
                }
                else
                {
                    throw new Exception(" impossible to enter 0  !!");
                }
            }
            catch (Exception ex)
            {
                showDataGridView();
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
 public ADD_CONTRACT(BL.IBL Bl)
 {
     this.bl = Bl;
     InitializeComponent();
     contrat          = new BE.contract();
     this.DataContext = contrat;
     bl = BL.FactoryBL.GetBL();
     showDataGridView();
     this.expertiseComboBox.ItemsSource = Enum.GetValues(typeof(BE.expertise));
     foreach (int id in bl.return_names_id_employer())
     {
         comboBox.Items.Add(id);
     }
 }
コード例 #3
0
        private XElement ConvertCONTRACT(BE.contract C)
        {
            XElement newCONTRACT = new XElement("Contract",
                                                new XElement("contractID", C.contractID),
                                                new XElement("employerID", C.employerID),
                                                new XElement("employeeID", C.employeeID),
                                                new XElement("professionalID", C.professionalID),
                                                new XElement("isSigned", C.isSigned),
                                                new XElement("salaryBrute", C.salaryBrute),
                                                new XElement("salaryNet", C.salaryNet),
                                                new XElement("beginning", C.beginning),
                                                new XElement("end", C.end),
                                                new XElement("numHours", C.numHours),
                                                new XElement("expertise", C.expertise),
                                                new XElement("city", C.city),
                                                new XElement("commission", C.commission)
                                                );

            return(newCONTRACT);
        }
コード例 #4
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            int id;
            int id_e;

            try
            {
                TimeSpan t = contrat.beginning - contrat.end;

                if (t.Days > 0)//error in date contract
                {
                    throw new Exception("error date end before date begining");
                }

                if (comboBox_city.SelectedValue == null && comboBox_Copy.SelectedValue == null && comboBox.SelectedValue == null && expertiseComboBox.SelectedValue == null)//field empty
                {
                    throw new Exception("you don't have select a combobox");
                }
                if (contrat.contractID != 0 && contrat.numHours != 0 && contrat.professionalID != 0 && contrat.salaryBrute != 0)
                {
                    contrat.city = comboBox_city.SelectedItem.ToString();
                    int.TryParse(comboBox_Copy.SelectedItem.ToString(), out id_e);
                    contrat.employeeID = id_e;
                    int.TryParse(comboBox.SelectedItem.ToString(), out id);
                    contrat.employerID = id;
                    bl.addcontract(contrat);
                    contrat          = new BE.contract();
                    this.DataContext = contrat;
                    showDataGridView();
                }
                else
                {
                    throw new Exception(" impossible to enter 0  !!");
                }
            }
            catch (Exception ex)
            {
                showDataGridView();
                MessageBox.Show(ex.Message);
            }
        }
コード例 #5
0
 public ADD_CONTRACT(BL.IBL Bl)//ctor
 {
     this.bl = Bl;
     InitializeComponent();
     contrat          = new BE.contract();
     this.DataContext = contrat;
     bl = BL.FactoryBL.GetBL();
     showDataGridView();
     this.expertiseComboBox.ItemsSource = Enum.GetValues(typeof(BE.expertise));
     contrat.beginning = DateTime.Now;
     contrat.end       = DateTime.Now;
     foreach (int id in bl.return_names_id_employer())
     {
         comboBox.Items.Add(id);
     }
     foreach (int id in bl.return_names_id_employee())
     {
         comboBox_Copy.Items.Add(id);
     }
     this.comboBox_city.ItemsSource = Enum.GetValues(typeof(BE.city));
 }