public RawMaterialQCModel InsertRawMaterialQCModel(TPO.Model.RawMaterials.RawMaterialQCModel model)
 {
     using (RawMaterialsRepository repo = new RawMaterialsRepository())
     {
         TPO.DL.Models.RawMaterialQC entity = Bind(model, new TPO.DL.Models.RawMaterialQC());
         int id = repo.CreateRawMaterialQC(entity);
         model.ID = id;
     }
     return(model);
 }
 /// <summary>
 /// Updates the RawMaterialQC record in the database that is represented by the RawMaterialQCModel.
 /// </summary>
 /// <param name="model">The RawMaterialQCModel representing the RawMaterialQC record.</param>
 public void UpdateRawMaterialQCModel(TPO.Model.RawMaterials.RawMaterialQCModel model)
 {
     using (RawMaterialsRepository repo = new RawMaterialsRepository())
     {
         TPO.DL.Models.RawMaterialQC entity = repo.GetRawMaterialQCByID(model.ID);
         if (entity != null)
         {
             entity = Bind(model, entity);
             repo.SaveChanges();
         }
     }
 }
        /// <summary>
        /// Retrieves the test configuration details for the provided raw material.
        /// </summary>
        /// <param name="rawMaterialID">The unique code of the raw material.</param>
        /// <returns>An instance of RawMaterialTestModel.</returns>
        public RawMaterialTestModel GetQCConfigurationByRawMaterial(Int32 rawMaterialID)
        {
            RawMaterialTestModel model = null;

            using (RawMaterialsRepository repo = new RawMaterialsRepository())
            {
                TPO.DL.Models.RawMaterialTest entity = repo.GetRawMaterialTestByRawMaterial(rawMaterialID);
                if (entity != null)
                {
                    model = Bind(entity, new RawMaterialTestModel());
                }
            }

            return(model);
        }
Example #4
0
 public UnitOfWork(RestProContext context)
 {
     _context   = context;
     Users      = new UserRepository(_context);
     WorkCycles = new WorkCycleRepository(_context);
     UserAuthenticationService = new UserAuthenticationService(new UserRepository(_context));
     Suppliers                      = new SupplierRepository(_context);
     Statuses                       = new StatusRepository(_context);
     PurchaseOrders                 = new PurchaseOrderRepository(_context);
     RawMaterials                   = new RawMaterialsRepository(_context);
     RawMaterialCategories          = new RawMaterialCategoryRepository(_context);
     Locations                      = new LocationRepository(_context);
     InventorySettings              = new InventorySettingsRepository(_context);
     WorkCycleStatuses              = new WorkCycleStatusRepository(_context);
     PurchaseOrderTransactions      = new PurchaseOrderTransactionRepository(_context);
     WorkCycleTransactions          = new WorkCycleTransactionRepository(_context);
     WorkCyclesLines                = new WorkCycleLineRepository(_context);
     Inventory                      = new InventoryRepository(_context);
     InventoryTransactionRepository = new InventoryTransactionsRepository(_context);
 }
        /// <summary>
        /// Gets a RawMaterialQCModel representing the RawMaterialQC record indicated by the provided ID.
        /// The RawMaterialQCModel returns also includes configuration data for the various test available.
        /// </summary>
        /// <param name="id">The ID of the RawMaterialQC record in the database.</param>
        /// <returns>A RawMaterialQCModel</returns>
        public RawMaterialQCModel GetRawMaterialQCModelByRawMaterialQCID(int id)
        {
            RawMaterialQCModel model = null;

            using (RawMaterialsRepository repo = new RawMaterialsRepository())
            {
                TPO.DL.Models.RawMaterialQC entity = repo.GetRawMaterialQCByID(id);
                if (entity != null)
                {
                    model = Bind(entity, new RawMaterialQCModel());
                    RawMaterialTest testBL   = new RawMaterialTest();
                    Int32           rawMatID = 0;

                    TPO.DL.Models.RawMaterialReceived rawMaterialReceived =
                        new TPOMVCApplicationEntities().RawMaterialReceiveds.Where(w => w.ID == model.RawMaterialReceivedID).First();

                    model.QCConfiguration = testBL.GetQCConfigurationByRawMaterial(rawMaterialReceived.RawMaterial.ID);
                }
            }

            return(model);
        }
Example #6
0
 public UnitOfWork(VegaContext context)
 {
     _context             = context;
     Clients              = new ClientRepository(_context);
     Users                = new UserRepository(_context);
     Supplier             = new SupplierRepository(_context);
     Component            = new ComponentRepository(_context);
     ImportingInvoice     = new ImportingInvoiceRepository(_context);
     UGroup               = new GroupsRepository(_context);
     FabricationOrder     = new FabricationOrderRepository(_context);
     Expence              = new ExpenceRepository(_context);
     ExpenceCat           = new  ExpenceCatRepository(_context);
     GroupPermission      = new  GroupPermissionRepository(_context);
     Permission           = new PermissionRepository(_context);
     Sequence             = new SequenceRepository(_context);
     Nomenclature         = new NomenclatureRepository(_context);
     NomenclatureSequence = new NomenclatureSequenceRepository(_context);
     Color                = new ColorRepository(_context);
     SellingInvoices      = new SellingInvoicesRepository(_context);
     RawMaterials         = new RawMaterialsRepository(_context);
     UsedRawMaterial      = new UsedRawMaterialRepository(_context);
     ProgressionChecks    = new ProgressionChecksRepository(_context);
 }