Ejemplo n.º 1
0
        public ActionResult Create(systemelementClass Obj_systemelement, string command)
        {
            using (systemelementCtl db = new systemelementCtl()){
                if (ModelState.IsValid)
                {
                    db.insert(Obj_systemelement);
                    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_systemelement));
            }
        }
Ejemplo n.º 2
0
 public ActionResult SaveRecords(FormCollection model)
 {
     if (ModelState.IsValid)
     {
         using (systemelementCtl db = new systemelementCtl()){
             var SystemelementidArray   = model.GetValues("item.Systemelementid");
             var BuildingsystemidArray  = model.GetValues("item.Buildingsystemid");
             var SystemelementnameArray = model.GetValues("item.Systemelementname");
             for (Int32 i = 0; i < SystemelementidArray.Length; i++)
             {
                 systemelementClass obj_update = db.selectById(Convert.ToInt32(SystemelementidArray[i]));
                 if (!string.IsNullOrEmpty(Convert.ToString(SystemelementidArray)))
                 {
                     obj_update.Systemelementid = Convert.ToInt32(SystemelementidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(BuildingsystemidArray)))
                 {
                     obj_update.Buildingsystemid = Convert.ToInt32(BuildingsystemidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(SystemelementnameArray)))
                 {
                     obj_update.Systemelementname = Convert.ToString(SystemelementnameArray[i]);
                 }
                 db.update(obj_update);
             }
         }
     }
     return(RedirectToAction("EditTable"));
 }
Ejemplo n.º 3
0
 public ActionResult Edit(Int32 Systemelementid)
 {
     using (systemelementCtl db = new systemelementCtl()){
         systemelementClass obj_systemelement = db.selectById(Systemelementid);
         Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer);
         return(View(obj_systemelement));
     }
 }
Ejemplo n.º 4
0
 public ActionResult Edit(systemelementClass Obj_systemelement)
 {
     using (systemelementCtl db = new systemelementCtl()){
         if (ModelState.IsValid)
         {
             db.update(Obj_systemelement);
             string sesionval = Convert.ToString(Session["EditPreviousURL"]);
             if (!string.IsNullOrEmpty(sesionval))
             {
                 Session.Remove("EditPreviousURL");
                 return(Redirect(sesionval));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         return(View(Obj_systemelement));
     }
 }
Ejemplo n.º 5
0
 public ActionResult Details(Int32 Systemelementid)
 {
     using (systemelementCtl db = new systemelementCtl()){ systemelementClass obj_systemelement = db.selectById(Systemelementid);
                                                           return(View(obj_systemelement)); }
 }