Esempio n. 1
0
        public ActionResult Create(locationClass Obj_location, string command)
        {
            using (locationCtl db = new locationCtl()){
                if (ModelState.IsValid)
                {
                    db.insert(Obj_location);
                    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_location));
            }
        }
Esempio n. 2
0
 public ActionResult Edit(Int32 Locationid)
 {
     using (locationCtl db = new locationCtl()){
         locationClass obj_location = db.selectById(Locationid);
         Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer);
         return(View(obj_location));
     }
 }
Esempio n. 3
0
 public ActionResult SaveRecords(FormCollection model)
 {
     if (ModelState.IsValid)
     {
         using (locationCtl db = new locationCtl()){
             var LocationidArray    = model.GetValues("item.Locationid");
             var ClientidArray      = model.GetValues("item.Clientid");
             var InstitutionidArray = model.GetValues("item.Institutionid");
             var BuildingArray      = model.GetValues("item.Building");
             var JobtypeidArray     = model.GetValues("item.Jobtypeid");
             var JobstatusidArray   = model.GetValues("item.Jobstatusid");
             var JobdetailArray     = model.GetValues("item.Jobdetail");
             for (Int32 i = 0; i < LocationidArray.Length; i++)
             {
                 locationClass obj_update = db.selectById(Convert.ToInt32(LocationidArray[i]));
                 if (!string.IsNullOrEmpty(Convert.ToString(LocationidArray)))
                 {
                     obj_update.Locationid = Convert.ToInt32(LocationidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(ClientidArray)))
                 {
                     obj_update.Clientid = Convert.ToInt32(ClientidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(InstitutionidArray)))
                 {
                     obj_update.Institutionid = Convert.ToInt32(InstitutionidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(BuildingArray)))
                 {
                     obj_update.Building = Convert.ToString(BuildingArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(JobtypeidArray)))
                 {
                     obj_update.Jobtypeid = Convert.ToInt32(JobtypeidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(JobstatusidArray)))
                 {
                     obj_update.Jobstatusid = Convert.ToInt32(JobstatusidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(JobdetailArray)))
                 {
                     obj_update.Jobdetail = Convert.ToString(JobdetailArray[i]);
                 }
                 db.update(obj_update);
             }
         }
     }
     return(RedirectToAction("EditTable"));
 }
Esempio n. 4
0
 public ActionResult Edit(locationClass Obj_location)
 {
     using (locationCtl db = new locationCtl()){
         if (ModelState.IsValid)
         {
             db.update(Obj_location);
             string sesionval = Convert.ToString(Session["EditPreviousURL"]);
             if (!string.IsNullOrEmpty(sesionval))
             {
                 Session.Remove("EditPreviousURL");
                 return(Redirect(sesionval));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         return(View(Obj_location));
     }
 }
Esempio n. 5
0
 public ActionResult Details(Int32 Locationid)
 {
     using (locationCtl db = new locationCtl()){ locationClass obj_location = db.selectById(Locationid);
                                                 return(View(obj_location)); }
 }