public CompteGPivot GetCompteG(long?id)
        {
            var          compteg      = compteGRepository.GetById((int)id);
            CompteGPivot comptegPivot = Mapper.Map <CPT_CompteG, CompteGPivot>(compteg);

            return(comptegPivot);
        }
예제 #2
0
        public ActionResult DeleteConfirmed([Bind(Include = "Id")] CPT_CompteGFormViewModel cpt_calsses)
        {
            CompteGPivot cods  = Mapper.Map <CPT_CompteGFormViewModel, CompteGPivot>(cpt_calsses);
            CompteGPivot codes = compteGServise.GetCompteG(cods.Id);


            compteGServise.DeletCompteGPivot(codes);
            // db.SaveChanges();
            compteGServise.SaveCompteGPivot();
            return(RedirectToAction("Index"));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "Id,Code,Libelle,IdClasse,IdTypeCompte,IdNatureCompte,IdCodeTvaDefault,Ana,Rappro,Lettrage,Pointage,Sens,Actif,SuiviCompteTVA,ReportANouveau,IdDossier")] CompteGPivot cpt_comptes)
        {
            // if (ModelState.IsValid)
            if (cpt_comptes != null)
            {
                if (cpt_comptes.Id > 0)
                {
                    cpt_comptes.IdDossier        = Constantes.IdentifiantDossier;
                    cpt_comptes.sys_dateUpdate   = DateTime.Now;
                    cpt_comptes.sys_dateCreation = DateTime.Now;
                    cpt_comptes.sys_user         = Constantes.IdentifiantUser;
                    cpt_comptes.Actif            = true;
                    cpt_comptes.IdCodeTvaDefault = null;
                    cpt_comptes.IdClasse         = 1;

                    compteGServise.UpdateCompteGPivot(cpt_comptes);
                    compteGServise.SaveCompteGPivot();
                }
                else
                {
                    cpt_comptes.IdDossier        = Constantes.IdentifiantDossier;
                    cpt_comptes.sys_dateUpdate   = DateTime.Now;
                    cpt_comptes.sys_dateCreation = DateTime.Now;
                    cpt_comptes.sys_user         = Constantes.IdentifiantUser;
                    cpt_comptes.IdCodeTvaDefault = null;
                    cpt_comptes.IdClasse         = 1;

                    cpt_comptes.Actif = true;


                    compteGServise.CreateCompteGPivot(cpt_comptes);
                    compteGServise.SaveCompteGPivot();
                }


                return(RedirectToAction("Index"));
            }



            ViewBag.IdDossier = new SelectList(dossiersService.GetActifDossier(), "DossierId", "CodeDossier", cpt_comptes.IdDossier);
            CPT_CompteGFormViewModel cpt_comptsFormModel = Mapper.Map <CompteGPivot, CPT_CompteGFormViewModel>(cpt_comptes);

            return(View(cpt_comptsFormModel));
        }
예제 #4
0
        public ActionResult Delete(long?id)
        {
            ViewBag.IdDossier = new SelectList(dossiersService.GetActifDossier(), "DossierId", "CodeDossier");
            //db.GEN_Dossiers.Where(e => e.Actif), "Id", "CodeDossier");
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CompteGPivot cpt_compte = compteGServise.GetCompteG((int)id);

            //db.GEN_Devises.Find(id);
            if (cpt_compte == null)
            {
                return(HttpNotFound());
            }

            CPT_CompteGFormViewModel cpt_codd = Mapper.Map <CompteGPivot, CPT_CompteGFormViewModel>(cpt_compte);

            return(View(cpt_codd));
        }
예제 #5
0
        public ActionResult Edit([Bind(Include = "Id,Code,Libelle,IdClasse,IdTypeCompte,IdNatureCompte,IdCodeTvaDefault,Ana,Rappro,Lettrage,Pointage,Sens,Actif,SuiviCompteTVA,ReportANouveau,IdDossier")] CompteGPivot cpt_compteG)
        {
            if (ModelState.IsValid)
            {
                cpt_compteG.IdDossier        = Constantes.IdentifiantDossier;
                cpt_compteG.sys_dateUpdate   = DateTime.Now;
                cpt_compteG.sys_dateCreation = DateTime.Now;
                cpt_compteG.sys_user         = Constantes.IdentifiantUser;
                compteGServise.UpdateCompteGPivot(cpt_compteG);
                //   db.SaveChanges();
                compteGServise.SaveCompteGPivot();
                return(RedirectToAction("Index"));
            }
            ViewBag.IdDossier = new SelectList(dossiersService.GetActifDossier(), "DossierId", "CodeDossier", cpt_compteG.IdDossier);
            //db.GEN_Dossiers.Where(e => e.Actif), "Id", "CodeDossier", gEN_Devises.IdDossier);

            CPT_CompteGFormViewModel cpt_compteGFormModel = Mapper.Map <CompteGPivot, CPT_CompteGFormViewModel>(cpt_compteG);

            return(View(cpt_compteGFormModel));
        }
 public void UpdateCompteGPivot(CompteGPivot CompteG)
 {
     compteGRepository.Update(CompteG.Id, Mapper.Map <CompteGPivot, CPT_CompteG>(CompteG));
 }
 public void DeletCompteGPivot(CompteGPivot CompteG)
 {
     compteGRepository.Delete(CompteG.Id, Mapper.Map <CompteGPivot, CPT_CompteG>(CompteG));
 }
        public void CreateCompteGPivot(CompteGPivot CompteG)
        {
            CPT_CompteG clas = Mapper.Map <CompteGPivot, CPT_CompteG>(CompteG);

            compteGRepository.Add(clas);
        }