public List <TenantClosure> GetTenantClosure() { List <TenantClosure> tenantClosures = new List <TenantClosure>(); DataSet data = DBConnection.GetData("GetTenantClosure"); foreach (DataRow row in data.Tables[0].Rows) { TenantClosure tenant = new TenantClosure(); tenant.OpeningId = new Guid(row["OpeningId"].ToString()); tenant.Sector = !String.IsNullOrEmpty(row["Sector"].ToString()) ? row["Sector"].ToString() : string.Empty; tenant.Tenant = !String.IsNullOrEmpty(row["Tenant"].ToString()) ? row["Tenant"].ToString() : string.Empty; tenant.DateOfClosure = !String.IsNullOrEmpty(row["DateOfClosure"].ToString()) ? row["DateOfClosure"].ToString() : string.Empty; tenant.ReasonOfClosure = !String.IsNullOrEmpty(row["ReasonOfClosure"].ToString()) ? row["ReasonOfClosure"].ToString() : string.Empty; tenant.Ar = !String.IsNullOrEmpty(row["Ar"].ToString()) ? row["Ar"].ToString() : string.Empty; tenant.Occupancy = !String.IsNullOrEmpty(row["Occupancy"].ToString()) ? row["Occupancy"].ToString() : string.Empty; tenant.CoTenancyRisk = !String.IsNullOrEmpty(row["CoTenancyRisk"].ToString()) ? row["CoTenancyRisk"].ToString() : string.Empty; tenant.TI = !String.IsNullOrEmpty(row["TI"].ToString()) ? row["TI"].ToString() : string.Empty; tenant.LLW = !String.IsNullOrEmpty(row["LLW"].ToString()) ? row["LLW"].ToString() : string.Empty; tenant.Gla = !String.IsNullOrEmpty(row["Gla"].ToString()) ? row["Gla"].ToString() : string.Empty; tenant.Comments = !String.IsNullOrEmpty(row["Comments"].ToString()) ? row["Comments"].ToString() : string.Empty; tenantClosures.Add(tenant); } return(tenantClosures); }
public ActionResult TenantsClosureEdit(FormCollection form) { if (!string.IsNullOrEmpty(Session["username"] as string)) { try { List <TenantClosure> lst = new List <TenantClosure>(); for (int i = 1; i <= 5; i++) { TenantClosure obj = new TenantClosure(); obj.Tenant = form["Tenant" + i]; obj.Sector = form["Sector" + i]; obj.Gla = form["Gla" + i]; obj.DateOfClosure = form["DateOfClosure" + i]; obj.ReasonOfClosure = form["ReasonOfClosure" + i]; obj.Ar = form["Ar" + i]; obj.CoTenancyRisk = form["CoTenancyRisk" + i]; obj.LLW = form["LLW" + i]; obj.TI = form["TI" + i]; obj.Comments = form["comment" + i]; obj.Occupancy = form["Occupancy" + i]; lst.Add(obj); } LeasingDataMonthly ld = new LeasingDataMonthly(); ld.UpdateTenantClosure(lst); return(RedirectToAction("Index")); } catch (Exception ex) { return(View("Error", ex)); } } else { return(RedirectToAction("Index", "Login")); } }