예제 #1
0
        public ActionResult Create(buildingClass Obj_building, string command)
        {
            using (buildingCtl db = new buildingCtl()){
                if (ModelState.IsValid)
                {
                    db.insert(Obj_building);
                    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_building));
            }
        }
예제 #2
0
 public ActionResult Edit(Int32 Buildingid)
 {
     using (buildingCtl db = new buildingCtl()){
         buildingClass obj_building = db.selectById(Buildingid);
         Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer);
         return(View(obj_building));
     }
 }
예제 #3
0
 public ActionResult Edit(buildingClass Obj_building)
 {
     using (buildingCtl db = new buildingCtl()){
         if (ModelState.IsValid)
         {
             db.update(Obj_building);
             string sesionval = Convert.ToString(Session["EditPreviousURL"]);
             if (!string.IsNullOrEmpty(sesionval))
             {
                 Session.Remove("EditPreviousURL");
                 return(Redirect(sesionval));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         return(View(Obj_building));
     }
 }
예제 #4
0
 public ActionResult Details(Int32 Buildingid)
 {
     using (buildingCtl db = new buildingCtl()){ buildingClass obj_building = db.selectById(Buildingid);
                                                 return(View(obj_building)); }
 }
예제 #5
0
 public ActionResult SaveRecords(FormCollection model)
 {
     if (ModelState.IsValid)
     {
         using (buildingCtl db = new buildingCtl()){
             var BuildingidArray         = model.GetValues("item.Buildingid");
             var LocationidArray         = model.GetValues("item.Locationid");
             var BuildingcodeArray       = model.GetValues("item.Buildingcode");
             var BuildingsystemidArray   = model.GetValues("item.Buildingsystemid");
             var SystemelementidArray    = model.GetValues("item.Systemelementid");
             var SystemtypeidArray       = model.GetValues("item.Systemtypeid");
             var RatingArray             = model.GetValues("item.Rating");
             var DetailsArray            = model.GetValues("item.Details");
             var IsdeficiencyrepairArray = model.GetValues("item.Isdeficiencyrepair");
             var ProjectidArray          = model.GetValues("item.Projectid");
             var ServicecontractidArray  = model.GetValues("item.Servicecontractid");
             var WorkorderArray          = model.GetValues("item.Workorder");
             var ComplianceArray         = model.GetValues("item.Compliance");
             var HeightArray             = model.GetValues("item.Height");
             var WidthArray            = model.GetValues("item.Width");
             var MaterialidArray       = model.GetValues("item.Materialid");
             var UseridArray           = model.GetValues("item.Userid");
             var InserteddatetimeArray = model.GetValues("item.Inserteddatetime");
             var Addressline1Array     = model.GetValues("item.Addressline1");
             var Addressline2Array     = model.GetValues("item.Addressline2");
             var LocationcityArray     = model.GetValues("item.Locationcity");
             var StateidArray          = model.GetValues("item.Stateid");
             var LocationzipArray      = model.GetValues("item.Locationzip");
             for (Int32 i = 0; i < BuildingidArray.Length; i++)
             {
                 buildingClass obj_update = db.selectById(Convert.ToInt32(BuildingidArray[i]));
                 if (!string.IsNullOrEmpty(Convert.ToString(BuildingidArray)))
                 {
                     obj_update.Buildingid = Convert.ToInt32(BuildingidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(LocationidArray)))
                 {
                     obj_update.Locationid = Convert.ToInt32(LocationidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(BuildingcodeArray)))
                 {
                     obj_update.Buildingcode = Convert.ToString(BuildingcodeArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(BuildingsystemidArray)))
                 {
                     obj_update.Buildingsystemid = Convert.ToInt32(BuildingsystemidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(SystemelementidArray)))
                 {
                     obj_update.Systemelementid = Convert.ToInt32(SystemelementidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(SystemtypeidArray)))
                 {
                     obj_update.Systemtypeid = Convert.ToInt32(SystemtypeidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(RatingArray)))
                 {
                     obj_update.Rating = Convert.ToInt32(RatingArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(DetailsArray)))
                 {
                     obj_update.Details = Convert.ToString(DetailsArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(IsdeficiencyrepairArray)))
                 {
                     obj_update.Isdeficiencyrepair = Convert.ToBoolean(IsdeficiencyrepairArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(ProjectidArray)))
                 {
                     obj_update.Projectid = Convert.ToInt32(ProjectidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(ServicecontractidArray)))
                 {
                     obj_update.Servicecontractid = Convert.ToInt32(ServicecontractidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(WorkorderArray)))
                 {
                     obj_update.Workorder = Convert.ToString(WorkorderArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(ComplianceArray)))
                 {
                     obj_update.Compliance = Convert.ToString(ComplianceArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(HeightArray)))
                 {
                     obj_update.Height = Convert.ToInt32(HeightArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(WidthArray)))
                 {
                     obj_update.Width = Convert.ToInt32(WidthArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(MaterialidArray)))
                 {
                     obj_update.Materialid = Convert.ToInt32(MaterialidArray[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]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(Addressline1Array)))
                 {
                     obj_update.Addressline1 = Convert.ToString(Addressline1Array[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(Addressline2Array)))
                 {
                     obj_update.Addressline2 = Convert.ToString(Addressline2Array[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(LocationcityArray)))
                 {
                     obj_update.Locationcity = Convert.ToString(LocationcityArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(StateidArray)))
                 {
                     obj_update.Stateid = Convert.ToInt32(StateidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(LocationzipArray)))
                 {
                     obj_update.Locationzip = Convert.ToString(LocationzipArray[i]);
                 }
                 db.update(obj_update);
             }
         }
     }
     return(RedirectToAction("EditTable"));
 }