示例#1
0
        public async Task <ActionResult> AddNewPaintCategory(PaintViewModel paintViewModel)
        {
            var isSuccess = await _paintService.AddNewPaintCategoryAsync(paintViewModel);

            return(isSuccess ? Json(new { status = TransactionStatusEnum.success.ToString(), title = "Success", message = "Paint Category has been saved successfully" }, JsonRequestBehavior.AllowGet)
                : Json(new { status = TransactionStatusEnum.error.ToString(), title = "Failed", message = "This Paint Category is already available" }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public async Task <bool> AddNewsubCategoryAsync(PaintViewModel paintViewModel)
        {
            using (var context = CreateContext())
            {
                var result = await context.PaintSubCategory.AnyAsync(f => f.Value.ToLower() == paintViewModel.Value.ToLower() && f.PaintCategoryId == paintViewModel.PaintCategoryId && f.Status == (int)RecordStatusEnum.Active);

                if (!result)
                {
                    var newSubCategory = new PaintSubCategory
                    {
                        Value           = paintViewModel.Value,
                        Description     = paintViewModel.Description,
                        PaintCategoryId = paintViewModel.PaintCategoryId,
                        Status          = (int)RecordStatusEnum.Active
                    };
                    context.PaintSubCategory.Add(newSubCategory);
                    await context.SaveChangesAsync();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
示例#3
0
 public async Task UpdatePaintAsync(PaintViewModel paintViewModel)
 {
     using (var context = CreateContext())
     {
         var result = context.PaintMaster.FirstOrDefault(f => f.PaintMasterId == paintViewModel.PaintMasterId && f.Status == (int)RecordStatusEnum.Active);
         result.Quantity = paintViewModel.AvailableQuantity;
         result.Price    = paintViewModel.Price;
         await context.SaveChangesAsync();
     }
 }
示例#4
0
        public ActionResult AddPaint()
        {
            var paintViewModel = new PaintViewModel
            {
                Volumes             = new SelectList(_lookUpServices.GetLookUp(LookUpTypeEnum.PaintVolume), "LookUpId", "Value"),
                PaintCatergoryList  = new SelectList(_lookUpServices.GetLookUp(LookUpTypeEnum.PaintCategory), "LookUpId", "Value"),
                PaintSubategoryList = new SelectList(new List <LookUpBO>(), "LookUpId", "Value")
            };

            return(View(paintViewModel));
        }
示例#5
0
        public ActionResult Index()
        {
            var result         = _lookUpServices.GetLookUp(LookUpTypeEnum.PaintCategory);
            var paintViewModel = new PaintViewModel
            {
                PaintCatergoryList  = new SelectList(result, "LookUpId", "Value"),
                PaintSubategoryList = new SelectList(new List <LookUpBO>(), "LookUpId", "Value")
            };

            return(View(paintViewModel));
        }
示例#6
0
    public App()
    {
        var broadcastFactory      = new ChainerFactory(16384);
        var networkServiceFactory = new NetworkServiceFactory();

        _watcher          = networkServiceFactory.CreateWatcher();
        _broadcastService = new BroadcastService(broadcastFactory, _watcher, networkServiceFactory.CreateUtility());
        InitializeBroadcastService(networkServiceFactory, _broadcastService);
        var frameworkDialogFactory = new DefaultFrameworkDialogFactory();
        var dialogService          = new DefaultDialogService(frameworkDialogFactory);
        var fileService            = new DefaultFileService(new [] { ".lpsnp" });

        _paintDataContext = new PaintViewModel(_broadcastService, dialogService, fileService, networkServiceFactory);
    }
示例#7
0
        public async Task <ActionResult> EditPaint(PaintViewModel paintViewModel)
        {
            await _paintService.UpdatePaintAsync(paintViewModel);

            return(Json(new { status = TransactionStatusEnum.success.ToString(), title = "Success", message = "Paint details have been updated successfully" }, JsonRequestBehavior.AllowGet));
        }