예제 #1
0
 public void uptdatecontract(contract c)        //update the contract
 {
     if (seaurchID_existcontract(c.contractID)) //verifie if exist
     {
         XElement ct = (from p in CONTRACT_ROOT.Elements()
                        where Convert.ToInt32(p.Element("contractID").Value) == c.contractID
                        select p).FirstOrDefault();//select the xelement
         //change the value of this xelement
         ct.Element("employerID").Value     = c.employerID.ToString();
         ct.Element("employeeID").Value     = c.employeeID.ToString();
         ct.Element("professionalID").Value = c.professionalID.ToString();
         ct.Element("isSigned").Value       = c.isSigned.ToString();
         ct.Element("salaryBrute").Value    = c.salaryBrute.ToString();
         ct.Element("salaryNet").Value      = c.salaryNet.ToString();
         ct.Element("beginning").Value      = c.beginning.ToString();
         ct.Element("end").Value            = c.end.ToString();
         ct.Element("numHours").Value       = c.numHours.ToString();
         ct.Element("expertise").Value      = c.expertise.ToString();
         ct.Element("city").Value           = c.city;
         ct.Element("commission").Value     = c.commission.ToString();
         CONTRACT_ROOT.Save(CONTRACT_path);//save it
     }
     else
     {
         throw new NotImplementedException("id doesn't exist");
     }
 }
예제 #2
0
        public void uptdatecontract(contract c)
        {
            if (c.contractID == 0)
            {
                throw new Exception("the specialization doesn't have a  id");
            }

            else
            {
                removecontract(c);
                addcontract(c);
            }
        }
예제 #3
0
 public void removecontract(contract c)         //remove a contract
 {
     if (seaurchID_existcontract(c.contractID)) //verifie if a contract exist with this id
     {
         XElement contrat_delete = (from s in CONTRACT_ROOT.Elements()
                                    where s.Element("contractID").Value == c.contractID.ToString()
                                    select s).First(); //select this XELEMENT
         contrat_delete.Remove();                      //remove from the xml file
         SaveFiles();                                  //save the files
     }
     else
     {
         throw new NotImplementedException("id doesn't exist");
     }
 }
예제 #4
0
 public void removecontract(contract c)
 {
     if (seaurchID_existcontract(c.contractID))
     {
         XElement contrat_delete = (from s in CONTRACT_ROOT.Elements()
                                    where s.Element("contractID").Value == c.contractID.ToString()
                                    select s).First();
         contrat_delete.Remove();
         SaveFiles();
         //   throw new NotImplementedException("is deleted !!");
     }
     else
     {
         throw new NotImplementedException("id doesn't exist");
     }
 }
예제 #5
0
        public void uptdatecontract(contract c)// receive an objet contact and update his parameters
        {
            int id = c.contractID;

            if (DS.DataSource.contractList.Exists(d => d.contractID == c.contractID))
            {
                int index = DS.DataSource.contractList.FindIndex(x => x.contractID == c.contractID);
                if (index != -1)
                {
                    DataSource.contractList[index] = c;
                }
                else
                {
                    throw new KeyNotFoundException(" The contractId Id doesn't exist  : " + id);
                }
            }
        }
예제 #6
0
        public void addcontract(contract c)
        {
            if (c.contractID == 0)
            {
                throw new Exception("the specialization doesn't have a  id");
            }

            else if (seaurchID_existcontract(c.contractID))
            {
                throw new Exception("the specialization id :" + c.contractID + " exist");
            }
            else if (seaurchID_existEmployer(c.contractID) == true)
            {
                throw new NotImplementedException("EMPLOYER ID DOESN'T EXIST !!");
            }
            else
            {
                CONTRACT_ROOT.Add(ConvertCONTRACT(c));
                SaveFiles();
            }
        }
예제 #7
0
        public void addcontract(contract c)  //add contract
        {
            Employee temp  = searchId_find_employee(c.employeeID);
            Employer temp1 = searchId_find_employer(c.employerID);

            if (c.contractID == 0)
            {
                throw new Exception("the specialization doesn't have a  id");
            }

            else if (seaurchID_existcontract(c.contractID))
            {
                throw new Exception("the specialization id :" + c.contractID + " exist");
            }
            else if (seaurchID_existEmployer(c.contractID) == true)
            {
                throw new NotImplementedException("EMPLOYER ID DOESN'T EXIST !!");
            }
            else
            {
                CONTRACT_ROOT.Add(ConvertCONTRACT(c)); //convert in xelement and add to the files
                SaveFiles();                           //save the files
            }
        }
예제 #8
0
 public void removecontract(contract c)// receive an objet contract in parameter and delete it from the list in the ds
 {
     DS.DataSource.contractList.Remove(c);
 }
예제 #9
0
 public void addcontract(contract c)//add contract :save in list of contract in data source
 {
     DS.DataSource.contractList.Add(c);
 }
예제 #10
0
 public void removecontract(contract c)
 {
     DS.DataSource.contractList.Remove(c);
 }
예제 #11
0
 public void addcontract(contract c)
 {
     DS.DataSource.contractList.Add(c);
 }