public SizeViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, INavigationManager navigation, SizeService sizeService, SizeType sizeType = null, IValidator validator = null) : base(uowBuilder, unitOfWorkFactory, navigation, validator) { SizeService = sizeService; Validations.Clear(); Validations.Add(new ValidationRequest(Entity, new ValidationContext(Entity, new Dictionary <object, object> { { nameof(IUnitOfWork), UoW } }))); if (UoW.IsNew) { Entity.SizeType = sizeType; IsNew = true; } else { if (Entity.Id <= SizeService.MaxStandartSizeId) { IsStandart = true; } } }
public void AddProductSizes() { var myProducts = ProductService.GetProducts(); var listProductsResponse = client.ListProducts(); foreach (var myProduct in myProducts) { var listProduct = listProductsResponse.Products.Where(x => x.BrandId == myProduct.Type.BrandID && x.ProductId == myProduct.Type.PrintAuraID).FirstOrDefault(); if (listProduct != null) { var listSizes = listProduct.Colors.Where(x => x.Key == myProduct.Color.PrintAuraID).FirstOrDefault(); foreach (int listSize in listSizes.Value) { Size size = SizeService.GetSize(listSize); if (size != null && !myProduct.Sizes.Any(x => x.SizeID == size.SizeID)) { SizeService.CreateProductSize(myProduct.ProductID, size.SizeID); } } } } }
public void SetUp() { var getSizeRepository = new Mock <ISizeRepository>(); getSizeRepository.Setup(x => x.GetAll()).Returns(new GetSizesResponse { Sizes = new List <SizeRecord> { new SizeRecord { Id = 1, Name = "Small" }, new SizeRecord { Id = 2, Name = "Medium" }, new SizeRecord { Id = 3, Name = "Large" } } }); var subject = new SizeService(getSizeRepository.Object); _result = subject.GetAll(); }
protected void lbDeleteSelected_Click(object sender, EventArgs e) { if ((_selectionFilter != null) && (_selectionFilter.Values != null)) { if (!_inverseSelection) { foreach (var id in _selectionFilter.Values) { int sizeId = SQLDataHelper.GetInt(id); if (!SizeService.IsSizeUsed(sizeId)) { SizeService.DeleteSize(sizeId); } } } else { var itemsIds = _paging.ItemsIds <int>("SizeID as ID"); foreach (var id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString()))) { if (!SizeService.IsSizeUsed(id)) { SizeService.DeleteSize(id); } } } } }
public ActionResult OnDelete(int id) { var result = SizeService.Delete(id); SetFlashMessage(result == Result.Ok ? "Xóa Kích cỡ thành công." : "Kích cỡ không tồn tại trên hệ thống."); return(RedirectToAction("Index")); }
private void simpleButton4_Click_1(object sender, EventArgs e) { DataTable dt = SizeService.StyleValue(this.chicun01.Text.Trim().ToString(), uc.kuanshiid, Frm定制下单修改尺寸.stylesizedt); ImpService.RefreshChiCun(this, dt); ImpService.CountChiCun(this); }
public ActionResult SimpleProduct(int id) { var products_service = new ProductsService(); //var discounts_service = new DiscountsService(); 目前沒折扣資料 先不抓 var size_service = new SizeService(); var stockcolor_service = new StockColorService(); //var image_service = new ImageService(); 沒照片 不抓 var list = new List <SizeStockCombineViewModel>(); foreach (var i in products_service.GetProductsTable()) { if (id == i.ProductID) { ViewBag.ProductName = i.ProductName; ViewBag.ProductID = i.ProductID; ViewBag.UnitPrice = i.UnitPrice; break; } } var size = size_service.GetSizeTable().Where(x => x.ProductID == id).ToList(); var stockcolor = stockcolor_service.GetStockColorsTable(id).ToList(); list.Add(new SizeStockCombineViewModel() { Size = size, StockColor = stockcolor }); return(View(list)); }
public async Task <ProductDto> QueryProduct(Guid id) { var product = await _service.QueryAsync(id); IColorService service = new ColorService(); ISizeService service2 = new SizeService(); var productDto = new ProductDto() { Id = product.Id, ProductName = product.ProductName, ProductCost = product.ProductCost, ProductPrice = product.ProductPrice, ProductDescription = product.ProductDescription, ProductImagePath = product.ProductImagePath, FirstProductCategoryId = product.FirstProductCategoryId, SecondProductCategoryId = product.SecondProductCategoryId, ThirdProductCategoryId = product.ThirdProductCategoryId, SizeId = product.SizeId, ColorId = product.ColorId, ProductNumber = product.ProductNumber, GS1Id = product.GS1Id }; var color = await service.QueryAsync(m => m.Id.Equals(productDto.ColorId)); var size = await service2.QueryAsync(m => m.Id.Equals(productDto.SizeId)); productDto.ColorName = color.ColorName; productDto.SizeName = size.SizeName; return(productDto); }
private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { List <尺寸呈现dto> lst = SizeService.getDto尺寸ByOrderId( this.gridView1.GetDataRow(e.RowHandle)["ORDER_ID"].ToString() , this.gridView1.GetDataRow(e.RowHandle)["STYLE_FIT_CD"].ToString() , this.gridView1.GetDataRow(e.RowHandle)["STYLE_CATEGORY_CD"].ToString() , this.gridView1.GetDataRow(e.RowHandle)["STYLE_SIZE_CD"].ToString() , this.gridView1.GetDataRow(e.RowHandle)["STYLE_SIZE_GROUP_CD"].ToString() , this.gridView1.GetDataRow(e.RowHandle)["CUSTOMER_ID"].ToString() ); // CUSTOMER_ID new Frm尺寸修改子页( this.gridView1.GetDataRow(e.RowHandle)["STYLE_ID"].ToString() , lst , this.gridView1.GetDataRow(e.RowHandle)["ORDER_ID"].ToString() , this.gridView1.GetDataRow(e.RowHandle)["REMARKS"].ToString() , this ).ShowDialog(); //new OrderQA( // this.gridView1.GetDataRow(e.RowHandle)["STYLE_ID"].ToString() // , lst // , this.gridView1.GetDataRow(e.RowHandle)["ORDER_ID"].ToString() // , this.gridView1.GetDataRow(e.RowHandle)["REMARKS"].ToString() // , this // ).ShowDialog(); }
public SizeTypeViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, INavigationManager navigation, SizeService sizeService, IValidator validator = null) : base(uowBuilder, unitOfWorkFactory, navigation, validator) { this.sizeService = sizeService; Validations.Clear(); Validations.Add(new ValidationRequest(Entity, new ValidationContext(Entity, new Dictionary <object, object> { { nameof(IUnitOfWork), UoW } }))); if (UoW.IsNew) { IsNew = true; Sizes = new GenericObservableList <Size>(); } else { Sizes = new GenericObservableList <Size>(sizeService.GetSize(UoW, Entity).ToList()); if (Entity.Id <= SizeService.MaxStandartSizeTypeId) { IsStandartType = true; } } }
public DataParserNorm( NormRepository normRepository, ProtectionToolsRepository protectionToolsRepository, SizeService sizeService) { AddColumnName(DataTypeNorm.ProtectionTools, "номенклатура" ); AddColumnName(DataTypeNorm.PeriodAndCount, "Норма выдачи" ); AddColumnName(DataTypeNorm.Subdivision, "Подразделение" ); AddColumnName(DataTypeNorm.Post, "Должность", "Должности", "профессия", "профессии" ); this.normRepository = normRepository ?? throw new ArgumentNullException(nameof(normRepository)); this.protectionToolsRepository = protectionToolsRepository ?? throw new ArgumentNullException(nameof(protectionToolsRepository)); this.sizeService = sizeService; }
public void CreationTest() { SizeService service = new SizeService(new FolderDetails { Path = _tempFolderPath }); Assert.NotNull(service); }
public ProductDetailsAdminView() { this.DbContext = new OnLineShopDbContext(); this.ps = new ProductService(this.DbContext); this.categories = new CategoryService(this.DbContext); this.sizes = new SizeService(this.DbContext); this.brands = new BrandService(this.DbContext); }
public SizeFilterViewModel( JournalViewModelBase journalViewModel, SizeService sizeService, IUnitOfWorkFactory unitOfWorkFactory = null ) : base(journalViewModel, unitOfWorkFactory) { SensitiveSizeType = true; SizeService = sizeService; }
/// <summary> /// s_style_p插入数据 /// </summary> /// <param name="change"></param> /// <param name="uc"></param> public static void insertS_Style_P(Frm定制下单修改尺寸 change, UC款式卡片 uc) { Frm定制下单修改尺寸.sTYLE_SIZE_CD = SizeService.SizeCD(change.chicun01.Text.Trim(), Frm定制下单修改尺寸.stylesizedt); //DataRow drstyle = SQLmtm.GetDataRow("SELECT MAX(SYS_STYLE_ID) SYS_STYLE_ID FROM `s_style_p`"); //Change.styleid = Convert.ToInt32(drstyle["SYS_STYLE_ID"]); //Change.styleid++; SQLmtm.DoInsert("s_style_p", new string[] { "SYS_STYLE_ID", "SHOP_ID", "STYLE_CD", "STYLE_KBN", "STYLE_CATEGORY_CD", "SYTLE_FABRIC_ID", "STYLE_SIZE_GROUP_CD", "STYLE_SIZE_CD", "STYLE_MAKE_TYPE", "ENABLE_FLAG", "DELETE_FLAG", "VERSION", "STYLE_NAME_CN", "REMARKS", "CUSTOMER_COUNT_ID", "STYLE_FIT_CD", "REF_STYLE_ID", "STYLE_DRESS_CATEGORY", "STYLE_DESIGN_TYPE", "STYLE_PUBLISH_CATEGORY_CD", "SYTLE_YEAR", "SYTLE_SEASON" }, new string[] { Frm定制下单修改尺寸.styleid.ToString(), "18", "", "STYLE_SOURCE-STYLE_SOURCE_50", uc.sTYLE_CATEGORY_CD, Frm面料选择.mianliaoid, uc.sTYLE_SIZE_GROUP_CD, Frm定制下单修改尺寸.sTYLE_SIZE_CD, "4SMA-4M", "1", "0", "1", uc.kuanshimingcheng, "", Frm客户.customer_countid.ToString(), uc.sTYLE_FIT_CD, uc.kuanshiid, uc.sTYLE_DRESS_CATEGORY, uc.sTYLE_DESIGN_TYPE, uc.sTYLE_PUBLISH_CATEGORY_CD, uc.sYTLE_YEAR, uc.sYTLE_SEASON }); }
public IncomeDocDlg(int id) { Build(); AutofacScope = MainClass.AppDIContainer.BeginLifetimeScope(); UoWGeneric = UnitOfWorkFactory.CreateForRoot <Income> (id); featuresService = AutofacScope.Resolve <FeaturesService>(); sizeService = AutofacScope.Resolve <SizeService>(); ConfigureDlg(); }
public ActionResult Edit(int id) { var size = SizeService.Find(id); if (size == null) { return(RedirectToAction("Index")); } return(View("Edit", size.CloneTo <SizeModels>())); }
/// <summary> /// 加载下拉框 /// </summary> //public void LoudCombobox() //{ // DataTable dt = TaskService.Get生产模板(); // foreach(DataRow dr in dt.Rows) // { // this.template_choose.Add(dr["ITEM_NAME_CN"].ToString(), dr["ITEM_VALUE"].ToString()); // ((DevExpress.XtraEditors.Repository.RepositoryItemComboBox)barEditItem任务.Edit).Items.Add(dr["ITEM_NAME_CN"].ToString()); // } //} //private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) //{ // if (this.barEditItem任务.EditValue == null) // { // return; // } // this.TaskDTO = new TaskDTO().buildNewDTO(this.template_choose[this.barEditItem任务.EditValue.ToString()], this.ORDER_ID, this.Style_Id, "1"); // switch (this.TaskDTO.template_id) // { // case "4": // this.uc裁剪条码打印 = new UC裁剪条码打印(); // this.uc裁剪条码打印.Dock = DockStyle.Fill; // this.panel任务.Controls.Clear(); // this.panel任务.Controls.Add(this.uc裁剪条码打印); // this.panel任务.Refresh(); // break; // } //} private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { this.dtos = SizeService.getDto尺寸WithOrderId(this.ORDER_ID); new Frm订单预览( this.gridView1.GetRowCellValue(e.RowHandle, "STYLE_ID").ToString() , dtos , this.gridView1.GetRowCellValue(e.RowHandle, "ORDER_ID").ToString() , "" , this.gridView1.GetRowCellValue(e.RowHandle, "ID").ToString(), Enum任务类别.生产任务).HideTabcontrol().ShowDialog(); }
private List <SelectListItem> BuildListSize(string[] listSizeSelected = null) { return(SizeService.GetAll().AsEnumerable() .Select(c => new SelectListItem { Value = c.Name, Text = c.Description, Selected = (listSizeSelected != null && listSizeSelected.Length > 0 && listSizeSelected.Contains(c.Name)) }).ToList()); }
public NomenclatureTypes(IUnitOfWork uow, SizeService sizeService, bool tryLoad = false) { this.uow = uow ?? throw new ArgumentNullException(nameof(uow)); this.sizeService = sizeService ?? throw new ArgumentNullException(nameof(sizeService)); if (tryLoad) { ItemsTypes = uow.GetAll <ItemsType>().ToList(); } makeTypes(uow); }
public IssueByIdentifierViewModel( IUnitOfWorkFactory unitOfWorkFactory, INavigationManager navigation, IGuiDispatcher guiDispatcher, IUserService userService, ILifetimeScope autofacScope, StockRepository stockRepository, EmployeeRepository employeeRepository, FeaturesService featuresService, IValidator validator, BaseParameters baseParameters, IInteractiveQuestion interactive, IChangeableConfiguration configuration, SizeService sizeService, ICardReaderService cardReaderService = null) : base(navigation) { this.unitOfWorkFactory = unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory)); this.guiDispatcher = guiDispatcher ?? throw new ArgumentNullException(nameof(guiDispatcher)); this.userService = userService ?? throw new ArgumentNullException(nameof(userService)); this.autofacScope = autofacScope ?? throw new ArgumentNullException(nameof(autofacScope)); this.employeeRepository = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository)); this.validator = validator ?? throw new ArgumentNullException(nameof(validator)); this.BaseParameters = baseParameters ?? throw new ArgumentNullException(nameof(baseParameters)); this.interactive = interactive ?? throw new ArgumentNullException(nameof(interactive)); this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); SizeService = sizeService ?? throw new ArgumentNullException(nameof(sizeService)); this.cardReaderService = cardReaderService; IsModal = false; EnableMinimizeMaximize = true; Title = "Выдача по картам СКУД"; UowOfDialog = unitOfWorkFactory.CreateWithoutRoot(); var entryBuilder = new CommonEEVMBuilderFactory <IssueByIdentifierViewModel>(this, this, UowOfDialog, navigation, autofacScope); if (cardReaderService != null) { cardReaderService.RefreshDevices(); cardReaderService.СardStatusRead += RusGuardService_СardStatusRead; cardReaderService.CardFamilies.ListChanged += CardFamilies_ListChanged; } UpdateState(); WarehouseEntryViewModel = entryBuilder.ForProperty(x => x.Warehouse).MakeByType().Finish(); Warehouse = stockRepository.GetDefaultWarehouse(UowOfDialog, featuresService, autofacScope.Resolve <IUserService>().CurrentUserId); //Настройка таймера сброса timerCleanSuccessfullyText = new Timer(40000); timerCleanSuccessfullyText.AutoReset = false; timerCleanSuccessfullyText.Elapsed += delegate(object sender, ElapsedEventArgs e) { guiDispatcher.RunInGuiTread(() => SuccessfullyText = null); }; ReadConfig(); }
public ItemTypeViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, INavigationManager navigation, FeaturesService featuresService, SizeService sizeService, IValidator validator = null) : base(uowBuilder, unitOfWorkFactory, navigation, validator) { this.featuresService = featuresService ?? throw new ArgumentNullException(nameof(featuresService)); SizeService = sizeService; }
public void ReturnNull_WhenIdParameterIsNull() { // Arrange var contextMock = new Mock <IOnLineShopDbContext>(); SizeService sizeService = new SizeService(contextMock.Object); // Act Size sizeResult = sizeService.GetById(null); // Assert Assert.IsNull(sizeResult); }
private void chicun01_SelectedIndexChanged(object sender, EventArgs e) { try { this.chooseStyleSize = SizeService.StyleValue(this.chicun01.Text.Trim().ToString(), styleCard.kuanshiid, Frm定制下单修改尺寸.stylesizedt); this.gridControl1.DataSource = this.chooseStyleSize; Frm定制下单修改尺寸.sTYLE_SIZE_CD = this.chooseStyleSize.Rows[0]["SIZE_CD"].ToString(); } catch { } }
public CompletionViewModel(IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, INavigationManager navigation, IUserService userService, StockRepository stockRepository, FeaturesService featuresService, ILifetimeScope autofacScope, BaseParameters baseParameters, IInteractiveQuestion interactive, SizeService sizeService, IValidator validator = null) : base(uowBuilder, unitOfWorkFactory, navigation, validator) { var entryBuilder = new CommonEEVMBuilderFactory <Completion>(this, Entity, UoW, navigation, autofacScope); this.interactive = interactive; this.featuresService = featuresService; SizeService = sizeService; if (UoW.IsNew) { Entity.CreatedbyUser = userService.GetCurrentUser(UoW); } if (Entity.SourceWarehouse == null) { Entity.SourceWarehouse = stockRepository.GetDefaultWarehouse (UoW, featuresService, autofacScope.Resolve <IUserService>().CurrentUserId); } WarehouseExpenseEntryViewModel = entryBuilder.ForProperty(x => x.SourceWarehouse) .UseViewModelJournalAndAutocompleter <WarehouseJournalViewModel>() .UseViewModelDialog <WarehouseViewModel>() .Finish(); if (Entity.ResultWarehouse == null) { Entity.ResultWarehouse = stockRepository.GetDefaultWarehouse (UoW, featuresService, autofacScope.Resolve <IUserService>().CurrentUserId); } WarehouseReceiptEntryViewModel = entryBuilder.ForProperty(x => x.ResultWarehouse) .UseViewModelJournalAndAutocompleter <WarehouseJournalViewModel>() .UseViewModelDialog <WarehouseViewModel>() .Finish(); Validations.Clear(); Validations.Add(new ValidationRequest(Entity, new ValidationContext(Entity, new Dictionary <object, object> { { nameof(BaseParameters), baseParameters }, { nameof(IUnitOfWork), UoW } }))); Entity.PropertyChanged += Entity_PropertyChanged; lastWarehouse = Entity.SourceWarehouse; }
public async Task FileSizePrintAccuracyTest() { _printedData = string.Empty; MakeTempFile(); SizeService service = new SizeService(new FolderDetails { Path = _tempFolderPath }); await service.FileSizePrint(printToString, _tempFilePath); FileInfo file = new FileInfo(_tempFilePath); Assert.Equal(file.Length.ToString(), _printedData.Trim()); }
private void chicun01_SelectedIndexChanged(object sender, EventArgs e) { this.model.build选中尺寸(this.chicun01.Text.Trim(), this.model.Dto定制下单.Style_Id, Frm定制下单修改尺寸.stylesizedt); this.model.Dto定制下单.STYLE_SIZE_CD = SizeService.SizeCD(this.chicun01.Text.Trim(), Frm定制下单修改尺寸.stylesizedt); ImpService.RefreshChiCun(this, this.model.中尺寸); ImpService.CountChiCun(this); this.model.尺寸呈现 = SizeService.GetThisSize(this.model.Dto定制下单); foreach (尺寸呈现dto dto in this.model.尺寸呈现) { dto.CountSize(); } this.gridControlSize.DataSource = this.model.尺寸呈现; }
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteSize") { int sizeId = SQLDataHelper.GetInt(e.CommandArgument); if (!SizeService.IsSizeUsed(sizeId)) { SizeService.DeleteSize(sizeId); } else { MsgError(string.Format(Resource.Admin_SizesDictionary_CantDelete, sizeId)); } } if (e.CommandName == "AddSize") { try { GridViewRow footer = grid.FooterRow; int temp; int.TryParse(((TextBox)footer.FindControl("txtNewSortOrder")).Text, out temp); if (string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewName")).Text)) { grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ffcccc"); return; } if (SizeService.AddSize(new Size { SizeName = ((TextBox)footer.FindControl("txtNewName")).Text.Trim(), SortOrder = temp }) != 0) { grid.ShowFooter = false; } } catch (Exception ex) { Debug.LogError(ex); } } if (e.CommandName == "CancelAdd") { grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ccffcc"); grid.ShowFooter = false; } }
protected void Page_PreRender(object sender, EventArgs e) { List <Size> sizes = SizeService.GetSizesByCategoryID(CategoryId, InDepth).Where(s => AvalibleSizesIDs == null || AvalibleSizesIDs.Any(s2 => s2 == s.SizeId)).ToList(); if (sizes.Any()) { lvSizes.DataSource = sizes; lvSizes.DataBind(); } else { this.Visible = false; } }
private void simpleButton订单预览_Click(object sender, EventArgs e) { if (!OrderService.VerifyOrder(this.ORDER_ID)) { MessageBox.Show("无此订单"); return; } this.dtos = SizeService.getDto尺寸WithOrderId(this.ORDER_ID); new Frm订单预览( OrderService.GetStyleidWithOrderid(this.ORDER_ID) , dtos , this.ORDER_ID , "").ShowDialog(); }