public ProductAdminController()
 {
     this.publishingService = new PublishingService<auRant.Core.Entities.Product, DraftProduct, ProductRepository>(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.productCategoryService = new ProductCategoryService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.productStatusService = new ProductStatusService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.supplierService = new SupplierService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.helperService = new HelperService();
 }
 public PODOController(DeliveryOrderService doService, PurchaseDeliveryProductService pdpService, PurchaseOrderService poService,
                       ProductService pService, SupplierProductService spService, SupplierService supService, DeliveryOrderSupplierProductService dospService)
 {
     this.doService   = doService;
     this.poService   = poService;
     this.pdpService  = pdpService;
     this.pService    = pService;
     this.spService   = spService;
     this.supService  = supService;
     this.dospService = dospService;
 }
Beispiel #3
0
        public void Supplier_UpdateRange()
        {
            var list = new List <Supplier>();

            mockDataContext.Set <Supplier>().Returns(mockDatabaseSet);
            mockDatabaseSet.Attach(Arg.Any <Supplier>()).Returns(new Supplier());
            var SupplierRepository = new SupplierRepository(mockDataContext, mockUnitOfWork);
            var SupplierService    = new SupplierService(SupplierRepository);

            SupplierService.UpdateRange(list);
        }
        public void Supplier_Service_Tests()
        {
            // Arrange
            var supplierService = new SupplierService();

            // Act
            var result = supplierService.GetStockQuantityAbleToSupply(5, 10);

            // Assert
            Assert.Equal(5, result);
        }
        private String GetDealWith(string SupplierCode)
        {
            string strDealWith      = "";
            var    SupplierDealWith = SupplierService.GetSupplierDealWith(SupplierCode);

            foreach (var item in SupplierDealWith)  //Get Supplier DealWith
            {
                strDealWith += item.Name + "-";
            }
            return(strDealWith);
        }
Beispiel #6
0
        public void Supplier_Insert()
        {
            var Supplier = new Supplier();

            mockDataContext.Set <Supplier>().Returns(mockDatabaseSet);
            mockDatabaseSet.Add(Arg.Any <Supplier>()).Returns(Supplier);
            var SupplierRepository = new SupplierRepository(mockDataContext, mockUnitOfWork);
            var SupplierService    = new SupplierService(SupplierRepository);

            SupplierService.Insert(new Supplier());
        }
Beispiel #7
0
        public ActionResult LoadProductList(string sId)
        {
            int count = 0;;
            var nvl   = new System.Collections.Specialized.NameValueCollection();

            nvl.Add("supplierId", sId);
            //var list = ProductService.LoadProductList(nvl, out count);
            var list = SupplierService.GetProductsBySupplierId(sId, out count);

            return(ToDataGrid(list, count));
        }
Beispiel #8
0
        public void Supplier_Delete()
        {
            var Supplier = new Supplier();

            mockDataContext.Set <Supplier>().Returns(mockDatabaseSet);
            mockDatabaseSet.Remove(Arg.Any <Supplier>()).Returns(Supplier);
            var SupplierRepository = new SupplierRepository(mockDataContext, mockUnitOfWork);
            var SupplierService    = new SupplierService(SupplierRepository);

            SupplierService.Delete(Supplier);
        }
Beispiel #9
0
        public void Edit_NameNotSupplied_DomainValidationExceptionThrown()
        {
            var supplier = GetSupplierToEdit();
            var supplierRepositoryStub = MockRepository.GenerateMock <ISupplierRepository>();

            supplierRepositoryStub.Stub(x => x.GetById(supplier.Id)).Return(supplier);
            _supplierService = SupplierServiceFactory.Create(supplierRepositoryStub);
            EditSupplier(supplier.Id, String.Empty, GetAddressDetails("Trading"), GetContactInfo("Trading"),
                         GetAddressDetails("Sales"), GetContactInfo("Sales"));
            Assert.IsTrue(_domainValidationException.ResultContainsMessage(Messages.NameRequired));
        }
Beispiel #10
0
 public DeliveryOrderController()
 {
     context = new ApplicationDbContext();
     deliveryOrderService       = new DeliveryOrderService(context);
     purchaseOrderService       = new PurchaseOrderService(context);
     purchaseOrderDetailService = new PurchaseOrderService(context);
     userService     = new UserService(context);
     statusService   = new StatusService(context);
     supplierService = new SupplierService(context);
     itemService     = new ItemService(context);
 }
Beispiel #11
0
        public async Task GetSuppliersGetExistingSuppliers()
        {
            // arrange
            SupplierService supplierService = new SupplierService(_client);
            Supplier        supplier1       = new Supplier()
            {
                Id                    = 0,
                ProfileId             = 0,
                CompanyName           = "Name",
                CompanyLocation       = "Location",
                FreightResponsibility = "EXW",
                PalletExchange        = 1,
                Profile               = new Profile()
                {
                    Id       = 0,
                    Username = "******",
                    Password = "******",
                    Usertype = 2
                }
            };

            Supplier supplier2 = new Supplier()
            {
                Id                    = 0,
                ProfileId             = 0,
                CompanyName           = "Name",
                CompanyLocation       = "Location",
                FreightResponsibility = "EXW",
                PalletExchange        = 1,
                Profile               = new Profile()
                {
                    Id       = 0,
                    Username = "******",
                    Password = "******",
                    Usertype = 2
                }
            };

            supplier1 = await supplierService.CreateSupplier(supplier1);

            supplier2 = await supplierService.CreateSupplier(supplier2);

            int expected = 2;

            // act
            List <Supplier> actual = await supplierService.GetSuppliers();

            // assert
            Assert.IsTrue(expected == actual.Count);

            await supplierService.DeleteSupplier(supplier1.Id);

            await supplierService.DeleteSupplier(supplier2.Id);
        }
Beispiel #12
0
        public ActionResult Edit(int id, int supplierId)
        {
            var model = new EditSupplierAddressViewModel();

            prepareEditModel(model, id, supplierId);

            model.SupplierAddress = SupplierService.FindSupplierAddressModel(id, supplierId, model.CurrentCompany);
            model.LGS             = SupplierService.LockSupplierAddress(model.SupplierAddress);

            return(View(model));
        }
Beispiel #13
0
        public IHttpActionResult GetSupplierList()
        {
            var supplierService = new SupplierService();
            var supplierList    = supplierService.GetAll().Where(item => item.IsDelete != 1);
            var result          = new
            {
                list = supplierList
            };

            return(Json(result));
        }
Beispiel #14
0
        public void Supplier_InsertRange()
        {
            var list = new List <Supplier>();

            mockDataContext.Set <Supplier>().Returns(mockDatabaseSet);
            mockDatabaseSet.AddRange(Arg.Any <List <Supplier> >()).Returns(list);
            var SupplierRepository = new SupplierRepository(mockDataContext, mockUnitOfWork);
            var SupplierService    = new SupplierService(SupplierRepository);

            SupplierService.InsertRange(list);
        }
Beispiel #15
0
        public IHttpActionResult DeleteSupplier(int ID)
        {
            var supplierService = new SupplierService();
            var deleteSupplier  = supplierService.DeleteSupplier(ID);
            var result          = new
            {
                Count = deleteSupplier?"删除成功":"删除失败"
            };

            return(Json(result));
        }
Beispiel #16
0
        public IHttpActionResult EditSupplier(Supplier supplier)
        {
            var supplierService = new SupplierService();
            var editSupplier    = supplierService.EditSupplier(supplier);
            var result          = new
            {
                Count = editSupplier?"修改成功!":"修改失败"
            };

            return(Json(result));
        }
Beispiel #17
0
 private void getSupplierButton_Click(object sender, EventArgs e)
 {
     lodingButton3.Show();
     new Thread(() =>
     {
         Thread.CurrentThread.IsBackground = true;
         SupplierService.perform("pos/suppliers");
         lodingButton3.BeginInvoke(
             ((Action)(() => lodingButton3.Hide())));
     }).Start();
 }
Beispiel #18
0
        public void Create_NameGreaterThan256Characters_DomainValidationExceptionThrown()
        {
            var supplierRepositoryStub = MockRepository.GenerateStub <ISupplierRepository>();

            supplierRepositoryStub.Stub(x => x.GetByName("Gael Ltd")).Return(null);
            _supplierService = SupplierServiceFactory.Create(supplierRepositoryStub);
            CreateSupplier(
                Guid.NewGuid(), new string('a', 256), GetAddressDetails("Trading"), GetContactInfo("Trading"),
                GetAddressDetails("Sales"), GetContactInfo("Sales"));
            Assert.IsTrue(_domainValidationException.ResultContainsMessage(Messages.NameTooLarge));
        }
Beispiel #19
0
        public void Supplier_DeleteAsync_Cancellation_Token()
        {
            object[]        keyValues = { "Supplier" };
            Task <Supplier> task      = new Task <Supplier>(() => new Supplier());

            mockDataContext.Set <Supplier>().Returns(mockDatabaseSet);
            mockDatabaseSet.FindAsync(Arg.Any <CancellationToken>(), Arg.Any <object[]>()).Returns(task);
            mockDatabaseSet.Attach(Arg.Any <Supplier>()).Returns(new Supplier());
            var SupplierRepository = new SupplierRepository(mockDataContext, mockUnitOfWork);
            var SupplierService    = new SupplierService(SupplierRepository);
            var result             = SupplierService.DeleteAsync(CancellationToken.None, keyValues);
        }
Beispiel #20
0
        public async Task GetSuppliersNoExistingReturnsNewSupplierList()
        {
            // arrange
            SupplierService supplierService = new SupplierService(_client);
            int             expected        = 0;

            // act
            var actual = await supplierService.GetSuppliers();

            // assert
            Assert.IsTrue(expected == actual.Count);
        }
        public void Valid_Supplier_Validates_Successfully()
        {
            var supplierService = new SupplierService(null, new SupplierValidator());
            var supplier        = new Supplier()
            {
                Name = "Test"
            };

            var result = supplierService.IsValid(supplier);

            Assert.That(result, Is.True);
        }
Beispiel #22
0
        public ActionResult UpdateSupplier(List <KeyValue> supplier)
        {
            if (supplier == null || supplier.Count <= 0)
            {
                return(Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet));
            }
            var supplierReturnObject = SupplierService.UpdateSupplier(supplier);

            return(supplierReturnObject.State == "success"
                ? Json(new { state = "success", supplierId = supplierReturnObject.Id }, JsonRequestBehavior.AllowGet)
                : Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet));
        }
        public async Task GetSupplierAsync_Returns_Null()
        {
            //Arrange
            var id      = 10001;
            var service = new SupplierService(_myRestaurantContext);

            //Act
            var result = await service.GetSupplierAsync(d => d.Id == id);

            //Assert
            result.Should().BeNull();
        }
Beispiel #24
0
        public ActionResult Delete(bool confirm, string supplierCode, string sessionId)
        {
            if (confirm)
            {
                SupplierService.DeleteSupplier(supplierCode);

                List <Supplier> suppliers = SupplierService.DisplayAllSuppliers();
                ViewData["suppliers"] = suppliers;
                return(RedirectToAction("All", new { sessionid = sessionId }));
            }
            return(null);
        }
        public void Post()
        {
            using (var context = new SupplierContext(options))
            {
                var service  = new SupplierService(context);
                var supplier = DataHelper.GetDummySupplier();
                supplier.Id = Guid.NewGuid();
                var result = service.InsertSupplier(supplier);

                Assert.AreEqual(4, context.Suppliers.Count());
            }
        }
Beispiel #26
0
        public void GetSortedSuppliers()
        {
            var request = new SupplierListRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret)
            {
                SortBy = SupplierSortableProperties.Name
            };
            var suppliers = SupplierService.GetSuppliersAsync(request).GetAwaiter().GetResult().Data.ToList();

            Assert.IsTrue(suppliers.Count() >= 2);

            Assert.IsTrue(suppliers.ElementAt(0).Name.CompareTo(suppliers.ElementAt(1).Name) < 0);
        }
Beispiel #27
0
        public void Edit_ValidSupplierDetails_SupplierEdited()
        {
            var supplier = GetSupplierToEdit();
            var supplierRepositoryMock = MockRepository.GenerateMock <ISupplierRepository>();

            supplierRepositoryMock.Expect(x => x.Update(null)).IgnoreArguments();
            supplierRepositoryMock.Stub(x => x.GetById(supplier.Id)).Return(supplier);
            _supplierService = SupplierServiceFactory.Create(supplierRepositoryMock);
            EditSupplier(supplier.Id, "Gael Ltd", GetAddressDetails("Trading"), GetContactInfo("Trading"),
                         GetAddressDetails("Sales"), GetContactInfo("Sales"));
            supplierRepositoryMock.VerifyAllExpectations();
        }
        public ActionResult Edit(int id)
        {
            var model = new EditSupplierViewModel();

            prepareEditModel(model, id);

            model.Supplier        = SupplierService.FindSupplierModel(id);
            model.SupplierAddress = SupplierService.FindSupplierAddressModel(id);
            model.LGS             = SupplierService.LockSupplier(model.Supplier);

            return(View(model));
        }
        public void GetAllSuppliersFromRepositoryTest()
        {
            var mockUnitOfWork = new Mock <IUnitOfWork>();

            mockUnitOfWork.Setup(un => un.SupplierRepository.Get(s => s.Delete == false, null, "")).Returns(GetSuppliersList());

            ISupplierService supplierService = new SupplierService(mockUnitOfWork.Object);

            IEnumerable <Supplier> suppliers = supplierService.GetAllSuppliers();

            mockUnitOfWork.VerifyAll();
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env,
                              InventoryManagementSystemContext db,
                              IWebHostEnvironment environment,
                              ProductService pService,
                              DepartmentService dService,
                              InventoryTransactionService invtransService,
                              ProductCategoryService pcService,
                              DisbursementFormService dfService,
                              StationeryRetrievalFormService srfService,
                              EmployeeTypeService etService,
                              EmployeeService empService,
                              RequisitionService rfService,
                              DelegationService delService,
                              SupplierService supService,
                              SupplierProductService spService,
                              InventoryTransactionService itService)

        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            //app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            // Cookie authentication configuration
            app.UseCookiePolicy();
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseSession();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });

            db.Database.EnsureDeleted();
            db.Database.EnsureCreated();
            new DBSeeder(db, environment, pService, dService, pcService, dfService, srfService,
                         etService, empService, rfService, delService, supService, spService, itService);
        }
Beispiel #31
0
        public void Create_NonUniqueName_DomainValidationExceptionThrown()
        {
            var supplierRepositoryStub = MockRepository.GenerateStub <ISupplierRepository>();

            supplierRepositoryStub.Stub(x => x.GetByName("Gael Ltd")).Return(new Supplier {
                Name = "Gael Ltd"
            });
            _supplierService = SupplierServiceFactory.Create(supplierRepositoryStub);
            CreateSupplier(
                Guid.NewGuid(), "Gael Ltd", GetAddressDetails("Trading"), GetContactInfo("Trading"),
                GetAddressDetails("Sales"), GetContactInfo("Sales"));
            Assert.IsTrue(_domainValidationException.ResultContainsMessage(Messages.DuplicateName));
        }
Beispiel #32
0
 public supplierController()
 {
     this.supplierService = new SupplierService(ContextFactory.GetContext(System.Web.HttpContext.Current));
 }
Beispiel #33
0
    public void BindData()
    {
        //Bind product Type
        ProductTypeAdmin productTypeAdmin = new ProductTypeAdmin();

        ProductTypeList.DataSource = productTypeAdmin.GetAllProductTypes(ZNodeConfigManager.SiteConfig.PortalID);
        ProductTypeList.DataTextField = "name";
        ProductTypeList.DataValueField = "productTypeid";
        ProductTypeList.DataBind();

        //Bind Manufacturer
        ManufacturerAdmin ManufacturerAdmin = new ManufacturerAdmin();
        ManufacturerList.DataSource=ManufacturerAdmin.GetAllByPortalID(ZNodeConfigManager.SiteConfig.PortalID);
        ManufacturerList.DataTextField = "name";
        ManufacturerList.DataValueField = "manufacturerid";
        ManufacturerList.DataBind();
        ListItem li = new ListItem("No Manufacturer Selected", "0");
        ManufacturerList.Items.Insert(0,li);

        //Bind Supplier
        SupplierService serv = new SupplierService();
        TList<ZNode.Libraries.DataAccess.Entities.Supplier> list = serv.GetAll();
        list.Sort("DisplayOrder Asc");
        list.ApplyFilter(delegate(ZNode.Libraries.DataAccess.Entities.Supplier supplier)
        { return (supplier.ActiveInd == true); });

        DataSet ds = list.ToDataSet(false);
        DataView dv = new DataView(ds.Tables[0]);
        ddlSupplier.DataSource = dv;
        ddlSupplier.DataTextField = "name";
        ddlSupplier.DataValueField = "supplierid";
        ddlSupplier.DataBind();
        ListItem li1 = new ListItem("None", "0");
        ddlSupplier.Items.Insert(0, li1);

        //Bind Categories
        this.BindTreeViewCategory();

        // Bind Tax Class
        TaxRuleAdmin TaxRuleAdmin = new TaxRuleAdmin();
        ddlTaxClass.DataSource = TaxRuleAdmin.GetAllTaxClass();
        ddlTaxClass.DataTextField = "name";
        ddlTaxClass.DataValueField = "TaxClassID";
        ddlTaxClass.DataBind();
    }