Пример #1
0
 private void prepareEditModel(EditTaskViewModel model)
 {
     model.BusinessUnitList = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.BusinessUnit);
     model.TaskTypeList     = LookupService.FindLOVItemsListItemModel(null, LOVName.TaskType);
     model.StatusList       = LookupService.FindLOVItemsListItemModel(null, LOVName.TaskStatus);
     model.UserList         = MembershipManagementService.FindUserListItemModel();
 }
        void prepareEditModel(EditPurchaseOrderHeaderTempViewModel model, int id)
        {
            var poht = PurchasingService.FindPurchaseOrderHeaderTempModel(id, CurrentCompany, false);

            PrepareViewModel(model, EvolutionResources.bnrAddEditPurchase + " - " + EvolutionResources.lblOrderNumber + ": " + model.PurchaseTemp.OrderNumber.ToString(), id, MakeMenuOptionFlags(0, poht.OriginalRowId, 0) + MenuOptionFlag.RequiresNewPurchase);
            model.ParentId = id;

            // Get the landing date from the Shipment record
            if (model.PurchaseTemp.OrderNumber != null)
            {
                var shipmentContent = ShipmentService.FindShipmentContentByPONoModel(CurrentCompany, model.PurchaseTemp.OrderNumber.Value);
                if (shipmentContent != null && shipmentContent.ShipmentId != null)
                {
                    var shipment = ShipmentService.FindShipmentModel(shipmentContent.ShipmentId.Value, CurrentCompany);
                }
            }

            model.LocationList         = LookupService.FindLocationListItemModel(model.CurrentCompany);
            model.SupplierList         = SupplierService.FindSupplierListItemModel(CurrentCompany);
            model.POStatusList         = LookupService.FindPurchaseOrderHeaderStatusListItemModel();
            model.UserList             = MembershipManagementService.FindUserListItemModel();
            model.PaymentTermsList     = LookupService.FindPaymentTermsListItemModel(model.CurrentCompany);
            model.CommercialTermsList  = LookupService.FindLOVItemsListItemModel(model.CurrentCompany, LOVName.CommercialTerms);
            model.PortList             = LookupService.FindPortsListItemModel();
            model.ShipMethodList       = LookupService.FindLOVItemsListItemModel(model.CurrentCompany, LOVName.ShippingMethod);
            model.ContainerTypeList    = LookupService.FindContainerTypeListItemModel();
            model.FreightForwarderList = LookupService.FindFreightForwardersListItemModel(model.CurrentCompany);
            model.CurrencyList         = LookupService.FindCurrenciesListItemModel();
            model.BrandCategoryList    = ProductService.FindBrandCategoryListItemModel(model.CurrentCompany);
        }
Пример #3
0
        public ActionResult GetUserList()
        {
            var items = MembershipManagementService.FindUserListItemModel();

            items.Insert(0, new ListItemModel(EvolutionResources.strAll, "0"));
            return(Json(items, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
        void prepareEditModel(EditSalesOrderHeaderTempViewModel model, int id)
        {
            var soht = SalesService.FindSalesOrderHeaderTempModel(id, CurrentCompany, false);

            PrepareViewModel(model, EvolutionResources.bnrAddEditSale + " - " + EvolutionResources.lblOrderNumber + ": " + model.SaleTemp.OrderNumber.ToString(), id, MakeMenuOptionFlags(0, 0, 0, soht.OriginalRowId) + MenuOptionFlag.RequiresNewSale);
            model.ParentId = id;

            model.LocationList         = LookupService.FindLocationListItemModel(model.CurrentCompany);
            model.ShippingTemplateList = LookupService.FindDocumentTemplatesListItemModel(DocumentTemplateCategory.Invoice);
            model.CountryList          = LookupService.FindCountriesListItemModel();
            model.OrderTypeList        = LookupService.FindLOVItemsListItemModel(model.CurrentCompany, LOVName.OrderType);
            model.BrandCategoryList    = ProductService.FindBrandCategoryListItemModel(model.CurrentCompany);
            model.SOStatusList         = LookupService.FindSalesOrderHeaderStatusListItemModel();
            model.UserList             = MembershipManagementService.FindUserListItemModel();
            model.PaymentTermsList     = LookupService.FindPaymentTermsListItemModel(model.CurrentCompany);
            if (model.SaleTemp.CustomerId != null)
            {
                model.CreditCardList = CustomerService.FindCreditCardsListItemModel(model.CurrentCompany, model.SaleTemp.CustomerId.Value);
            }

            model.FreightCarrierList = LookupService.FindFreightCarriersListItemModel(model.CurrentCompany);
            model.FreightTermList    = LookupService.FindLOVItemsListItemModel(model.CurrentCompany, LOVName.FreightTerm);

            model.MethodSignedList = LookupService.FindMethodSignedListItemModel();
        }
Пример #5
0
        void prepareEditModel(EditProductViewModel model, int id)
        {
            PrepareViewModel(model, EvolutionResources.bnrAddEditProduct + (model.Product.Id > 0 ? " - " + model.Product.ItemName : ""), id, MakeMenuOptionFlags(0, 0, 0, 0, model.Product.Id) + MenuOptionFlag.RequiresNewProduct);

            model.ProductAvailabilityList = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.ProductAvailability);
            model.MaterialList            = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.Material);
            model.ABList            = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.AB);
            model.UserList          = MembershipManagementService.FindUserListItemModel();
            model.ProductStatusList = new List <ListItemModel>();
            foreach (var item in LookupService.FindLOVItemsModel(null, LOVName.ProductStatus))
            {
                model.ProductStatusList.Add(new ListItemModel {
                    Id = item.ItemValue1, Text = item.ItemText
                });
            }
            model.WebCategoryList    = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.WebCategory);
            model.WebSubCategoryList = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.WebSubCategory);

            model.MediaPath = MediaServices.GetProductImageFolder(true);

            var bc = new Evolution.BarCodeService.BarCodeService(db);

            model.Product.BarCodeFile1 = bc.GetBarCode(model.Product.BarCode, true);
            model.Product.BarCodeFile2 = bc.GetBarCode(model.Product.InnerBarCode, true);
            model.Product.BarCodeFile3 = bc.GetBarCode(model.Product.MasterBarCode, true);
        }
        void prepareEditModel(EditCustomerDefaultViewModel model)
        {
            PrepareViewModel(model, EvolutionResources.bnrAddEditCustomerDefaults);

            model.CountryList = LookupService.FindCountriesListItemModel();
            model.CountryList.Insert(0, new ListItemModel(EvolutionResources.lblNone, "0"));

            model.CurrencyList = LookupService.FindCurrenciesListItemModel();

            model.CustomerTypeList = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.CustomerType);
            model.CustomerTypeList.Insert(0, new ListItemModel(EvolutionResources.lblNone, "0"));

            model.SalesPersonList = MembershipManagementService.FindUserListItemModel();
            model.SalesPersonList.Insert(0, new ListItemModel(EvolutionResources.lblNone, "0"));

            model.PaymentTermsList = LookupService.FindPaymentTermsListItemModel(CurrentCompany);

            model.TaxCodeList = LookupService.FindTaxCodesListItemModel(CurrentCompany);
            model.TaxCodeList.Insert(0, new ListItemModel(EvolutionResources.lblNone, "0"));

            model.FreightCarrierList = LookupService.FindFreightCarriersListItemModel(model.CurrentCompany);

            model.InvoiceTemplateList  = new JavaScriptSerializer().Serialize(LookupService.FindDocumentTemplatesListItemModel(DocumentTemplateCategory.Invoice));
            model.PacklistTemplateList = new JavaScriptSerializer().Serialize(LookupService.FindDocumentTemplatesListItemModel(DocumentTemplateCategory.Pickslip));

            model.PriceLevelsList = LookupService.FindPriceLevelsListItemModel(CurrentCompany);
            model.PriceLevelsList.Insert(0, new ListItemModel(EvolutionResources.lblNone, "0"));
        }
        void prepareEditModel(EditBrandCategorySalesPersonViewModel model, int id, int customerId)
        {
            var customer = CustomerService.FindCustomerModel(customerId, CurrentCompany);

            string title = EvolutionResources.bnrAddEditCustomerAccountManager + (customer == null ? "" : " - " + customer.Name);

            if (id <= 0)
            {
                title += " - " + EvolutionResources.lblNewAddress;
            }

            PrepareViewModel(model, title, customerId, MakeMenuOptionFlags(customerId, 0));

            model.BrandCategoryList   = ProductService.FindBrandCategoryListItemModel(model.CurrentCompany);
            model.SalesPersonList     = MembershipManagementService.FindUserListItemModel();
            model.SalesPersonTypeList = LookupService.FindLOVItemsListItemModel(null, LOVName.SalesPersonType);
            model.ParentId            = customerId;
        }
        public void FindUserListItemModelTest()
        {
            // Warning: This test can fail if another test is creating users at the same time
            //          This occurs because users are global and not specific to an organisation,
            //          otherwise we segment users off into a separate test organisation.
            var user        = GetTestUser();
            var testCompany = GetTestCompany(user);
            var model       = MembershipManagementService.FindUserListItemModel();
            var dbData      = db.FindUsers();

            int expected = dbData.Count(),
                actual   = model.Count();

            Assert.IsTrue(actual == expected, $"Error: {actual} items were found when {expected} were expected");

            // Check that all the items match
            foreach (var item in model)
            {
                var dbItem = dbData.Where(m => m.Id.ToString() == item.Id).FirstOrDefault();
                Assert.IsTrue(dbItem != null, "Error: Model item not found in db item list");

                var test = MembershipManagementService.MapToModel(dbItem);
                AreEqual(item, test);
            }

            // Add another item a make sure it is found
            var newItem = GetTestUser(true, false);
            var error   = MembershipManagementService.InsertOrUpdateUser(newItem, user, "");

            Assert.IsTrue(!error.IsError, $"Error: {error.Message}");

            model = MembershipManagementService.FindUserListItemModel();
            var testItem = model.Where(i => i.Id.ToString() == newItem.Id.ToString()).FirstOrDefault();

            Assert.IsTrue(testItem != null, "Error: A NULL value was returned when a non-NULL value was expected");

            // Delete it and make sure it disappears
            MembershipManagementService.DeleteUser(newItem.Id);

            model    = MembershipManagementService.FindUserListItemModel();
            testItem = model.Where(i => i.Id == newItem.Id.ToString()).FirstOrDefault();
            Assert.IsTrue(testItem == null, "Error: A non-NULL value was returned when a NULL value was expected");
        }
Пример #9
0
        void prepareEditModel(EditCompanyViewModel model)
        {
            PrepareViewModel(model, EvolutionResources.bnrAddEditCompany);
            model.LogoList = MediaServices.FindCompanyLogos();

            model.WarehouseTemplateList        = LookupService.FindDocumentTemplatesListItemModel(DocumentTemplateCategory.PurchaseOrder, DocumentTemplateType.SendPOtoWarehouse);
            model.SupplierTemplateList         = LookupService.FindDocumentTemplatesListItemModel(DocumentTemplateCategory.PurchaseOrder, DocumentTemplateType.SendPOtoSupplier);
            model.FreightForwarderTemplateList = LookupService.FindDocumentTemplatesListItemModel(DocumentTemplateCategory.PurchaseOrder, DocumentTemplateType.SendPOtoFreightForwarder);

            model.LocationList   = LookupService.FindLocationListItemModel(model.Company);
            model.CountryList    = LookupService.FindCountriesListItemModel();
            model.CurrencyList   = LookupService.FindCurrenciesListItemModel();
            model.DateFormatList = LookupService.FindDateFormatListItemModel();

            model.UnitOfMeasureList = new List <ListItemModel>();
            model.UnitOfMeasureList.Add(new ListItemModel(EvolutionResources.lblMetric, ((int)UnitOfMeasure.Metric).ToString()));
            model.UnitOfMeasureList.Add(new ListItemModel(EvolutionResources.lblImperial, ((int)UnitOfMeasure.Imperial).ToString()));

            model.UserList = MembershipManagementService.FindUserListItemModel();
        }