public List <HotDeals> GetHotDeals() { List <HotDeals> hotDeals = new List <HotDeals>(); DataSet data = DBConnection.GetData("GetHotDeals"); foreach (DataRow row in data.Tables[0].Rows) { HotDeals hotDeal = new HotDeals(); hotDeal.OpeningId = new Guid(row["OpeningId"].ToString()); hotDeal.Months = !String.IsNullOrEmpty(row["Months"].ToString()) ? row["Months"].ToString() : string.Empty; hotDeal.Tenant = !String.IsNullOrEmpty(row["Tenant"].ToString()) ? row["Tenant"].ToString() : string.Empty; hotDeal.Sector = !String.IsNullOrEmpty(row["Sector"].ToString()) ? row["Sector"].ToString() : string.Empty; hotDeal.UnitNo = !String.IsNullOrEmpty(row["UnitNo"].ToString()) ? row["UnitNo"].ToString() : string.Empty; hotDeal.Gla = !String.IsNullOrEmpty(row["Gla"].ToString()) ? row["Gla"].ToString() : string.Empty; hotDeal.Term = !String.IsNullOrEmpty(row["Term"].ToString()) ? row["Term"].ToString() : string.Empty; hotDeal.LoiSigned = !String.IsNullOrEmpty(row["LoiSigned"].ToString()) ? row["LoiSigned"].ToString() : string.Empty; hotDeal.BudgetRate = !String.IsNullOrEmpty(row["BudgetRate"].ToString()) ? row["BudgetRate"].ToString() : string.Empty; hotDeal.ProposedRate = !String.IsNullOrEmpty(row["ProposedRate"].ToString()) ? row["ProposedRate"].ToString() : string.Empty; hotDeal.Ner = !String.IsNullOrEmpty(row["Ner"].ToString()) ? row["Ner"].ToString() : string.Empty; hotDeal.TA = !String.IsNullOrEmpty(row["TA"].ToString()) ? row["TA"].ToString() : string.Empty; hotDeal.Llw = !String.IsNullOrEmpty(row["Llw"].ToString()) ? row["Llw"].ToString() : string.Empty; hotDeal.Commision = !String.IsNullOrEmpty(row["Commision"].ToString()) ? row["Commision"].ToString() : string.Empty; hotDeal.Comments = !String.IsNullOrEmpty(row["comments"].ToString()) ? row["comments"].ToString() : string.Empty; hotDeals.Add(hotDeal); } return(hotDeals); }
public ActionResult HotDealsEdit(FormCollection form) { if (!string.IsNullOrEmpty(Session["username"] as string)) { try { List <HotDeals> lst = new List <HotDeals>(); for (int i = 1; i <= 5; i++) { HotDeals obj = new HotDeals(); obj.Tenant = form["Tenant" + i]; obj.Sector = form["Sector" + i]; obj.UnitNo = form["UnitNo" + i]; obj.Gla = form["Gla" + i]; obj.Term = form["Term" + i]; obj.LoiSigned = form["LoiSigned" + i]; obj.BudgetRate = form["BudgetRate" + i]; obj.ProposedRate = form["ProposedRate" + i]; obj.Ner = form["Ner" + i]; obj.Llw = form["Llw" + i]; obj.TA = form["TA" + i]; obj.Commision = form["Commision" + i]; obj.Comments = form["comment" + i]; lst.Add(obj); } LeasingDataMonthly ld = new LeasingDataMonthly(); ld.UpdateHotDeals(lst); return(RedirectToAction("Index")); } catch (Exception ex) { return(View("Error", ex)); } } else { return(RedirectToAction("Index", "Login")); } }
public async Task <HotDeals> Search_With_Custom_query(string query_for_game, string query_for_accessories, string query_for_console, string MaxPriceQuery) { var result = new HotDeals(); var game_list = new PaginatedEntity <Game_Search>(); var console_list = new PaginatedEntity <Product>(); var accessories_list = new PaginatedEntity <Product>(); using (var con = DbHelper.GetSqlConnection()) { using (var multiple = await con.QueryMultipleAsync(query_for_game, commandType: CommandType.Text)) { game_list.TotalCount = multiple.Read <int>().SingleOrDefault(); game_list.PagedSet = multiple.Read <Game_Search>(); game_list.NumResult = game_list.PagedSet.Count(); } using (var multiple1 = await con.QueryMultipleAsync(query_for_console, commandType: CommandType.Text)) { console_list.TotalCount = multiple1.Read <int>().SingleOrDefault(); console_list.PagedSet = multiple1.Read <Product>(); console_list.NumResult = game_list.PagedSet.Count(); } using (var multiple2 = await con.QueryMultipleAsync(query_for_accessories, commandType: CommandType.Text)) { accessories_list.TotalCount = multiple2.Read <int>().SingleOrDefault(); accessories_list.PagedSet = multiple2.Read <Product>(); accessories_list.NumResult = game_list.PagedSet.Count(); } result.GameList = game_list.PagedSet; result.Consoles = console_list.PagedSet; result.Accessories = accessories_list.PagedSet; if (game_list != null) { result.TotalCounts += game_list.TotalCount; } if (console_list != null) { result.TotalCounts += console_list.TotalCount; } if (accessories_list != null) { result.TotalCounts += accessories_list.TotalCount; } if (game_list != null) { result.NumResult += game_list.NumResult; } if (console_list != null) { result.NumResult += console_list.NumResult; } if (accessories_list != null) { result.NumResult += accessories_list.NumResult; } using (var multiple = await con.QueryMultipleAsync(MaxPriceQuery, commandType: CommandType.Text)) { result.MaxPrice = multiple.Read <decimal>().SingleOrDefault(); } } return(result); }