public List <SquareSales> GetLifeStyledata() { List <SquareSales> lst = new List <SquareSales>(); DataSet data = DBConnection.GetData("GetLifestyle"); foreach (DataRow row in data.Tables[0].Rows) { SquareSales Obj = new SquareSales(); Obj.squareid = new Guid(row["squareid"].ToString()); Obj.Tenant = !String.IsNullOrEmpty(row["Tenant"].ToString()) ? row["Tenant"].ToString() : string.Empty; Obj.Gla = !String.IsNullOrEmpty(row["Gla"].ToString()) ? row["Gla"].ToString() : string.Empty; Obj.Psf1 = !String.IsNullOrEmpty(row["Psf1"].ToString()) ? row["Psf1"].ToString() : string.Empty; Obj.LY1 = !String.IsNullOrEmpty(row["LY1"].ToString()) ? row["LY1"].ToString() : string.Empty; Obj.sales1 = !String.IsNullOrEmpty(row["sales1"].ToString()) ? row["sales1"].ToString() : string.Empty; Obj.Sales2 = !String.IsNullOrEmpty(row["Sales2"].ToString()) ? row["Sales2"].ToString() : string.Empty; Obj.PSF2 = !String.IsNullOrEmpty(row["PSF2"].ToString()) ? row["PSF2"].ToString() : string.Empty; Obj.PSF3 = !String.IsNullOrEmpty(row["PSF3"].ToString()) ? row["PSF3"].ToString() : string.Empty; Obj.LY2 = !String.IsNullOrEmpty(row["LY2"].ToString()) ? row["LY2"].ToString() : string.Empty; Obj.LY3 = !String.IsNullOrEmpty(row["LY3"].ToString()) ? row["LY3"].ToString() : string.Empty; Obj.Sales3 = !String.IsNullOrEmpty(row["Sales3"].ToString()) ? row["Sales3"].ToString() : string.Empty; Obj.GrossRent = !String.IsNullOrEmpty(row["GrossRent"].ToString()) ? row["GrossRent"].ToString() : string.Empty; Obj.Groc = !String.IsNullOrEmpty(row["Groc"].ToString()) ? row["Groc"].ToString() : string.Empty; Obj.PctRent = !String.IsNullOrEmpty(row["PctRent"].ToString()) ? row["PctRent"].ToString() : string.Empty; lst.Add(Obj); } return(lst); }
public ActionResult LifeStyleEdit(FormCollection form) { if (!string.IsNullOrEmpty(Session["username"] as string)) { try { List <SquareSales> lst = new List <SquareSales>(); for (int i = 1; i <= 3; i++) { SquareSales obj = new SquareSales(); obj.Tenant = form["Tenant" + i]; obj.Gla = form["Gla" + i]; obj.sales1 = form["sales1" + i]; obj.Sales2 = form["Sales2" + i]; obj.Sales3 = form["Sales3" + i]; obj.Psf1 = form["Psf1" + i]; obj.PSF2 = form["PSF2" + i]; obj.PSF3 = form["PSF3" + i]; obj.LY1 = form["LY1" + i]; obj.LY2 = form["LY2" + i]; obj.LY3 = form["LY3" + i]; obj.GrossRent = form["GrossRent" + i]; obj.PctRent = form["PctRent" + i]; obj.Groc = form["Groc" + i]; lst.Add(obj); } Salesdata sd = new Salesdata(); sd.UpdateLifeStyleSales(lst, form["comment"]); return(RedirectToAction("Index")); } catch (Exception ex) { return(View("Error", ex)); } } else { return(RedirectToAction("Index", "Login")); } }