Ejemplo n.º 1
0
        public ActionResult Create(jobtypeClass Obj_jobtype, string command)
        {
            using (jobtypeCtl db = new jobtypeCtl()){
                if (ModelState.IsValid)
                {
                    db.insert(Obj_jobtype);
                    if (command.ToLower().Trim() == "save")
                    {
                        string sesionval = Convert.ToString(Session["CreatePreviousURL"]);
                        if (!string.IsNullOrEmpty(sesionval))
                        {
                            Session.Remove("CreatePreviousURL");
                            return(Redirect(sesionval));
                        }
                        else
                        {
                            return(RedirectToAction("Index"));
                        }
                    }
                    else
                    {
                        ModelState.Clear();
                        return(View());
                    }
                }

                return(View(Obj_jobtype));
            }
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Int32 Jobtypeid)
 {
     using (jobtypeCtl db = new jobtypeCtl()){
         jobtypeClass obj_jobtype = db.selectById(Jobtypeid);
         Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer);
         return(View(obj_jobtype));
     }
 }
Ejemplo n.º 3
0
 public ActionResult Edit(jobtypeClass Obj_jobtype)
 {
     using (jobtypeCtl db = new jobtypeCtl()){
         if (ModelState.IsValid)
         {
             db.update(Obj_jobtype);
             string sesionval = Convert.ToString(Session["EditPreviousURL"]);
             if (!string.IsNullOrEmpty(sesionval))
             {
                 Session.Remove("EditPreviousURL");
                 return(Redirect(sesionval));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         return(View(Obj_jobtype));
     }
 }
Ejemplo n.º 4
0
 public ActionResult SaveRecords(FormCollection model)
 {
     if (ModelState.IsValid)
     {
         using (jobtypeCtl db = new jobtypeCtl()){
             var JobtypeidArray = model.GetValues("item.Jobtypeid");
             var JobtypeArray   = model.GetValues("item.Jobtype");
             for (Int32 i = 0; i < JobtypeidArray.Length; i++)
             {
                 jobtypeClass obj_update = db.selectById(Convert.ToInt32(JobtypeidArray[i]));
                 if (!string.IsNullOrEmpty(Convert.ToString(JobtypeidArray)))
                 {
                     obj_update.Jobtypeid = Convert.ToInt32(JobtypeidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(JobtypeArray)))
                 {
                     obj_update.Jobtype = Convert.ToString(JobtypeArray[i]);
                 }
                 db.update(obj_update);
             }
         }
     }
     return(RedirectToAction("EditTable"));
 }
Ejemplo n.º 5
0
 public ActionResult Details(Int32 Jobtypeid)
 {
     using (jobtypeCtl db = new jobtypeCtl()){ jobtypeClass obj_jobtype = db.selectById(Jobtypeid);
                                               return(View(obj_jobtype)); }
 }