public async Task <SuppliersQueryResult> Handle(SuppliersQuery query) { if (!string.IsNullOrEmpty(query.TeamId)) { var suppliers = (await supplierRepository.QuerySupplier(new SuppliersByTeamQuery { TeamId = query.TeamId, })).Items; var res = mapper.Map <IEnumerable <Shared.Contracts.Suppliers.Supplier> >(suppliers); return(new SuppliersQueryResult { Items = res }); } else if (!string.IsNullOrEmpty(query.SupplierId) || !string.IsNullOrEmpty(query.LegalName) || !string.IsNullOrEmpty(query.GSTNumber)) { var suppliers = (await supplierRepository.QuerySupplier(new SupplierSearchQuery { SupplierId = query.SupplierId, LegalName = query.LegalName, GSTNumber = query.GSTNumber, })).Items; var res = mapper.Map <IEnumerable <Shared.Contracts.Suppliers.Supplier> >(suppliers); return(new SuppliersQueryResult { Items = res }); } else { throw new Exception($"Unknown query type"); } }
public int Suppliers_GetCount(string serializedQuery) { SuppliersQuery query = SuppliersQuery.SerializeHelper.FromXml( serializedQuery, typeof(SuppliersQuery), AllKnownTypes) as SuppliersQuery; return(query.ExecuteScalar <int>()); }
public async Task <List <Supplier> > HandleAsync(SuppliersQuery query) { var data = await db.Suppliers.ToListAsync(); var suppliers = mapper.Map <List <Supplier> >(data); return(suppliers); }
public async Task <IEnumerable <Contact> > GetContactsAsync(Guid id) { var query = new SuppliersQuery { FilterIds = id.Collect() }; return((await _queryInvoker.Execute <SuppliersQuery, Supplier>(query)).SingleOrDefault()?.Contacts); }
public void GetSuppliersTest(string supplierCode) { var suppliersQuery = new SuppliersQuery(""); var exception = Record.Exception(() => suppliersQuery.GetSuppliers(supplierCode)); Assert.NotNull(exception); _output.WriteLine(exception.Message); }
public async Task <SupplierModel> GetAsync(Guid id) { var query = new SuppliersQuery { FilterIds = id.Collect() }; var supplier = (await _queryInvoker.Execute <SuppliersQuery, Supplier>(query)).SingleOrDefault(); return(_mapper.Map <SupplierModel>(supplier)); }
public SuppliersCollection Suppliers_LoadByDynamic(string serializedQuery) { SuppliersQuery query = SuppliersQuery.SerializeHelper.FromXml( serializedQuery, typeof(SuppliersQuery), AllKnownTypes) as SuppliersQuery; SuppliersCollection coll = new SuppliersCollection(); coll.es.IsLazyLoadDisabled = true; coll.Load(query); return(coll); }
public SuppliersProxyStub Suppliers_QueryForEntity(string serializedQuery) { SuppliersQuery query = SuppliersQuery.SerializeHelper.FromXml( serializedQuery, typeof(SuppliersQuery), AllKnownTypes) as SuppliersQuery; Suppliers obj = new Suppliers(); if (obj.Load(query)) { return(obj); } return(null); }
public SuppliersCollectionProxyStub Suppliers_QueryForCollection(string serializedQuery) { SuppliersQuery query = SuppliersQuery.SerializeHelper.FromXml( serializedQuery, typeof(SuppliersQuery), AllKnownTypes) as SuppliersQuery; SuppliersCollection coll = new SuppliersCollection(); if (coll.Load(query)) { return(coll); } return(null); }
public ProductsCollection Products_LoadWithExtraColumn() { ProductsQuery p = new ProductsQuery("p"); SuppliersQuery s = new SuppliersQuery("s"); // Bring back the suppliers name for the Product from the Supplier table p.Select(p, s.CompanyName.As("SupplierName")); p.InnerJoin(s).On(p.SupplierID == s.SupplierID); ProductsCollection coll = new ProductsCollection(); coll.Load(p); return(coll); }
public async Task <ActionResult <IEnumerable <SupplierListItem> > > GetSuppliers(string?legalName, string?gstNumber) { var query = new SuppliersQuery(); if (!string.IsNullOrEmpty(legalName) && !string.IsNullOrEmpty(gstNumber)) { query.LegalName = legalName; query.GSTNumber = gstNumber; } else { query.TeamId = teamId; } var suppliers = (await messagingClient.Send(query)).Items; return(Ok(mapper.Map <IEnumerable <SupplierListItem> >(suppliers, opt => opt.Items["UserTeamId"] = teamId))); }
public async Task <IEnumerable <SupplierModel> > GetAsync([FromQuery] string nameLike, [FromQuery] Guid?articleExact, [FromQuery] string countryExact, [FromQuery] string provinceExact, [FromQuery] string cityExact, int?take, int?skip, string orderBy, string orderMode) //ToDo:4 optionally include archived? { var query = new SuppliersQuery { Take = take, Skip = skip, OrderBy = orderBy, OrderMode = orderMode, FilterNameLike = nameLike, FilterArticleIdExact = articleExact, FilterCountryExact = countryExact, FilterProvinceExact = provinceExact, FilterCityExact = cityExact }; //ToDo:2 query.AsLazy(); ?? var suppliers = await _queryInvoker.Execute <SuppliersQuery, Supplier>(query); return(_mapper.Map <IEnumerable <SupplierModel> >(suppliers)); }
public async Task <SuppliersQueryResult> Handle(SuppliersQuery query) { if (!string.IsNullOrEmpty(query.TeamId)) { var suppliers = (await supplierRepository.QuerySupplier(new SuppliersByTeamQuery { TeamId = query.TeamId, ActiveOnly = false })).Items; var res = mapper.Map <IEnumerable <Shared.Contracts.Teams.Supplier> >(suppliers); return(new SuppliersQueryResult { Items = res }); } else if (!string.IsNullOrEmpty(query.SupplierId) || !string.IsNullOrEmpty(query.LegalName) || !string.IsNullOrEmpty(query.GSTNumber)) { var suppliers = (await supplierRepository.QuerySupplier(new SupplierSearchQuery { SupplierId = query.SupplierId, LegalName = query.LegalName, GSTNumber = query.GSTNumber, })).Items; var res = mapper.Map <IEnumerable <Shared.Contracts.Teams.Supplier> >(suppliers); return(new SuppliersQueryResult { Items = res }); } else { return(new SuppliersQueryResult { Items = Array.Empty <Shared.Contracts.Teams.Supplier>() }); } }
public async Task <IList <Supplier> > HandleAsync(SuppliersQuery query, CancellationToken ct) { var result = _supplierRepository.GetAll(); return(result.ToList()); }
private void Form1_Load(object sender, EventArgs e) { //TAB PAGE CONTROL tabPage1.Text = "Manage Supplier"; tabPage2.Text = "Manage Reports"; tabPage3.Text = "Manage Report Filters"; tabPage4.Text = "Activity Log"; //Manage Suppliers Tab //------------------------------------- manageSuppliersTitle.Text = "Manage Suppliers"; supplierCodeLabel.Text = "Supplier Code:"; findSupplierEntry.Text = ""; findSupplierButton.Text = "Find"; supplierIDLabel.Text = "Supplier ID:"; supplierIDNumber.Text = "--"; supplierTypeLabel.Text = "Supplier Type:"; supplierTypeLabelA.Text = "--"; supplierStatusLabel.Text = "Supplier Status:"; supplierStatusLabelA.Text = "--"; recievesReportsLabel.Text = "Recieves Report:"; recievesReportsLabelA.Text = "--"; reportFrequencyLabel.Text = "Report Frequency:"; label1.Text = "--"; reportDayLabel.Text = "Report Day:"; emailAddressLabel.Text = "Email Address:"; viewReportHistoryButton.Text = "View Report History"; updateButton.Text = "Update"; emailAddressEntry.Text = ""; //-------------------------------------------- //MANAGE REPORTS TAB //--------------------------------------------- manageReportsTitle.Text = "Manage Reports:"; reportingStatusLabel.Text = "Reporting Status:"; reportFrequencyLabelP2.Text = "Default Report Frequency"; defaultReportDay.Text = "Default Report Day:"; supplierCodesLabel.Text = "Supplier Code:"; dateFromLabel.Text = "Date From:"; dateToLabel.Text = "Date To:"; listReportsLabel.Text = "List Reports:"; activeCheckBox.Text = "Active"; //--------------------------------------------- //Server=tcp:lowe.database.windows.net,1433;Initial Catalog=GMaster;Persist Security Info=False;User ID=eitadmin;Password=DaSci2017;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30; var supplierQuery = new SuppliersQuery("Server=tcp:lowe.database.windows.net,1433;Initial Catalog=EIT;Persist Security Info=False;User ID=eitadmin;Password=DaSci2017;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"); var suppliers = supplierQuery.GetSuppliers(new List <string>() { "TAYLPR" }); //, "DOMISA", "WEBSHY" fails with extra supplier codes for the where condition Debug.WriteLine("Suppliers Returned: " + suppliers.Count); }