Esempio n. 1
0
        private void MapDALObject()
        {
            CRDALObject = new CompteResult();

            CRDALObject.Id              = Id;
            CRDALObject.Name            = Name;
            CRDALObject.CompanyIds      = ParentCompanyIds;
            CRDALObject.CompanyNames    = ParentCompanyNames;
            CRDALObject.AssurIds        = AssurIds;
            CRDALObject.AssurNames      = AssurNames;
            CRDALObject.SubsidIds       = SubsidIds;
            CRDALObject.SubsidNames     = SubsidNames;
            CRDALObject.ContractIds     = ContractIds;
            CRDALObject.ContractNames   = ContractNames;
            CRDALObject.ReportLevelId   = ReportLevelId;
            CRDALObject.CollegeId       = CollegeId;
            CRDALObject.UserName        = UserName;
            CRDALObject.CreationDate    = CreationDate;
            CRDALObject.IsActive        = IsActive;
            CRDALObject.IsAutoGenerated = IsAutoGenerated;
            CRDALObject.ReportType      = ReportType.ToString();

            CRDALObject.TaxActif   = TaxAct;
            CRDALObject.TaxDefault = TaxDef;
            CRDALObject.TaxPerif   = TaxPer;
        }
Esempio n. 2
0
        public void UpdateDBRecord()
        {
            try
            {
                if (Id == 0)
                {
                    throw new Exception("Id cannot be 0 - Source: BLCompteResultat::UpdateDBRecord");
                }

                MapDALObject();
                CompteResult.Update(CRDALObject);

                //Update Planning information
                //### update Planning only if there is only one single Planning available - otherwise we don't know which Planning shoul dbe updated
                //we also need to retrieve the Id of that Planning

                List <CRPlanning> oldPls = CRPlanning.GetCRPlannngForComptesResultat(Id);

                if (oldPls.Count == 1)
                {
                    CRPlanning newPl = CRPlannings[0];

                    newPl.CRId = Id;
                    newPl.Id   = oldPls[0].Id;
                    CRPlanning.Update(newPl);
                }
            }
            catch (Exception ex)
            {
                log.Error("UpdateDBRecord :: " + ex.Message);
                throw ex;
            }
        }
Esempio n. 3
0
 public static void DeleteCompteResultat(int CRId)
 {
     try
     {
         CompteResult.Delete(CRId);
     }
     catch (Exception ex)
     {
         log.Error(ex.Message);
         throw ex;
     }
 }
Esempio n. 4
0
 public void DeleteCompteResultat()
 {
     try
     {
         MapDALObject();
         CompteResult.Delete(CRDALObject);
     }
     catch (Exception ex)
     {
         log.Error(ex.Message);
         throw ex;
     }
 }
Esempio n. 5
0
        public int CreateNewCompteResultat()
        {
            try
            {
                //verify if our CR is at the level of the assur or the level of a parent company
                //if more than 1 parent company was selected, the level is assur
                bool crIsAssurLevel = true;
                if (!ParentCompanyIds.Contains(C.cVALSEP))
                {
                    crIsAssurLevel = false;
                }

                List <string> parentCompanyList = Regex.Split(ParentCompanyIds, C.cVALSEP).ToList();
                List <string> assurList         = Regex.Split(AssurIds, C.cVALSEP).ToList();

                if (crIsAssurLevel)
                {
                    Id = CompteResult.GetIdForCRNameAndAssur(Name, assurList[0]);
                }
                else
                {
                    Id = CompteResult.GetIdForCRNameAndParentComp(Name, parentCompanyList[0]);
                }

                if (Id != C.cINVALIDID)
                {
                    CRExists = true;
                    UpdateDBRecord();
                }
                else
                {
                    CRExists = false;
                    Id       = AddDBRecord();
                }

                //Create Excel Docs
                foreach (CRPlanning crp in CRPlannings)
                {
                    CreateExcelDoc(Id, crp);
                }

                return(Id);
            }
            catch (Exception ex)
            {
                log.Error("CreateNewCompteResultat :: " + ex.Message);
                throw ex;
            }
        }
Esempio n. 6
0
        public int AddDBRecord()
        {
            try
            {
                int crId = 0;

                MapDALObject();
                crId = CompteResult.Insert(CRDALObject);

                //add the planning information
                foreach (CRPlanning crp in CRPlannings)
                {
                    crp.CRId = crId;
                    CRPlanning.Insert(crp);
                }

                return(crId);
            }
            catch (Exception ex)
            {
                log.Error("AddDBRecord :: " + ex.Message);
                throw ex;
            }
        }