示例#1
0
        public ActionResult Create(buildingworkorderClass Obj_buildingworkorder, string command)
        {
            using (buildingworkorderCtl db = new buildingworkorderCtl()){
                if (ModelState.IsValid)
                {
                    db.insert(Obj_buildingworkorder);
                    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_buildingworkorder));
            }
        }
示例#2
0
 public ActionResult SaveRecords(FormCollection model)
 {
     if (ModelState.IsValid)
     {
         using (buildingworkorderCtl db = new buildingworkorderCtl()){
             var WorkorderidArray      = model.GetValues("item.Workorderid");
             var BuildingidArray       = model.GetValues("item.Buildingid");
             var BuildingsystemidArray = model.GetValues("item.Buildingsystemid");
             var ComponentArray        = model.GetValues("item.Component");
             var DescriptionArray      = model.GetValues("item.Description");
             var PriorityArray         = model.GetValues("item.Priority");
             var RequestorArray        = model.GetValues("item.Requestor");
             var UseridArray           = model.GetValues("item.Userid");
             var InserteddatetimeArray = model.GetValues("item.Inserteddatetime");
             for (Int32 i = 0; i < WorkorderidArray.Length; i++)
             {
                 buildingworkorderClass obj_update = db.selectById(Convert.ToInt32(WorkorderidArray[i]));
                 if (!string.IsNullOrEmpty(Convert.ToString(WorkorderidArray)))
                 {
                     obj_update.Workorderid = Convert.ToInt32(WorkorderidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(BuildingidArray)))
                 {
                     obj_update.Buildingid = Convert.ToInt32(BuildingidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(BuildingsystemidArray)))
                 {
                     obj_update.Buildingsystemid = Convert.ToInt32(BuildingsystemidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(ComponentArray)))
                 {
                     obj_update.Component = Convert.ToInt32(ComponentArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(DescriptionArray)))
                 {
                     obj_update.Description = Convert.ToString(DescriptionArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(PriorityArray)))
                 {
                     obj_update.Priority = Convert.ToString(PriorityArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(RequestorArray)))
                 {
                     obj_update.Requestor = Convert.ToString(RequestorArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(UseridArray)))
                 {
                     obj_update.Userid = Convert.ToInt32(UseridArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(InserteddatetimeArray)))
                 {
                     obj_update.Inserteddatetime = Convert.ToDateTime(InserteddatetimeArray[i]);
                 }
                 db.update(obj_update);
             }
         }
     }
     return(RedirectToAction("EditTable"));
 }
示例#3
0
 public ActionResult Edit(Int32 Workorderid)
 {
     using (buildingworkorderCtl db = new buildingworkorderCtl()){
         buildingworkorderClass obj_buildingworkorder = db.selectById(Workorderid);
         Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer);
         return(View(obj_buildingworkorder));
     }
 }
示例#4
0
 public ActionResult Edit(buildingworkorderClass Obj_buildingworkorder)
 {
     using (buildingworkorderCtl db = new buildingworkorderCtl()){
         if (ModelState.IsValid)
         {
             db.update(Obj_buildingworkorder);
             string sesionval = Convert.ToString(Session["EditPreviousURL"]);
             if (!string.IsNullOrEmpty(sesionval))
             {
                 Session.Remove("EditPreviousURL");
                 return(Redirect(sesionval));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         return(View(Obj_buildingworkorder));
     }
 }
示例#5
0
 public ActionResult Details(Int32 Workorderid)
 {
     using (buildingworkorderCtl db = new buildingworkorderCtl()){ buildingworkorderClass obj_buildingworkorder = db.selectById(Workorderid);
                                                                   return(View(obj_buildingworkorder)); }
 }