Ejemplo n.º 1
0
        // GET: Conge/Delete/5
        public ActionResult Delete(int id)
        {
            conge cm = new conge();

            cm = cs.Get(t => t.id == id);
            CongeModels c = new CongeModels();

            c.DateFin   = cm.DateFin;
            c.DateDebut = cm.DateDebut;
            return(View(c));
        }
Ejemplo n.º 2
0
        // GET: Conge/Edit/5
        public ActionResult Edit(int id)
        {
            conge cm = new conge();

            cm = cs.Get(t => t.id == id);
            CongeModels c = new CongeModels();

            c.DateDebut = cm.DateDebut;
            c.DateFin   = cm.DateFin;
            c.certefica = cm.certefica;
            c.typeConge = cm.typeConge;


            return(View(c));
        }
Ejemplo n.º 3
0
        public ActionResult DetailsAdmin(int id)
        {
            conge       cm = new conge();
            CongeModels c  = new CongeModels();

            cm = cs.Get(t => t.id == id);

            c.DateDebut     = cm.DateDebut;
            c.DateFin       = cm.DateFin;
            c.certefica     = cm.certefica;
            c.typeConge     = cm.typeConge;
            ViewBag.id      = cm.id;
            ViewBag.reponse = cm.reponse;
            ViewBag.nbr_jrs = cm.nbr_jr;
            return(View(c));
        }
Ejemplo n.º 4
0
        public ActionResult Create(CongeModels cm, HttpPostedFileBase file)
        {
            {
                if (!ModelState.IsValid || file == null || file.ContentLength == 0)
                {
                    RedirectToAction("Create");
                }
            }
            conge c = new conge();

            c.id        = cm.id;
            c.typeConge = cm.typeConge;
            if (c.typeConge == "Maladie")
            {
                c.certefica = file.FileName;
                var fileName = "";
                if (file.ContentLength > 0)
                {
                    fileName = Path.GetFileName(file.FileName);
                    var path = Path.
                               Combine(Server.MapPath("~/Content/Upload/"),
                                       fileName);
                    file.SaveAs(path);
                }
            }
            else if (c.typeConge == "Normale")
            {
                c.certefica = "N'a pas besoin de certificat";
            }
            c.DateDebut    = cm.DateDebut;
            c.DateFin      = cm.DateFin;
            c.reponse      = "false";
            c.typeConge    = cm.typeConge;
            c.demandeConge = "true";
            //c.certefica = cm.certefica;

            //calcule nbr jours conge
            // System.TimeSpan diff1 = c.DateFin.Subtract(DateTime.Now);
            //  int x = (int)diff1.TotalDays;
            //c.nbr_jr = x;

            cs.Add(c);
            cs.Commit();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 5
0
        // GET: Conge
        public ActionResult Index()
        {
            List <CongeModels> lc = new List <CongeModels>();

            foreach (var cm in cs.GetMany())
            {
                CongeModels c = new CongeModels();
                c.id        = cm.id;
                c.DateDebut = cm.DateDebut;
                c.DateFin   = cm.DateFin;
                c.typeConge = cm.typeConge;
                c.certefica = cm.certefica;

                lc.Add(c);
            }

            return(View(lc));
        }
Ejemplo n.º 6
0
        public ActionResult Edit(int id, CongeModels cm, HttpPostedFileBase file)
        {
            {
                if (!ModelState.IsValid || file == null || file.ContentLength == 0)
                {
                    RedirectToAction("Create");
                }
            }
            conge c = new conge();

            c    = cs.Get(t => t.id == id);
            c.id = cm.id;

            c.DateDebut = cm.DateDebut;
            c.DateFin   = cm.DateFin;
            c.typeConge = cm.typeConge;
            if (c.typeConge == "Maladie")
            {
                c.certefica = file.FileName;
                var fileName = "";
                if (file.ContentLength > 0)
                {
                    fileName = Path.GetFileName(file.FileName);
                    var path = Path.
                               Combine(Server.MapPath("~/Content/Upload/"),
                                       fileName);
                    file.SaveAs(path);
                }
            }
            else if (c.typeConge == "Normale")
            {
                c.certefica = "N'a pas besoin de certificat";
            }
            cs.Update(c);
            cs.Commit();

            return(RedirectToAction("Index"));
        }