Пример #1
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"));
 }
Пример #2
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));
     }
 }