public virtual List <LocationsContract> SelectBy_LocationId(string authId, SelectBy_LocationIdPx px) { try { return (Can(authId, (int)PermissionEnum.Client_Locations_SelectBy_LocationId) ? LocationsLogic.SelectBy_LocationIdNow(px.LocationId) : null);//cant } catch (Exception ex) { #if DEBUG Debug.WriteLine("------------------------------"); Debug.WriteLine("------ LocationsServiceBase.SelectBy_LocationId ERROR ------"); Debug.WriteLine("------------------------------"); Debug.WriteLine(ex.Message); Debug.WriteLine(ex.ToString()); Debug.WriteLine("------------------------------"); #endif throw; } }
public virtual bool Exists(string authId, string fldLocationId) { try { return (Can(authId, (int)PermissionEnum.Client_Locations_Exists) ? LocationsLogic.ExistsNow((int)Convert.ChangeType(fldLocationId, typeof(int))) : false); //cant } catch (Exception ex) { #if DEBUG Debug.WriteLine("------------------------------"); Debug.WriteLine("------ LocationsServiceBase.Exists ERROR ------"); Debug.WriteLine("------------------------------"); Debug.WriteLine(ex.Message); Debug.WriteLine(ex.ToString()); Debug.WriteLine("------------------------------"); #endif throw; } }
public virtual LocationsContract Get(string authId, string fldLocationId) { try { if (Can(authId, (int)PermissionEnum.Client_Locations_SelectBy_LocationId)) { var results = LocationsLogic.SelectBy_LocationIdNow((int)Convert.ChangeType(fldLocationId, typeof(int))); return(results.Count == 0 ? null : results[0]); } return(null); //cant } catch (Exception ex) { #if DEBUG Debug.WriteLine("------------------------------"); Debug.WriteLine("------ LocationsServiceBase.SelectBy_LocationId ERROR ------"); Debug.WriteLine("------------------------------"); Debug.WriteLine(ex.Message); Debug.WriteLine(ex.ToString()); Debug.WriteLine("------------------------------"); #endif throw; } }
public List <LocationsLogic> DisplayLocationsDB(int prod) { //string connectionString = SecretConfiguration.configurationString; string connectionString = ""; DbContextOptions <GameStoreContext> options = new DbContextOptionsBuilder <GameStoreContext>() .UseSqlServer(connectionString) .Options; using var context = new GameStoreContext(options); var foundName = context.Inventory.FirstOrDefault(p => p.ProductId == prod); var foundCity = context.Locations.FirstOrDefault(p => p.LocationId == foundName.LocationId); var foundLoc = context.Inventory.Where(p => p.ProductId == prod).ToList(); if (foundName is null) { //Console.WriteLine("No Record Found"); return(null); } List <LocationsLogic> locations = new List <LocationsLogic>(); foreach (Inventory loc in foundLoc) { if (loc.ProductId == prod) { LocationsLogic tempLoc = new LocationsLogic(); var foundLocName = context.Locations.FirstOrDefault(p => p.LocationId == loc.LocationId); tempLoc.LocationId = (int)loc.LocationId; tempLoc.City = foundLocName.City; tempLoc.Inventory = GetInventoryDB((int)loc.LocationId, prod); //Console.WriteLine($"Id: {loc.LocationId} | City: {foundLocName.City} | {GetInventoryDB((int)loc.LocationId, product)}"); locations.Add(tempLoc); } } return(locations); }
public List <LocationsLogic> DisplayAllLocationsDB() { //string connectionString = SecretConfiguration.configurationString; string connectionString = ""; DbContextOptions <GameStoreContext> options = new DbContextOptionsBuilder <GameStoreContext>() .UseSqlServer(connectionString) .Options; using var context = new GameStoreContext(options); List <LocationsLogic> locations = new List <LocationsLogic>(); foreach (Locations loc in context.Locations) { LocationsLogic tempLoc = new LocationsLogic(); tempLoc.LocationId = loc.LocationId; tempLoc.City = loc.City; locations.Add(tempLoc); } LocationCount = context.Locations.Count(); return(locations); }
public void viewLocationsMenu() { var location = new LocationsLogic(); int input = 0; Console.WriteLine(" "); Console.WriteLine(" "); Console.WriteLine(" "); Console.WriteLine(" +================================================================+"); Console.WriteLine(" | |"); Console.WriteLine(" | LOCATIONS MENU |"); Console.WriteLine(" | |"); Console.WriteLine(" +================================================================+"); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" | [1] VIEW ALL LOCATION(S) |"); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" | [2] ADD AN LOCATION |"); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" | [3] EDIT AN LOCATION |"); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" | [4] DELETE AN LOCATION |"); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" | [5] VIEW ORDER HISTORY |"); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" "); Console.WriteLine(" "); Console.WriteLine(" "); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" | [6] RETURN TO MAIN MENU |"); Console.WriteLine(" +----------------------------------------------------------------+"); input = Int32.Parse(Console.ReadLine()); switch (input) { case 1: Console.Clear(); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" | VIEW LOCATION CATALOG |"); Console.WriteLine(" +----------------------------------------------------------------+"); location.GetAll(); break; case 2: Console.Clear(); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" | REGISTER A NEW LOCATION |"); Console.WriteLine(" +----------------------------------------------------------------+"); location.Add(); break; case 3: location.Delete(); break; case 4: Console.Clear(); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" | Inventory A NEW LOCATION |"); Console.WriteLine(" +----------------------------------------------------------------+"); location.GetInventoryByLocationID(); break; case 5: Console.Clear(); Console.WriteLine(" +----------------------------------------------------------------+"); Console.WriteLine(" | VIEW LOCATION ORDER HISTORY |"); Console.WriteLine(" +----------------------------------------------------------------+"); location.GetOrdersByLocationID(); break; default: Console.Clear(); var mainmenu = new MainMenu(); mainmenu.viewMainMenu(); break; } }