Beispiel #1
0
        protected Dictionary <string, Object> getJson(CatAnneeExp item)
        {
            var json = new Dictionary <string, Object>();

            if (item == null)
            {
                return(null);
            }
            json.Add("id", item.id);
            json.Add("Cat_id", item.Cat_id);
            json.Add("Ann_id", item.Ann_id);
            json.Add("status", item.status);
            json.Add("prixHoraire", item.prixHoraire);
            json.Add("anneeExp", getJson(item.AnneeExp));
            json.Add("category", getJson(item.Categorie));
            json.Add("created", item.created.HasValue ? item.created.Value.ToString("dd/MM/yyyy HH:mm") : null);
            json.Add("created_format", item.created.HasValue ? Utils.dateFullMonth(item.created.Value) : null);
            return(json);
        }
        public ActionResult deleteCatExp(decimal id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            CatAnneeExp catAnneeExp = db.CatAnneeExp.FirstOrDefault(p => p.id == id);

            if (catAnneeExp == null)
            {
                return(HttpNotFound());
            }

            db.CatAnneeExp.Remove(catAnneeExp);
            db.SaveChanges();

            return(RedirectToAction("ConfigCategorie", new { id = catAnneeExp.Cat_id }));
        }
        public ActionResult ConfigCategorie(CatAnneeExp catAnneeExp)
        {
            CatAnneeExp ListAnneeExps = db.CatAnneeExp.FirstOrDefault(p => p.Cat_id == catAnneeExp.Cat_id && p.Ann_id == catAnneeExp.Ann_id);

            if (ListAnneeExps != null)
            {
                ListAnneeExps.prixHoraire = catAnneeExp.prixHoraire;

                db.Entry(ListAnneeExps).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("ConfigCategorie", new { id = catAnneeExp.Cat_id }));
            }

            catAnneeExp.archived = 1;
            catAnneeExp.status   = 1;
            catAnneeExp.created  = DateTime.Now;
            db.CatAnneeExp.Add(catAnneeExp);
            db.SaveChanges();

            //ViewBag.Ann_id = new SelectList(db.AnneeExp, "id", "libelle", catAnneeExp.Ann_id);

            return(RedirectToAction("ConfigCategorie", new { id = catAnneeExp.Cat_id }));
        }
Beispiel #4
0
        public ActionResult cvCandidatLocation(decimal id, decimal page)
        {
            ViewBag.page = page;

            if (id == null)
            {
                String message = "Une erreur c'est produit durant l'opération veuillez reessayer !";
                return(RedirectToAction("ErrorPage", "Home", new { sms = message }));
            }

            Information information = db.Information.FirstOrDefault(p => p.Ins_id == id);

            Inscrire inscrire = db.Inscrire.FirstOrDefault(p => p.id == id);
            int      montant  = 0;

            if (inscrire != null)
            {
                if (inscrire.categorie != null)
                {
                    decimal     idCategorie = Convert.ToDecimal(inscrire.categorie);
                    CatAnneeExp catAnneeExp = db.CatAnneeExp.FirstOrDefault(p => p.Cat_id == idCategorie);
                    if (catAnneeExp != null)
                    {
                        montant = (int)catAnneeExp.prixHoraire;
                    }
                }

                Location location = UserLocationExist(inscrire.id);
                if (location != null)
                {
                    ViewBag.locationExist = location;
                }
                else
                {
                    ViewBag.locationExist = null;
                }
            }
            else
            {
                return(HttpNotFound());
            }

            ViewBag.montant = montant;

            if (information == null)
            {
                information = new Information();
            }

            List <Education> education = db.Education.Where(p => p.Ins_id == id).ToList();

            if (education.Count > 0)
            {
                ViewBag.listEducation = education;
            }
            else
            {
                ViewBag.listEducation = null;
            }

            List <Experience> experiences = db.Experience.Where(p => p.Ins_id == id).ToList();

            if (experiences.Count > 0)
            {
                ViewBag.listExperience = experiences;
            }
            else
            {
                ViewBag.listExperience = null;
            }

            List <Autre> autres = db.Autre.Where(p => p.Ins_id == id).ToList();

            if (autres.Count > 0)
            {
                ViewBag.listAutre = autres;
            }
            else
            {
                ViewBag.listAutre = null;
            }



            CvListObject model = new CvListObject();

            model.information = information;
            model.education   = new Education();
            model.experience  = new Experience();
            model.autre       = new Autre();
            model.inscrire    = inscrire;


            return(View(model));
        }