protected override CustomerViewsList getRandomObject() { var l = new CustomersList(null, null); SetRandom.Values(l); return(new CustomerViewsList(l)); }
protected void Page_Load(object sender, EventArgs e) { var bl = new CustomerLogic(); CustomersList.DataSource = bl.LoadCustomers().Solution.ToList(); CustomersList.DataBind(); }
public ActionResult ViewCustomersDetails() { IRepository rep = new Repository(); CustomersList cs = new CustomersList(); cs.customerlist = rep.getCustomersList(); return(View(cs)); }
public void CreateCustomersList() { using (CustomersList list = (CustomersList)ModulesManager.Current.OpenModuleObjectDetail(new CustomersListObject(Session), false)) { CustomersListView customersListView = CustomersListView.LastCreatedView; Assert.IsNotNull(customersListView); Assert.IsNotNull(customersListView.Module); Assert.AreEqual(list, customersListView.Module); } }
// This parameter list data brought from program class public void CinemaTicketApp(List <MovieSeatDetails> ListOfSeat) { CustomersList customers = new CustomersList(); // This list is to get the stored user data from customers list List <CustomerDetails> ListOfCustomer = customers.ListOfCustomer(); MoviesList movies = new MoviesList(); // This list is to get the stored movie data from movies list List <MovieDetails> ListOfMovie = movies.ListOfMovies(); bool menu = true; while (menu) { Console.WriteLine("Welcome to TGV Cinema Ticket App"); Console.WriteLine("1. View all movies"); Console.WriteLine("2. Login"); Console.WriteLine("3. Exit app\n"); Console.Write("Enter your option: "); var option = Console.ReadLine(); switch (option) { case "1": // Print the all cinema by using this method, ListOfMovie has the all movies stored inside. PrintCinemaMovies(ListOfMovie); Console.WriteLine("Login to buy a movie ticket of your favourite movie."); Thread.Sleep(3000); Console.Clear(); break; case "2": Console.Clear(); Console.Write("Username : "******"\nPassword : "******"3": Console.WriteLine("\nThanks for using. Have a nice day!\n"); Environment.Exit(0); break; default: Console.WriteLine("\nInvalid Option\n"); Thread.Sleep(1000); Console.Clear(); break; } } }
public void TryOpenCustomerDetailWithNullCurrentRecord() { using (CustomersList list = (CustomersList)ModulesManager.Current.OpenModuleObjectDetail(new CustomersListObject(Session), false)) { CustomerDetailView.LastCreatedView = null; list.CustomersEdit.CurrentRecord = null; list.CommandEdit(null); CustomerDetailView detailView = CustomerDetailView.LastCreatedView; Assert.IsNull(detailView); } }
private void BtnDisplay_Click(object sender, RoutedEventArgs e) { output = ReadFromFile(); TB.Text = string.Empty; output.Sort(); foreach (Building b in output) { TB.Text += b.ToString() + "\n" + "\n"; } }
public void OpenCustomerDetail() { using (CustomersList list = (CustomersList)ModulesManager.Current.OpenModuleObjectDetail(new CustomersListObject(Session), false)) { list.OpenDetail(Andrew.Oid, null); CustomerDetailView detailView = CustomerDetailView.LastCreatedView; Assert.IsNotNull(detailView); Assert.AreEqual(Andrew.Oid, detailView.Module.CustomerEdit.VRObjectEditObject.VideoRentObject.Oid); detailView.Module.Dispose(); } }
public void UpdateList() { List <TradePointCustomer> entList = TradePointCustomersController.GetInstance().GetTradesPointCustomers(); entList.Sort((x, y) => x.Name.CompareTo(y.Name)); collection = new ObservableCollection <TradePointCustomer>(entList); CustomersList.ItemsSource = collection; CustomersList.Items.Refresh(); CustomersList.UpdateLayout(); }
public void OpenCustomerDetail_SetCurrentCustomer() { using (CustomersList list = (CustomersList)ModulesManager.Current.OpenModuleObjectDetail(new CustomersListObject(Session), false)) { list.OpenDetail(Andrew.Oid, null); CustomerDetailView detailView = CustomerDetailView.LastCreatedView; Assert.IsNotNull(detailView); detailView.Module.SetAsCurrentCustomer(); detailView.Module.Dispose(); } LayoutManager.Current.Logout(); Assert.IsTrue(LayoutManager.Current.Login(ReferenceData.AdministratorString, string.Empty, Session)); Assert.AreEqual(Andrew.Oid, ViewModelLayoutData.GetLayoutData().CurrentCustomerOid); }
public void CreateCustomerDetailsWithDifferentTags_CloseEachGroup() { CurrentCustomerProvider.Current.CurrentCustomerOid = Alex.Oid; using (CustomersList list = (CustomersList)ModulesManager.Current.OpenModuleObjectDetail(new CustomersListObject(Session), false)) { using (CurrentCustomerRentsDetail detail = (CurrentCustomerRentsDetail)ModulesManager.Current.OpenModuleObjectDetail(new CurrentCustomerRentsDetailObject(Session), false)) { list.ListEdit.CurrentRecord = Anton; list.CommandEdit("Anton"); CustomerDetail currentCustomerDetail = (CustomerDetail)detail.OpenDetail(Alex.Oid, "Alex"); list.CommandCloseDetails(null); Assert.AreNotEqual(0, ModulesManager.Current.GetModulesForType(currentCustomerDetail.GetModuleTypeKey()).Count); } } }
private void OnAddCustomerCommandExecute() { Customer customer = new Customer(); customer.Name = CurrentCustomerName; customer.MVZList = new ObservableCollection <MVZ>(); foreach (var item in MVZList) { customer.MVZList.Add(item); } CustomersList.Add(customer); db.SaveChanges(); }
void CustomerEditor_Init(object sender, EventArgs e) { EnsureChildControls(); CustomerTableAdapter adapter = new CustomerTableAdapter(); CustomersList.DataSource = adapter.GetData(); CustomersList.DataTextField = "CompanyName"; CustomersList.DataValueField = "CustomerID"; CustomersList.DataBind(); CustomersList.Items.Insert(0, ""); }
protected void Page_Load(object sender, EventArgs e) { List <string> names = new List <string>(); for (int i = 0; i < 99; i++) { names.Add("John Doe" + i.ToString()); } //CustomersGridView.DataSource = names; //CustomersGridView.DataBind(); CustomersList.DataSource = names; CustomersList.DataBind(); }
protected void SaveReferencesIds() { foreach (Order order in OrdersList) { order.CarId = CarsList.First(c => order.Car == c).CarId; order.CustomerId = CustomersList.First(c => order.Customer == c).CustomerId; } foreach (Car car in CarsList) { car.CustomerId = CustomersList.First(c => car.Customer == c).CustomerId; } }
public List <Customer> Parse() { List <Customer> customers = new List <Customer>(); using (FileStream fileStream = new FileStream(_settings.DataFilePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (StreamReader reader = new StreamReader(fileStream)) { CustomersList customerList = (CustomersList) new XmlSerializer(typeof(CustomersList)).Deserialize(fileStream); customers = customerList.Customers; } } return(customers); }
public void CreateCustomer_CheckAllowSetAsCurrent() { using (CustomersList list = (CustomersList)ModulesManager.Current.OpenModuleObjectDetail(new CustomersListObject(Session), false)) { using (CustomerDetail detail = (CustomerDetail)list.OpenDetail(null, null)) { detail.CustomerEdit.VRObjectEditObject.VideoRentObject.FirstName = "x"; detail.CustomerEdit.VRObjectEditObject.VideoRentObject.LastName = "y"; Assert.IsFalse(detail.AllowSetAsCurrentCustomer); Assert.IsFalse(detail.SetAsCurrentCustomer()); Assert.IsTrue(detail.Save()); Assert.IsTrue(detail.AllowSetAsCurrentCustomer); Assert.IsTrue(detail.SetAsCurrentCustomer()); } } }
private void customerListToolStripMenuItem_Click(object sender, EventArgs e) { if (_instancelstCust == null) { CloseAllForms(); _instancelstCust = new CustomersList(); _instancelstCust.MdiParent = this; _instancelstCust.FormClosed += instancelstCustHasBeenClosed; } else { ShowMessage(); } _instancelstCust.Show(); }
private CustomersList ReadFromFile() { FileStream fs = null; CustomersList c = new CustomersList(); int type, size, outlets, bulbs; string cc; try { fs = new FileStream("customers.txt", FileMode.OpenOrCreate, FileAccess.Read); BinaryReader br = new BinaryReader(fs); while (br.BaseStream.Position != br.BaseStream.Length) { type = br.ReadInt32(); size = br.ReadInt32(); outlets = br.ReadInt32(); bulbs = br.ReadInt32(); cc = br.ReadString(); switch (type) { case 1: c.Add(new Barn(size, bulbs, outlets, cc)); break; case 2: c.Add(new Garage(size, bulbs, outlets, cc)); break; case 3: c.Add(new House(size, bulbs, outlets, cc)); break; } } return(c); } catch (IOException ioe) { string ex = ioe.ToString(); return(null); } finally { if (fs != null) { fs.Close(); } } }
protected void Page_Load(object sender, EventArgs e) { List <string> names = new List <string>(); for (int i = 0; i < 99; i++) { names.Add("John Doe" + i.ToString()); } // CustomerGridView.DataSource = names; // Bind the data into the GridView table. This is called an Item control- // CustomerGridView.DataBind(); // For the bullet list. CustomersList.DataSource = names; CustomersList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { //Create a list of values for the controls to display List <string> names = new List <string>(); for (int i = 0; i < 99; i++) { names.Add("John Doe" + i.ToString()); } //Assign and bind to datagrid CustomersGridView.DataSource = names; CustomersGridView.DataBind(); //Assign and bind to bullet list CustomersList.DataSource = names; CustomersList.DataBind(); }
public void CreateCustomer_SetAsCurrent_Delete_OpenCurrentCustomerDetail() { using (CustomersList list = (CustomersList)ModulesManager.Current.OpenModuleObjectDetail(new CustomersListObject(Session), false)) { using (CustomerDetail detail = (CustomerDetail)list.OpenDetail(null, null)) { detail.CustomerEdit.VRObjectEditObject.VideoRentObject.FirstName = "x"; detail.CustomerEdit.VRObjectEditObject.VideoRentObject.LastName = "y"; Assert.IsTrue(detail.Save()); Assert.IsTrue(detail.SetAsCurrentCustomer()); Assert.IsTrue(detail.Close()); } Assert.IsNotNull(CurrentCustomerProvider.Current.CurrentCustomer); Customer currentCustomer = SessionHelper.GetObject <Customer>(CurrentCustomerProvider.Current.CurrentCustomer, list.CustomersEdit.VRObjectsEditObject.VideoRentObjects.Session); Assert.AreEqual("x", currentCustomer.FirstName); Assert.AreEqual("y", currentCustomer.LastName); list.CustomersEdit.CurrentRecord = currentCustomer; Assert.IsTrue(list.CustomersEdit.DeleteCurrentRecord()); Assert.IsNull(CurrentCustomerProvider.Current.CurrentCustomerOid); } }
private void LoadReferences() { try { foreach (Order order in OrdersList) { order.Customer = CustomersList.First(c => c.CustomerId == order.CustomerId); order.Car = CarsList.First(c => c.CarId == order.CarId); } foreach (Car car in CarsList) { car.Customer = CustomersList.First(c => c.CustomerId == car.CustomerId); } } catch (InvalidOperationException e) { throw new FileCorruptedException("Скорее всего файл поврежден.", e); } }
public static string GET_ALL_CUSTOMERS() { try { conn.Open(); //utworzenie zapytania do bazy o pozycję użytkownika MySqlCommand command = conn.CreateCommand(); command.CommandType = System.Data.CommandType.Text; command.CommandText = "SELECT * FROM customers"; //sprawdzenie, czy baza zwróciła cokolwiek object result = command.ExecuteScalar(); //jeśli zwróciła if (result != null) { var reader = command.ExecuteReader(); reader.Read(); while (reader.Read()) { CustomersList.Add(new Customer(reader)); } return("customers-loaded"); } //jeśli nie zwróciła - brak klientów w bazie else { return("no-customer"); } } //obsługa błędu połączenia z bazą catch (MySqlException) { return("no-connection"); } finally { conn.Close(); } }
private void Init(bool isDefault) { if (isDefault) { SelectedSection = SectionsList[0]; SelectedType = TypesList[0]; SelectedStatus = StatusesList[0]; SelectedSource = SourcesList[0]; SelectedCustomer = CustomersList[0]; SelectedBroker = BrokersList[0]; SelectedTrader = TradersList[0]; } else { SelectedSection = SectionsList.First(s => s.id == Auction.sectionId); SelectedType = TypesList.First(t => t.id == Auction.typeId); SelectedStatus = StatusesList.First(s => s.Id == Auction.StatusId); SelectedSource = SourcesList.First(s => s.id == Auction.SiteId); SelectedCustomer = CustomersList.First(c => c.id == Auction.CustomerId); SelectedBroker = BrokersList.First(b => b.Id == Auction.BrokerId); SelectedTrader = TradersList.First(t => t.id == Auction.TraderId); } }
public CustomersListView(CustomersList customersList) : base(customersList) { LastCreatedView = this; }
public void AddCustomer(Customer customer) { CustomersList.Add(customer); }
public MainWindow() { InitializeComponent(); customers = new CustomersList(); output = new CustomersList(); }
async public Task <string> GetAllCustomers() { CustomersList = JsonConvert.DeserializeObject <List <DTO_Customer> >(await MakeRequest(new DTO_Base(), "GetAllCustomers")); return(CustomersList.Last().Message); }
static void Main(string[] args) { BikeStoreContext _dbContext = new BikeStoreContext(); Stopwatch _stopWatch = new Stopwatch(); storedProceduresAccess sp = new storedProceduresAccess(); CustomersList clist = new CustomersList(); Console.WriteLine("Hello World!"); Console.WriteLine("Notice that first query will be the longest fetch as EFCore validates " + "the model that it is been requested"); Console.WriteLine("Press any key to start the EFCore test"); Console.ReadKey(); Console.WriteLine(); //_stopWatch.Start(); //var postgres = sp.getCustomerFromSqlRawPostgres(); //_stopWatch.Stop(); //Console.WriteLine($"Execute sp from EFCore: {_stopWatch.ElapsedMilliseconds}"); //Thread.Sleep(1000); _stopWatch.Start(); var f = sp.getCustomersList(); _stopWatch.Stop(); Console.WriteLine($"Cold Query List: {_stopWatch.ElapsedMilliseconds}, total records: {f.Count}"); _stopWatch.Reset(); Thread.Sleep(1000); //f.ForEach(x => Console.WriteLine($"{x.CustomerId}: {x.FirstName}")); _stopWatch.Start(); sp.getCustomersList(); _stopWatch.Stop(); Console.WriteLine($"List: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); sp.getCustomersListNoTracking(); _stopWatch.Stop(); Console.WriteLine($"List as no tracking: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); storedProceduresAccess.getCustomersCompiled(_dbContext); _stopWatch.Stop(); Console.WriteLine($"Cold Compiled Query IEnumnerable: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); storedProceduresAccess.getCustomersCompiled(_dbContext); _stopWatch.Stop(); Console.WriteLine($"Warm Compiled Query IEnumnerable: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); storedProceduresAccess.getCustomer1(_dbContext); _stopWatch.Stop(); Console.WriteLine($"Cold Compiled Query 1 customer IEnumnerable: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); storedProceduresAccess.getCustomer1(_dbContext); _stopWatch.Stop(); Console.WriteLine($"Warm Compiled Query 1 customer IEnumnerable: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); sp.getCustomersIList(); _stopWatch.Stop(); Console.WriteLine($"IList: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); sp.getCustomersIListNoTracking(); _stopWatch.Stop(); Console.WriteLine($"IList as no tracking: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); sp.getCustomersIEnumerable(); _stopWatch.Stop(); Console.WriteLine($"IEnumerale: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); sp.getCustomersIEnumerableNoTracking(); _stopWatch.Stop(); Console.WriteLine($"IEnumerale as no tracking: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); sp.getAsyncCustomersIEnumerable(); _stopWatch.Stop(); Console.WriteLine($"Async IEnumerable: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); sp.getAsyncCustomersIEnumerableNoTracking(); _stopWatch.Stop(); Console.WriteLine($"Async IEnumerable as no tracking: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); sp.getCustomerFromSqlRawPostgres(); _stopWatch.Stop(); Console.WriteLine($"Execute sp from EFCore: {_stopWatch.ElapsedMilliseconds}"); Console.WriteLine("Now begin Store Procedure counterpart"); Console.ReadKey(); _stopWatch.Start(); var cl = clist.getCustomersSP(); _stopWatch.Stop(); Console.WriteLine($"Stored Procedure round 1: {_stopWatch.ElapsedMilliseconds}, records: {cl.Rows.Count}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); clist.getCustomersSP(); _stopWatch.Stop(); Console.WriteLine($"Stored Procedure round 2: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Thread.Sleep(1000); _stopWatch.Start(); clist.getCustomersSP(); _stopWatch.Stop(); Console.WriteLine($"Stored Procedure round 3: {_stopWatch.ElapsedMilliseconds}"); _stopWatch.Reset(); Console.ReadKey(); }