Esempio n. 1
0
        private void Load_Data()
        {
            ProductTypeService productTypeService = new ProductTypeService();
            UnitTypeService    unitService        = new UnitTypeService();
            LanguageService    languageService    = new LanguageService();
            CurrencyService    currencyService    = new CurrencyService();
            CategoryService    categoryService    = new CategoryService();

            TypeBox.ItemsSource           = productTypeService.GetAll();
            TypeBox.SelectedValuePath     = "Id";
            TypeBox.DisplayMemberPath     = "Name";
            TypeBox.SelectedIndex         = 0;
            UnitBox.ItemsSource           = unitService.GetUnitTypesByLanguage(2);
            UnitBox.SelectedValuePath     = "Id";
            UnitBox.DisplayMemberPath     = "Name";
            LanguageBox.ItemsSource       = languageService.GetAll();
            LanguageBox.SelectedValuePath = "Id";
            LanguageBox.DisplayMemberPath = "Name";
            LanguageBox.SelectedIndex     = 0;
            CurrencyBox.ItemsSource       = currencyService.GetAll();
            CurrencyBox.SelectedValuePath = "Id";
            CurrencyBox.DisplayMemberPath = "Name";
            CurrencyBox.SelectedIndex     = 0;
            CategoryBox.ItemsSource       = categoryService.GetDefaultCategories(2);
            CategoryBox.SelectedValuePath = "Id";
            CategoryBox.DisplayMemberPath = "Name";
        }
        //
        // GET: /ProductType/
        public ActionResult Index()
        {
            var data = new ProductTypeIndexViewModel()
            {
                MainMenu         = _mainMenu,
                CurrentMenu      = PageInfo,
                IsNotViewer      = (CurrentUser.UserRole != Enums.UserRole.Viewer && !IsCreatorPRD(CurrentUser.USER_ID) && CurrentUser.UserRole != Enums.UserRole.Controller),
                ListProductTypes = Mapper.Map <List <ProductTypeFormViewModel> >(
                    _productTypeService.GetAll().OrderByDescending(item => item.PROD_CODE)),
                IsAdminApprover = _refService.IsAdminApprover(CurrentUser.USER_ID)
            };

            var list = new List <ProductTypeFormViewModel>(data.ListProductTypes);

            data.ListProductTypes = new List <ProductTypeFormViewModel>();

            var approvalStatusApproved  = _refService.GetReferenceByKey(ReferenceKeys.ApprovalStatus.Completed).REFF_ID;
            var approvalStatusSubmitted = _refService.GetReferenceByKey(ReferenceKeys.ApprovalStatus.AwaitingAdminApproval).REFF_ID;

            foreach (var item in list)
            {
                item.IsCreator   = CurrentUser.USER_ID == item.CreatedBy;
                item.IsApproved  = item.ApprovalStatus == approvalStatusApproved;
                item.IsSubmitted = item.ApprovalStatus == approvalStatusSubmitted;
                data.ListProductTypes.Add(item);
            }
            return(View("Index", data));
        }
Esempio n. 3
0
        public async Task <JsonResult> GetProductTypes()
        {
            var types = await _productTypeService.GetAll();

            var typeModels = _mapper.Map <List <ProductTypeModel> >(types);

            return(SucessResult(typeModels));
        }
Esempio n. 4
0
 private List <MutilCategoryItem> GetListMutilCategoryItem()
 {
     return(ProductTypeService.GetAll().Select
            (
                cate => new MutilCategoryItem
     {
         Name = cate.Name,
         Id = cate.ID,
         ParentId = cate.Parent
     }
            ).ToList());
 }
Esempio n. 5
0
        public ActionResult TakeProduct()
        {
            List <SelectListItem> ProductTypeList = new List <SelectListItem>();

            foreach (ProductType producttype in productTypeService.GetAll())
            {
                SelectListItem option = new SelectListItem();
                option.Text  = producttype.Name;
                option.Value = producttype.Id;
                ProductTypeList.Add(option);
            }
            ViewBag.ProductTypeList = ProductTypeList;
            return(View());
        }
Esempio n. 6
0
 public ActionResult TakeProduct()
 {
     if (Session["uname"] != null)
     {
         List <SelectListItem> ProductTypeList = new List <SelectListItem>();
         foreach (ProductType producttype in productTypeService.GetAll())
         {
             SelectListItem option = new SelectListItem();
             option.Text  = producttype.Name;
             option.Value = producttype.Id;
             ProductTypeList.Add(option);
         }
         ViewBag.ProductTypeList = ProductTypeList;
         return(View());
     }
     return(RedirectToAction("Index", "Home"));
 }
 public ActionResult<IEnumerable<ProductTypeDTO>> Get()
 {
     return Ok(mapper.Map<IEnumerable<ProductTypeDTO>>(service.GetAll()).ToList());
 }
 [Route("getProductTypes")] //api/customer/producttype/getProductTypes
 public async Task <IActionResult> getProductTypes()
 {
     return(Ok(await productTypeService.GetAll()));
 }