public UnitOfWork(RestaurantContext context) { _context = context; Adjustments = new AdjustmentRepository(_context); AdjustmentsItems = new AdjustmentItemRepository(_context); Branches = new BranchRepository(_context); Categories = new CategoryRepository(_context); Customers = new CustomerRepository(_context); Deliveries = new DeliveryRepository(_context); DeliveryItems = new DeliveryItemRepository(_context); Divisions = new DivisionRepository(_context); Expirations = new ExpirationRepository(_context); Groups = new GroupRepository(_context); Stocks = new InventoryItemRepository(_context); Locations = new LocationRepository(_context); Units = new MeasurementUnitRepository(_context); Productions = new ProductionRepository(_context); Ingredients = new ProductionItemRepository(_context); Products = new ProductRepository(_context); Purchases = new PurchaseRepository(_context); PurchaseItems = new PurchaseItemRepository(_context); PurchaseOrders = new PurchaseOrderRepository(_context); PurchaseOrderItems = new PurchaseOrderItemRepository(_context); SalesInvoices = new SalesInvoiceRepository(_context); SalesInvoiceItems = new SalesInvoiceItemRepository(_context); Suppliers = new SupplierRepository(_context); Transfers = new TransferRepository(_context); TransferItems = new TransferItemRepository(_context); Wastages = new WastageRepository(_context); WastageItems = new WastageItemRepository(_context); Workers = new WorkerRepository(_context); ItemLocation = new ItemLocationRepository(_context); StockHistory = new StockHistoryRepository(_context); Currencies = new CurrencyRepository(_context); }
//Adding data to dataView private void AddDataItems(ASPxDataView dvMaster, int lineId, int sectionId) { AssemblySection section = ProductionRepository.GetAssemblySection(sectionId); List <Station> stations = new List <Station>(); stations = ProductionRepository.GetStationsInAssemblySection(sectionId); if (stations.Any()) { foreach (Station sta in stations) { DataViewItem dvItem = new DataViewItem(); StationInfo info = new StationInfo(); info.StationId = sta.Id; info.StationName = sta.StationName; info.SectionId = sectionId; info.LineId = lineId; info.SectionTypeId = section.AssemblySectionTypeId; info.IsQGate = sta.IsQualityGate; info.Capacity = sta.Capacity; info.Items = ProductionRepository.GetProductionItems(info.LineId, info.StationId); dvItem.DataItem = info; dvMaster.Items.Add(dvItem); } dvMaster.SettingsTableLayout.ColumnCount = stations.Count; } }
public async Task <ISingleResponse <CreateOrderRequest> > GetCreateOrderRequestAsync() { Logger?.LogDebug("{0} has been invoked", nameof(GetCreateOrderRequestAsync)); var response = new SingleResponse <CreateOrderRequest>(); try { // Retrieve customers list response.Model.Customers = await SalesRepository.GetCustomers().ToListAsync(); // Retrieve employees list response.Model.Employees = await HumanResourcesRepository.GetEmployees().ToListAsync(); // Retrieve shippers list response.Model.Shippers = await SalesRepository.GetShippers().ToListAsync(); // Retrieve products list response.Model.Products = await ProductionRepository.GetProducts().ToListAsync(); } catch (Exception ex) { response.SetError(ex, Logger); } return(response); }
protected void UpdateDisplay() { List <ProductionItem> items = ProductionRepository.GetAllProductionItems(PermissionHelper.GetCurrentAssemblyTypeId()); //update all dvStations foreach (DataViewItem dvi in dvStations) { StationInfo info = dvi.DataItem as StationInfo; IEnumerable <ProductionItem> pi = items.Where(x => x.LineId == info.LineId && x.StationId == info.StationId); if (pi.Count() == 0) { //no vehicle in the station > clear the station } else { //there are vehicle in the station if (info.Capacity == 1) { //show the vehicle info } else { //show the number of vehicle in station } } } }
public void CreateOrder(Order header, OrderDetail[] details) { using (var transaction = DbContext.Database.BeginTransaction()) { try { SalesRepository.AddOrder(header); foreach (var detail in details) { detail.OrderID = header.OrderID; SalesRepository.AddOrderDetail(detail); var productInventory = new ProductInventory { ProductID = detail.ProductID, EntryDate = DateTime.Now, Quantity = detail.Quantity }; ProductionRepository.AddProductInventory(productInventory); } transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw ex; } } }
public AddOrderResponse AddOrder(Order order, DateTime orderDate, string customerName, string stateName, string productType, decimal Area) { List <Order> Orders = ProductionRepository.GetOrders(); List <Products> Products = ProductionRepository.GetProducts(); List <Taxes> Taxes = ProductionRepository.GetTaxes(); AddOrderResponse response = new AddOrderResponse(); if (orderDate <= DateTime.Today) { response.Success = false; response.Message = "Error: Order Date Must Be in the Future."; return(response); } if (string.IsNullOrEmpty(customerName) == true) { response.Success = false; response.Message = "Error: Customer Name Cannot Be Blank."; return(response); } if (!Taxes.Any(t => t.StateAbbreviation == stateName)) { response.Success = false; response.Message = "Error: Incorrect State Code - Please Check Records and Re-Enter."; return(response); } if (!Products.Any(p => p.ProductType.ToUpper() == productType.ToUpper())) { response.Success = false; response.Message = "Error: That is Not a Current Product in Our System."; return(response); } if (Area <= 0) { response.Success = false; response.Message = "Error: Area Must be a Positive Number."; return(response); } else { response.OrderDate = orderDate; response.CustomerName = customerName; response.StateName = stateName; response.ProductType = productType; response.Area = Area; response.Success = true; response.Message = "Order Added Successfully!"; return(response); } }
public RemoveOrderResponse RemoveOrder(Order order, DateTime orderDate, int orderNumber) { List <Order> Orders = ProductionRepository.GetOrders(); List <Products> Products = ProductionRepository.GetProducts(); List <Taxes> Taxes = ProductionRepository.GetTaxes(); RemoveOrderResponse response = new RemoveOrderResponse(); if (!Orders.Any(o => o.OrderDate == orderDate && o.OrderNumber == orderNumber)) { response.Success = false; response.Message = "Error: That Order Cannot Be Found In Our System. Please Check Date and Order Number and Re-Enter."; return(response); } else { response.Order = order; response.OrderDate = orderDate; response.OrderNumber = orderNumber; response.Success = true; response.Message = "Order Found"; return(response); } }
public void StockBillItems_StockItem_ShouldReturnAssemblyStock() { IProductionRepository repo = new ProductionRepository(new BadgerDataModel()); var result = repo.GetStockBillItems(64); Assert.IsTrue(result.Count == 1); }
public void Production_SubAssembly_ShouldReturnSubAssembly() { IProductionRepository repo = new ProductionRepository(new BadgerDataModel()); var result = repo.GetSubAssemblies(20); Assert.IsTrue(result.Count == 2); }
public void Production_Assembly_ShouldReturnJobAssemblies() { IProductionRepository repo = new ProductionRepository(new BadgerDataModel()); var result = repo.GetJobAssemblies(1172); Assert.IsTrue(result.Count == 69); }
public async Task <IPagingResponse <Warehouse> > GetWarehousesAsync(Int32 pageSize = 10, Int32 pageNumber = 1) { Logger?.LogInformation("{0} has been invoked", nameof(GetWarehousesAsync)); var response = new PagingResponse <Warehouse>(); try { // Get query var query = ProductionRepository.GetWarehouses(); // Set information for paging response.PageSize = (Int32)pageSize; response.PageNumber = (Int32)pageNumber; response.ItemsCount = await query.CountAsync(); // Retrieve items, set model for response response.Model = await query.Paging(pageSize, pageNumber).ToListAsync(); } catch (Exception ex) { response.SetError(ex, Logger); } return(response); }
public async Task <IPagedResponse <Product> > GetProductsAsync(int pageSize = 10, int pageNumber = 1, int?productCategoryID = null) { Logger?.LogInformation("{0} has been invoked", nameof(GetProductsAsync)); var response = new PagedResponse <Product>(); try { // Get query var query = ProductionRepository.GetProducts(productCategoryID); // Set information for paging response.PageSize = pageSize; response.PageNumber = pageNumber; response.ItemsCount = await query.CountAsync(); // Retrieve items, set model for response response.Model = await query.Paging(pageSize, pageNumber).ToListAsync(); } catch (Exception ex) { response.SetError(ex, Logger); } return(response); }
public void Production_Assembly_ShouldReturnAllAssemblies() { IProductionRepository repo = new ProductionRepository(new BadgerDataModel()); var result = repo.GetAssemblies(); //--------------------------------- Assert.IsTrue(result.Count > 10); }
public void Delete() { foreach (Job thisJob in JobList) { thisJob.Reset(); } CleanUp(); ProductionRepository.DeleteProduction(this); FireSuccessEvent(); }
private void AnimatedMotifsTimer_Elapsed(object sender, ElapsedEventArgs e) { List <AnimatedMotif> animatedMotifListBuffer = ProductionRepository.ReadAnimatedMotifs(); foreach (AnimatedMotif newAnimatedMotif in animatedMotifListBuffer) { if (animatedMotifList.Any(item => item.ID == newAnimatedMotif.ID) == false) { animatedMotifList.Add(newAnimatedMotif); newAnimatedMotif.StartWorker(); } } }
public UnitOfWork(ApplicationContext moviesContext) { this.moviesContext = moviesContext; Publications = new PublicationRepository(moviesContext); CaseTypes = new CaseTypeRepository(moviesContext); CompanyRoleTypes = new CompanyRoleTypeRepository(moviesContext); PublicationCompanyRoles = new PublicationCompanyRoleRepository(moviesContext); Companies = new CompanyRepository(moviesContext); ProductionTypes = new ProductionTypeRepository(moviesContext); PublicationItems = new PublicationItemRepository(moviesContext); Persons = new PersonRepository(moviesContext); Productions = new ProductionRepository(moviesContext); }
protected void btnRectification_Click(object sender, EventArgs e) { var items = gridCondition.GetSelectedFieldValues(new string[] { "ItemId", "StationId" }); if (items.Any()) { foreach (var item in items) { //getcurrentStaion and history //convert object to readable type IEnumerable <object> prodItem = (IEnumerable <object>)item; int currentHistoryId = Convert.ToInt32(prodItem.FirstOrDefault().ToString()); int currentStationId = Convert.ToInt32(prodItem.LastOrDefault().ToString()); try { //back to unvoca if (ProductionRepository.UpdateProductionHistoryVOCA(currentHistoryId, false)) { //current history var currentProdItem = ProductionRepository.GetProductionItemByHistoryStation(currentStationId, currentHistoryId); //getnextposition bool oldIsRectify = currentProdItem.IsRectification; bool newIsRectify = true; //update process in this station if (ProductionRepository.UpdateProductionHistoryDetail(currentHistoryId, currentStationId, currentProdItem.IsOffline, oldIsRectify, currentProdItem.IsOffline, newIsRectify, false)) { //todo success LoadData(); } else { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Cannot Update Current History');", true); } } } catch (Exception ex) { //alert process has move to next station ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Failed Move to Next Station, please contact your administrator');", true); AppLogger.LogError(ex.Message); } } } else { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('No Rows Selected.');", true); } }
public void save(DateTime date) { try { ProductionRepository.UpdateAndonOverideDate(date); Response.Redirect(Request.RawUrl); } catch (Exception ex) { //alert process has move to next station ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Failed, please contact your administrator');", true); AppLogger.LogError(ex.Message); } }
protected void LoadData() { var productionItems = new List <ProductionItem>(); lblPosition.Text = "End Of Line"; btnProcess.Text = "Release Vehicle"; //btnRectification.Visible = true; _stationId = Convert.ToInt32(Request.QueryString["Stat"]); productionItems = ProductionRepository.GetProductionEndOfflIneByStation(_stationId); gridCondition.DataSource = productionItems; gridCondition.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString.Count > 0) { _lineId = Request.QueryString["LineId"]; } if (_lineId == null) { Response.Redirect("../Production/ProductionDashboard.aspx"); } //I assume LineId here is actually line number for the given AssemblyTypeId _productionLineId = ProductionRepository.GetProductionLineId(_lineId.ToInt32(0), assemblyTypeId); }
protected override void OnCreate(Bundle savedInstanceState) { ISharedPreferences pref = Application.Context.GetSharedPreferences ("_bitopi_UserInfo", FileCreationMode.Private); repo = new ProductionRepository(ShowLoader, HideLoader); LastLocation = pref.GetBoolean("IsLastLocation", false); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ProcessList); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetCustomView(Resource.Layout.custom_actionbar); InitializeControl(); InitializeEvent(); base.LoadDrawerView(); }
public EditOrderResponse EditOrder(Order order, DateTime orderDate, string newCustomerName, string newStateName, string newProductType, decimal newArea) { List <Order> Orders = ProductionRepository.GetOrders(); List <Products> Products = ProductionRepository.GetProducts(); List <Taxes> Taxes = ProductionRepository.GetTaxes(); EditOrderResponse response = new EditOrderResponse(); if (!Orders.Any(o => o.OrderDate == orderDate)) { response.Success = false; response.Message = "Error: That Order Cannot be Found in Our System. Please Check Date and Re-Enter."; return(response); } if (!Taxes.Any(t => t.StateAbbreviation == newStateName)) { response.Success = false; response.Message = "Error: Incorrect State Code - Please Check Records and Re-Enter."; return(response); } if (!Products.Any(p => p.ProductType.ToUpper() == newProductType.ToUpper())) { response.Success = false; response.Message = "Error: That is Not a Current Product in Our System."; return(response); } if (newArea <= 0) { response.Success = false; response.Message = "Error: Area Must be a Positive Number."; return(response); } else { response.NewCustomerName = newCustomerName; response.NewStateName = newStateName; response.NewProductType = newProductType; response.NewArea = newArea; response.Success = true; response.Message = "Order Successfully Changed!"; return(response); } }
public void Get_All_Production_ReadyCode_From_RepositoryTest(List <ProductionReadyCode> allCodes) { var fakeDbContext = A.Fake <IMetaDataContext <ProductionReadyCode> >(ops => ops.Strict()); var fakeRepository = A.Fake <IRepository <ProductionReadyCode> >(); //Setup A.CallTo(() => fakeDbContext.ProductionReadyCodes).Returns(allCodes); var prodRepository = new ProductionRepository <ProductionReadyCode>(fakeDbContext); //Act var results = prodRepository.All(); A.CallTo(() => fakeDbContext.ProductionReadyCodes).MustHaveHappened(); //Assert results.Should().BeEquivalentTo(allCodes); }
protected void Cancel_Click(object sender, EventArgs e) { try { ASPxButton btn = sender as ASPxButton; GridViewDataItemTemplateContainer container = btn.NamingContainer as GridViewDataItemTemplateContainer; var Rowindex = container.VisibleIndex; string ValueRowId = gridSubAssembly.GetRowValues(Rowindex, "ChassisNumber").ToString(); int StationId = int.Parse(gridSubAssembly.GetRowValues(Rowindex, "StationId").ToString()); ProductionRepository.DeleteSubAssembly(ValueRowId, StationId); Response.Redirect(Request.RawUrl); } catch (Exception ex) { AppLogger.LogError(ex.Message); } }
protected void LoadData() { var productionItems = new List <ProductionItem>(); if (_condition == "isVoca") { if (AppConfiguration.DEFAULT_ASSEMBLYTYPEID != assemblyTypeId) { lblPosition.Text = "Tear Down Audit"; } else { lblPosition.Text = "Voca"; } btnProcess.Text = "Release Vehicle"; //btnRectification.Visible = true; productionItems = ProductionRepository.GetProductionOffLineRecti(false, false, true, false, assemblyTypeId); } else if (_condition == "isRecti") { lblPosition.Text = "Rectification"; btnProcess.Text = "Send to End of Line"; productionItems = ProductionRepository.GetProductionOffLineRecti(false, true, false, false, assemblyTypeId); } else if (_condition == "isOffline") { lblPosition.Text = "Offline"; btnProcess.Text = "Send to Beginning Trim"; productionItems = ProductionRepository.GetProductionOffLineRecti(true, false, false, false, assemblyTypeId); } else { lblPosition.Text = "PA"; btnProcess.Text = "Release Vehicle"; // btnRectification.Visible = true; productionItems = ProductionRepository.GetProductionOffLineRecti(false, false, false, true, assemblyTypeId); } gridCondition.DataSource = productionItems; gridCondition.DataBind(); }
public void Delete_Specified_ProductionReadyCode_ById_From_Test(List <ProductionReadyCode> allCodes, List <ProductionReadyCode> codesAfterDeletion, int idForDeletion) { var fakeDbContext = A.Fake <IMetaDataContext <ProductionReadyCode> >(ops => ops.Strict()); //Setup var prodRepository = new ProductionRepository <ProductionReadyCode>(fakeDbContext); A.CallTo(() => fakeDbContext.ProductionReadyCodes).Returns(allCodes); //Act prodRepository.Delete(idForDeletion); A.CallTo(() => fakeDbContext.ProductionReadyCodes).MustHaveHappened(); var results = fakeDbContext.ProductionReadyCodes; //Assert results.Should().BeEquivalentTo(codesAfterDeletion); }
public async Task <IListModelResponse <Warehouse> > GetWarehousesAsync(Int32 pageSize, Int32 pageNumber) { Logger?.LogInformation("{0} has been invoked", nameof(GetWarehousesAsync)); var response = new ListModelResponse <Warehouse>() as IListModelResponse <Warehouse>; try { response.Model = await ProductionRepository.GetWarehouses(pageSize, pageNumber).ToListAsync(); } catch (Exception ex) { response.SetError(ex, Logger); } return(response); }
/// <summary> /// Custom Page_Init function for inherited class /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <returns></returns> protected override bool OnInit(object sender, EventArgs e) { int stationId = Request.QueryString["Stat"].ToInt32(0); //int historyId = Request.QueryString["Hist"].ToInt32(0); Station station = ProductionRepository.GetProductionStation(stationId); if (station == null) { masterPage.MainContent.Controls.Clear(); masterPage.MainContent.Controls.Add(new LiteralControl(string.Format("<h2>{0}</h2>", "Invalid Station"))); return(false); } ////if it is sequential station, directly open the station detail //if (station.IsSequentialAssembly && historyId > 0) //{ // Response.Redirect("~/custom/Production/ProductionDashboardDetail.aspx?Type=" + (station.IsQualityGate ? "1" : "0") // + "&Hist=" + historyId + "&Stat=" + station.Id + "&Sect=" + station.AssemblySectionId); //} //get TableMeta from Schema. Schema is loaded during login var schemaInfo = Application["SchemaInfo"] as SchemaInfo; tableMeta = schemaInfo.Tables.Where(s => s.Name.Equals(tableName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); if (tableMeta == null) { masterPage.MainContent.Controls.Clear(); masterPage.MainContent.Controls.Add(new LiteralControl(string.Format("<h2>{0}</h2>", "Invalid Page"))); return(false); } lblPosition.Text = station.StationName; masterPage.PageTitle.Controls.Add(new LiteralControl(station.StationName)); //Set master key SetMasterKey("StationId", station.Id); //Store the Station object so that it is accessible to other classes keyValues.Add("Station", station); keyValues.Add("StationId", station.Id); return(true); }
public void Save_ProductionReadyCode_To_Repository_Test(List <ProductionReadyCode> allCodes, ProductionReadyCode saveData) { var fakeDbContext = A.Fake <IMetaDataContext <ProductionReadyCode> >(ops => ops.Strict()); //Setup var prodRepository = new ProductionRepository <ProductionReadyCode>(fakeDbContext); A.CallTo(() => fakeDbContext.ProductionReadyCodes).Returns(allCodes); //Act prodRepository.Save(saveData); A.CallTo(() => fakeDbContext.ProductionReadyCodes).MustHaveHappened(); var results = fakeDbContext.ProductionReadyCodes; //Assert results.Should().Contain(x => Equals(x.Id, saveData.Id)); results.Should().HaveCount(allCodes.Count); }
public void Find_ProductionReadyCode_From_Repository_ById_Test(List <ProductionReadyCode> allCodes, ProductionReadyCode searchedResult, int id) { var fakeDbContext = A.Fake <IMetaDataContext <ProductionReadyCode> >(ops => ops.Strict()); //Setup var prodRepository = new ProductionRepository <ProductionReadyCode>(fakeDbContext); A.CallTo(() => fakeDbContext.ProductionReadyCodes).Returns(allCodes); //Act var results = prodRepository.FindById(id); A.CallTo(() => fakeDbContext.ProductionReadyCodes).MustHaveHappened(); // var results = fakeDbContext.ProductionReadyCodes; //Assert results.Should().BeEquivalentTo(searchedResult); results.Should().NotBeNull(); }