Esempio n. 1
0
        public void UpdateDossierPivot(DossiersPivot dossiers)
        {
            var vrr = Mapper.Map <DossiersPivot, GEN_Dossiers>(dossiers);

            dossiersRepository.Update(dossiers.DossierId, vrr);
            //Update(dossiers.DossierId,vrr);
        }
Esempio n. 2
0
        public DossiersPivot GetDossiersPivot(long id)
        {
            var           dossiers      = dossiersRepository.GetById((int)id);
            DossiersPivot dossiersPivot = Mapper.Map <GEN_Dossiers, DossiersPivot>(dossiers);

            return(dossiersPivot);
        }
Esempio n. 3
0
        public DossiersPivot getingDossierActif()
        {
            GEN_Dossiers  dossiers      = dossiersRepository.GetDossierActif();
            DossiersPivot dossiersPivot = Mapper.Map <GEN_Dossiers, DossiersPivot>(dossiers);

            return(dossiersPivot);
        }
Esempio n. 4
0
        public DossiersPivot GetDossiersAndInclude(long?id)
        {
            GEN_Dossiers  dossiers      = dossiersRepository.GetAdossierIncluding(id);
            DossiersPivot dossiersPivot = Mapper.Map <GEN_Dossiers, DossiersPivot>(dossiers);

            return(dossiersPivot);
        }
 public ActionResult Edit([Bind(Include = "DossierId,CodeDossier,DossierRaisonSociale,IdTypeDossier,DossierAdresse,DossierTel,DossierFax,DossierEmail,DossierVille,DossierPays,DossierSiteWeb,DossierCapitalSocial,IdDeviseTenueCompte,DossierIdentifiantFiscale,DossierIdentifiantTVA,DossierPatente,DossierRegistreCommerce,DossierNumeroCNSS,DossierICE,DossierComptaActif,DossierGescomAtif,DossierPaieActif,DossierActif,DossierCleSecuriteCompta,DossierCleSecuritePaie,DossierCleSecuriteGescom,DossierCleSecurite")] DossiersPivot gEN_Dossiers)
 {
     if (ModelState.IsValid)
     {
         // db.Entry(gEN_Dossiers).State = EntityState.Modified;
         dossiersServise.UpdateDossierPivot(gEN_Dossiers);
         //   db.SaveChanges();
         dossiersServise.SaveDossiers();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdSociete = new SelectList(dossiersServise.GetDossier(), "DossierId", "DossierRaisonSociale", gEN_Dossiers.DossierId);
     //db.GEN_Societes, "Id", "RaisonSociale", gEN_Dossiers.IdSociete);
     return(View(gEN_Dossiers));
 }
        // GET: Commun/Dossiers/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DossiersPivot gEN_Dossiers = dossiersServise.GetDossiersPivot(id);

            //db.GEN_Dossiers.Find(id);
            if (gEN_Dossiers == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdSociete = new SelectList(dossiersServise.GetDossier(), "DossierId", "DossierRaisonSociale", gEN_Dossiers.DossierId);

            return(View(gEN_Dossiers));
        }
        // GET: Commun/Dossiers/Delete/5
        public ActionResult Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DossiersPivot gEN_Dossiers = dossiersServise.GetDossiersPivot(id);

            //db.GEN_Dossiers.Find(id);
            ViewBag.IdTypeDossier = new SelectList(dossiersServise.GetingModelItem(Model1), "Id", "Libelle", gEN_Dossiers.IdTypeDossier);
            //db.GEN_Items.Where(e => e.GEN_Model.Model == "FormeJuridique" && e.GEN_Model.IdSociete == CurrentSocieteId), "Id", "Libelle", gEN_Dossiers.IdTypeSociete);
            ViewBag.DossierPays = new SelectList(dossiersServise.GetingModelItem(Model2), "Id", "Libelle", gEN_Dossiers.IdTypeDossier);
            //db.GEN_Items.Where(e => e.GEN_Model.Model == "Pays" && e.GEN_Model.IdSociete == CurrentSocieteId), "Id", "Libelle", gEN_Dossiers.Pays);
            ViewBag.IdDeviseTenueCompte = new SelectList(devisesService.GetDeviseByCond(), "DevisesId", "DevisesCode", gEN_Dossiers.IdDeviseTenueCompte);
            //db.GEN_Devises.Where(e => e.IdDossier == CurrentPreference.IdDossier), "Id", "Code", gEN_Dossiers.IdDeviseTenueCompte);
            if (gEN_Dossiers == null)
            {
                return(HttpNotFound());
            }
            return(View(gEN_Dossiers));
        }
        public ActionResult DeleteConfirmed([Bind(Include = "DossierId")] DossierFormViewModel gEN_dossiers)
        {
            DossiersPivot gEN_Dossiers = dossiersServise.GetDossiersPivot(gEN_dossiers.DossierId);

            //db.GEN_Dossiers.Find(id);
            //var test = from b in db.CPT_Pieces where b.IdDossier == gEN_Dossiers.Id select b;
            var test = dossiersServise.GetCPT_Piece(gEN_Dossiers.DossierId);

            if (test.Count() > 0)
            {
                TempData["errorMessage"] = "Vous ne pouvez pas supprimer ce dossier car une pièce est crée dans ce dossier ";
                return(RedirectToAction("Create", new { id = gEN_Dossiers.DossierId }));
            }
            else
            {
                //db.GEN_Dossiers.Remove(gEN_Dossiers);
                dossiersServise.DeleteDossiersPivot(gEN_Dossiers);
                // db.SaveChanges();
                dossiersServise.SaveDossiers();
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult SaveDataSites()
        {
            GridModel gridModel = new GridModel();
            List <Transaction <DossiersSitesPivot> > transactions = gridModel.LoadTransactions <DossiersSitesPivot>(HttpContext.Request.Form["ig_transactions"]);
            //var orders = RepositoryFactory.GetOrderRepository();
            long idDossier = 0;

            foreach (Transaction <DossiersSitesPivot> t in transactions)
            {
                int id = 0;
                Int32.TryParse(t.rowId, out id);

                if (idDossier == 0)
                {
                    if (t.row != null)
                    {
                        long.TryParse(t.row.IdDossier.Value.ToString(), out idDossier);
                        if (idDossier == 0)
                        {
                            //  var gEN_Dossiers = db.GEN_Dossiers.Where(x => x.Actif == false && x.CodeDossier == "").FirstOrDefault();
                            var gEN_Dossiers = dossiersServise.getingDossierActif();
                            if (gEN_Dossiers == null)
                            {
                                gEN_Dossiers = new DossiersPivot();
                                gEN_Dossiers.DossierActif         = false;
                                gEN_Dossiers.CodeDossier          = "";
                                gEN_Dossiers.DossierRaisonSociale = "";
                                //using (var dbIgnoreValidation = new StoreEntities())
                                //{
                                //    dbIgnoreValidation.Configuration.ValidateOnSaveEnabled = false;
                                //    dbIgnoreValidation.Dossiers.Add();
                                //    //Add(gEN_Dossiers);
                                //    dbIgnoreValidation.SaveChanges();
                                //}
                                dossiersServise.Validation_Db(gEN_Dossiers);

                                //db.GEN_Dossiers.Add(gEN_Dossiers);
                                //db.SaveChanges();
                            }
                            idDossier = gEN_Dossiers.DossierId;
                        }
                    }
                }


                //var row = db.GEN_DossiersSites.Find(id);
                var row = dossiersSitesService.GetDossiersSitePivot(id);
                if ((t.type == "newrow") || (row == null && (t.type == "row")))
                {
                    t.row.IdDossier        = idDossier;
                    t.row.sys_dateCreation = DateTime.Now;
                    t.row.sys_dateUpdate   = DateTime.Now;
                    t.row.sys_user         = Constantes.IdentifiantUser;
                    //t.row.Actif = true;
                    //db.GEN_DossiersSites.Add(t.row);
                    dossiersSitesService.CreateDossiersSitePivot(t.row);
                    /***/ dossiersSitesService.SaveDossiersSite();
                }
                else if (t.type == "deleterow")
                {
                    //var row = db.GEN_DossiersSites.Find(id);
                    if (row != null)
                    {
                        // db.GEN_DossiersSites.Remove(row);
                        dossiersSitesService.DeleteDossiersSitePivot(row);
                        /***/ dossiersSitesService.SaveDossiersSite();
                    }
                }
                else if (t.type == "row")
                {
                    row.Nom        = t.row.Nom;
                    row.Adresse    = t.row.Adresse;
                    row.ParDefault = t.row.ParDefault;
                    row.Actif      = t.row.Actif;
                    row.Adresse    = t.row.Adresse;
                    row.Email      = t.row.Email;
                    row.Tel        = t.row.Tel;
                    row.Fax        = t.row.Fax;
                    //row.IdDossier = t.row.IdDossier;
                    row.Pays             = t.row.Pays;
                    row.Ville            = t.row.Ville;
                    t.row.sys_dateUpdate = DateTime.Now;
                    //row.Civilite = t.row.Civilite;
                    //row.Nom = t.row.Nom;
                    //row.Prenom = t.row.Prenom;
                    //row.Tel = t.row.Tel;
                    //row.Email = t.row.Email;

                    // db.Entry(row).State = EntityState.Modified;
                    dossiersSitesService.UpdateDossierSitePivot(row);
                    /****/
                    dossiersSitesService.SaveDossiersSite();
                }
            }

            // db.SaveChanges();
            dossiersSitesService.SaveDossiersSite();
            JsonResult result = new JsonResult();
            Dictionary <string, bool> response = new Dictionary <string, bool>();

            response.Add("Success", true);
            result.Data = response;
            return(result);
        }
        public ActionResult Create([Bind(Include = "DossierId,CodeDossier,DossierRaisonSociale,IdTypeDossier,DossierAdresse,DossierTel,DossierFax,DossierEmail,DossierVille,DossierPays,DossierSiteWeb,DossierCapitalSocial,IdDeviseTenueCompte,DossierIdentifiantFiscale,DossierIdentifiantTVA,DossierPatente,DossierRegistreCommerce,DossierNumeroCNSS,DossierICE,DossierComptaActif,DossierGescomAtif,DossierPaieActif,DossierActif,DossierCleSecuriteCompta,DossierCleSecuritePaie,DossierCleSecuriteGescom,DossierCleSecurite")] DossiersPivot gEN_Dossiers)
        {
            ViewBag.IdTypeDossier = new SelectList(dossiersServise.GetingModelItem(Model1), "Id", "Libelle", gEN_Dossiers.IdTypeDossier);
            //new SelectList(db.GEN_Items.Where(e => e.GEN_Model.Model == "FormeJuridique" && e.GEN_Model.IdSociete == CurrentSocieteId), "Id", "Libelle", gEN_Dossiers.IdTypeSociete);
            // ViewBag.Pays = new SelectList(db.GEN_Items.Where(e => e.GEN_Model.Model == "Pays" && e.GEN_Model.IdSociete == CurrentSocieteId), "Id", "Libelle", gEN_Dossiers.Pays);
            ViewBag.DossierPays = new SelectList(dossiersServise.GetingModelItem(Model2), "Id", "Libelle", gEN_Dossiers.DossierPays);



            // ViewBag.IdDeviseTenueCompte = new SelectList(db.GEN_Devises.Where(e => e.IdDossier == CurrentPreference.IdDossier && e.Actif), "Id", "Code", gEN_Dossiers.IdDeviseTenueCompte);
            ViewBag.IdDeviseTenueCompte = new SelectList(devisesService.GetDeviseByCond(), "DevisesId", "DevisesCode", gEN_Dossiers.IdDeviseTenueCompte);

            var errors = ModelState.Where(x => x.Key != "DossierId").Select(x => x.Value.Errors).Where(y => y.Count > 0).ToList();

            if (errors.Count == 0)
            {
                DossiersPivot gen_dossierCreer = gEN_Dossiers;
                if (gEN_Dossiers.DossierId > 0)
                {
                    // gen_dossierCreer.IdSociete = CurrentSocieteId;
                    //gen_dossierCreer.Doss = CurrentSocieteId;
                    gen_dossierCreer.DossierActif          = true;
                    gen_dossierCreer.Dossiersys_user       = Constantes.IdentifiantUser;
                    gen_dossierCreer.Dossiersys_dateUpdate = DateTime.Now;
                    //db.Entry(gEN_Dossiers).State = EntityState.Modified;
                    dossiersServise.UpdateDossierPivot(gen_dossierCreer);
                    dossiersServise.SaveDossiers();
                }
                else
                {
                    gen_dossierCreer = dossiersServise.getingDossierActif();

                    //db.GEN_Dossiers.Where(x => x.Actif == false && x.CodeDossier == "").FirstOrDefault();


                    if (gen_dossierCreer == null)
                    {
                        gen_dossierCreer = gEN_Dossiers;
                        gen_dossierCreer.DossierActif            = true;
                        gen_dossierCreer.Dossiersys_dateCreation = DateTime.Now;
                        gen_dossierCreer.Dossiersys_dateUpdate   = DateTime.Now;
                        gen_dossierCreer.Dossiersys_user         = Constantes.IdentifiantUser;
                        //  gen_dossierCreer.DossierIdSociete = CurrentSocieteId;

                        // db.GEN_Dossiers.Add(gen_dossierCreer);
                        dossiersServise.CreateDossiersPivot(gen_dossierCreer);
                        dossiersServise.SaveDossiers();
                        //db.SaveChanges();
                    }
                    else
                    {
                        gen_dossierCreer.DossierActif             = gEN_Dossiers.DossierActif;
                        gen_dossierCreer.DossierAdresse           = gEN_Dossiers.DossierAdresse;
                        gen_dossierCreer.DossierCapitalSocial     = gEN_Dossiers.DossierCapitalSocial;
                        gen_dossierCreer.DossierCleSecurite       = gEN_Dossiers.DossierCleSecurite;
                        gen_dossierCreer.DossierCleSecuriteCompta = gEN_Dossiers.DossierCleSecuriteCompta;
                        gen_dossierCreer.DossierCleSecuriteGescom = gEN_Dossiers.DossierCleSecuriteGescom;
                        gen_dossierCreer.DossierCleSecuritePaie   = gEN_Dossiers.DossierCleSecuritePaie;
                        gen_dossierCreer.CodeDossier               = gEN_Dossiers.CodeDossier;
                        gen_dossierCreer.DossierComptaActif        = gEN_Dossiers.DossierComptaActif;
                        gen_dossierCreer.DossierEmail              = gEN_Dossiers.DossierEmail;
                        gen_dossierCreer.DossierFax                = gEN_Dossiers.DossierFax;
                        gen_dossierCreer.DossierGescomAtif         = gEN_Dossiers.DossierGescomAtif;
                        gen_dossierCreer.DossierICE                = gEN_Dossiers.DossierICE;
                        gen_dossierCreer.IdDeviseTenueCompte       = gEN_Dossiers.IdDeviseTenueCompte;
                        gen_dossierCreer.DossierIdentifiantFiscale = gEN_Dossiers.DossierIdentifiantFiscale;
                        gen_dossierCreer.DossierIdentifiantTVA     = gEN_Dossiers.DossierIdentifiantTVA;
                        gen_dossierCreer.IdTypeDossier             = gEN_Dossiers.IdTypeDossier;
                        gen_dossierCreer.DossierNumeroCNSS         = gEN_Dossiers.DossierNumeroCNSS;
                        gen_dossierCreer.DossierPaieActif          = gEN_Dossiers.DossierPaieActif;
                        gen_dossierCreer.DossierPatente            = gEN_Dossiers.DossierPatente;
                        gen_dossierCreer.DossierPays               = gEN_Dossiers.DossierPays;
                        gen_dossierCreer.DossierRaisonSociale      = gEN_Dossiers.DossierRaisonSociale;
                        gen_dossierCreer.DossierRegistreCommerce   = gEN_Dossiers.DossierRegistreCommerce;
                        gen_dossierCreer.DossierSiteWeb            = gEN_Dossiers.DossierSiteWeb;
                        gen_dossierCreer.DossierTel                = gEN_Dossiers.DossierTel;
                        gen_dossierCreer.DossierVille              = gEN_Dossiers.DossierVille;
                        gen_dossierCreer.Dossiersys_dateUpdate     = DateTime.Now;
                        gen_dossierCreer.Dossiersys_dateCreation   = DateTime.Now;
                        gen_dossierCreer.Dossiersys_user           = Constantes.IdentifiantUser;
                        //gen_dossierCreer.DossierIdSociete = CurrentSocieteId;

                        // db.Entry(gen_dossierCreer).State = EntityState.Modified;
                        dossiersServise.UpdateDossierPivot(gen_dossierCreer);
                        dossiersServise.SaveDossiers();
                    }
                }

                //db.SaveChanges();
                dossiersServise.SaveDossiers();
                return(RedirectToAction("Index"));
                // return RedirectToAction("Create", new { id = gen_dossierCreer.DossierId });
            }


            DossierFormViewModel gEN_Doss = Mapper.Map <DossiersPivot, DossierFormViewModel>(gEN_Dossiers);

            return(View(gEN_Doss));
        }
Esempio n. 11
0
 public void UpdateDossiersContactsPivot(DossiersPivot dossiers)
 {
     dossiersRepository.Update(Mapper.Map <DossiersPivot, GEN_Dossiers>(dossiers));
 }
Esempio n. 12
0
 public void DeleteDossiersPivot(DossiersPivot dossiersPivot)
 {
     dossiersRepository.Delete(Mapper.Map <DossiersPivot, GEN_Dossiers>(dossiersPivot));
 }
Esempio n. 13
0
        public void CreateDossiersContactsPivot(DossiersPivot dossiersPivot)
        {
            GEN_Dossiers dossiers = Mapper.Map <DossiersPivot, GEN_Dossiers>(dossiersPivot);

            dossiersRepository.Add(dossiers);
        }
Esempio n. 14
0
        public void Validation_Db(DossiersPivot objet)
        {
            var Gen_dossier = Mapper.Map <DossiersPivot, GEN_Dossiers>(objet);

            dossiersRepository.Validate_db(Gen_dossier);
        }