void ConfigureDlg() { yEntryName.Binding.AddBinding(Entity, s => s.Name, w => w.Text).InitializeFromSource(); yEnumCmbType.ItemsEnum = typeof(CertificateType); yEnumCmbType.Binding.AddBinding(Entity, s => s.TypeOfCertificate, w => w.SelectedItemOrNull).InitializeFromSource(); yEnumCmbType.EnumItemSelected += YEnumCmbType_EnumItemSelected; photoViewCertificate.Binding.AddBinding(Entity, e => e.ImageFile, w => w.ImageFile).InitializeFromSource(); photoViewCertificate.GetSaveFileName = () => Entity.Name; photoViewCertificate.CanPrint = true; yStartDate.Binding.AddBinding(Entity, s => s.StartDate, w => w.DateOrNull).InitializeFromSource(); yDateOfExpiration.Binding.AddBinding(Entity, s => s.ExpirationDate, w => w.DateOrNull).InitializeFromSource(); yChkIsArchive.Binding.AddBinding(Entity, s => s.IsArchive, w => w.Active).InitializeFromSource(); YEnumCmbType_EnumItemSelected(this, new Gamma.Widgets.ItemSelectedEventArgs(yEnumCmbType.SelectedItem)); ObservableList = Entity.ObservableNomenclatures; yTreeNomenclatures.Selection.Changed += (sender, e) => { selectedNomenclature = yTreeNomenclatures.GetSelectedObject <Nomenclature>(); SetControlsAcessibility(); }; yTreeNomenclatures.ColumnsConfig = new FluentColumnsConfig <Nomenclature>() .AddColumn("Имя") .AddTextRenderer(n => n.Name) .AddColumn("Код") .AddTextRenderer(n => n.Id.ToString()) .Finish(); yTreeNomenclatures.ItemsDataSource = ObservableList; }
/// <summary> /// Возврат словаря сертификатов для передаваемых номенклатур /// </summary> /// <returns>Словарь сертификатов</returns> /// <param name="uow">IUnitOfWork</param> /// <param name="nomenclatures">Список номенклатур</param> public Dictionary <Nomenclature, IList <Certificate> > GetDictionaryWithCertificatesForNomenclatures(IUnitOfWork uow, Nomenclature[] nomenclatures) { Dictionary <Nomenclature, IList <Certificate> > dict = new Dictionary <Nomenclature, IList <Certificate> >(); foreach (var n in nomenclatures) { Nomenclature nomenclatureAlias = null; var certificates = uow.Session.QueryOver <Certificate>() .Left.JoinAlias(c => c.Nomenclatures, () => nomenclatureAlias) .Where(() => nomenclatureAlias.Id == n.Id) .List() ; if (certificates.Any()) { if (!dict.ContainsKey(n)) { dict.Add(n, certificates); } else { foreach (Certificate certificate in certificates) { dict[n].Add(certificate); } } } } return(dict); }
protected void OnBtnAddNomenclatureClicked(object sender, System.EventArgs e) { var nomenclatureFilter = new NomenclatureRepFilter(UoWGeneric); nomenclatureFilter.SetAndRefilterAtOnce( x => x.AvailableCategories = Nomenclature.GetCategoriesForSaleToOrder(), x => x.DefaultSelectedCategory = NomenclatureCategory.water, x => x.DefaultSelectedSaleCategory = SaleCategory.forSale ); PermissionControlledRepresentationJournal SelectDialog = new PermissionControlledRepresentationJournal(new NomenclatureForSaleVM(nomenclatureFilter)) { Mode = JournalSelectMode.Multiple, ShowFilter = true }; SelectDialog.CustomTabName("Номенклатура на продажу"); SelectDialog.ObjectSelected += (s, ea) => { var selectedNodes = ea.GetNodes <NomenclatureForSaleVMNode>(); if (!selectedNodes.Any()) { return; } foreach (var node in selectedNodes) { Nomenclature n = UoWGeneric.GetById <Nomenclature>(node.Id); if (n != null && !Entity.ObservableNomenclatures.Any(x => x == n)) { Entity.ObservableNomenclatures.Add(n); } } }; TabParent.AddSlaveTab(this, SelectDialog); }
private Order CreateTestOrderWithOrderItems() { Order testOrder = new Order(); testOrder.OrderItems = new List <OrderItem>(); Nomenclature forfeitNomenclature = Substitute.For <Nomenclature>(); forfeitNomenclature.Category.Returns(x => NomenclatureCategory.service); OrderItem forfeitOrderItem = new OrderItem { Nomenclature = forfeitNomenclature, ActualCount = 2, Price = 1000 }; testOrder.OrderItems.Add(forfeitOrderItem); Nomenclature waterNomenclature = Substitute.For <Nomenclature>(); waterNomenclature.Category.Returns(x => NomenclatureCategory.bottle); OrderItem waterOrderItem = new OrderItem { Nomenclature = waterNomenclature, ActualCount = 10, Price = 50 }; testOrder.OrderItems.Add(waterOrderItem); return(testOrder); }
public IActionResult Create(Nomenclature nomenclature) { nomenclature.Id = Guid.NewGuid(); dbContext.Nomenclatures.Add(nomenclature); dbContext.SaveChanges(); return(RedirectToAction("Edit", new { id = nomenclature.Id })); }
public IList <GoodsInRouteListResult> GetGoodsInRLWithoutEquipments(IUnitOfWork uow, RouteList routeList) { GoodsInRouteListResult resultAlias = null; Vodovoz.Domain.Orders.Order orderAlias = null; OrderItem orderItemsAlias = null; Nomenclature OrderItemNomenclatureAlias = null; var ordersQuery = QueryOver.Of(() => orderAlias); var routeListItemsSubQuery = QueryOver.Of <RouteListItem>() .Where(r => r.RouteList.Id == routeList.Id) .Where(r => !r.WasTransfered || (r.WasTransfered && r.NeedToReload)) .Select(r => r.Order.Id); ordersQuery.WithSubquery.WhereProperty(o => o.Id).In(routeListItemsSubQuery).Select(o => o.Id); var orderitemsQuery = uow.Session.QueryOver <OrderItem>(() => orderItemsAlias) .WithSubquery.WhereProperty(i => i.Order.Id).In(ordersQuery) .JoinAlias(() => orderItemsAlias.Nomenclature, () => OrderItemNomenclatureAlias) .Where(() => OrderItemNomenclatureAlias.Category.IsIn(Nomenclature.GetCategoriesForShipment())); return(orderitemsQuery.SelectList(list => list .SelectGroup(() => OrderItemNomenclatureAlias.Id).WithAlias(() => resultAlias.NomenclatureId) .SelectSum(() => orderItemsAlias.Count).WithAlias(() => resultAlias.Amount)) .TransformUsing(Transformers.AliasToBean <GoodsInRouteListResult>()) .List <GoodsInRouteListResult>()); }
public LoadFrom1cClientsAndDeliveryPoints() { if (!ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("database_maintenance")) { MessageDialogHelper.RunWarningDialog("Доступ запрещён!", "У вас недостаточно прав для доступа к этой вкладке. Обратитесь к своему руководителю.", Gtk.ButtonsType.Ok); FailInitialize = true; return; } throw new ApplicationException("Сюда сейчас нельзя."); //Counterparty.VodInternalId генерируется тригером на стороне БД. Исправить соответствующий код ниже. this.Build(); TabName = "Загрузка из 1с"; FileFilter Filter = new FileFilter(); Filter.Name = "XML выгрузка"; Filter.AddMimeType("application/xml"); Filter.AddPattern("*.xml"); filechooser.Filter = Filter; nomStroika = UoW.GetById <Nomenclature>(15); nomRuchki = UoW.GetById <Nomenclature>(7); errorLog.Add(string.Format("Статус;Код1с контрагента;Код1с точки доставки;Причина")); }
public bool TryGetFixedPrice(DeliveryPoint deliveryPoint, Nomenclature nomenclature, out decimal fixedPrice) { var nomenclatureFixedPrice = deliveryPoint.ObservableNomenclatureFixedPrices .SingleOrDefault(x => x.Nomenclature.Id == nomenclature.Id); return(CheckFixedPrice(out fixedPrice, nomenclatureFixedPrice)); }
public int GetBottlesOrderedForPeriod(IUnitOfWork uow, DeliveryPoint deliveryPoint, DateTime start, DateTime end) { Order orderAlias = null; OrderItem orderItemAlias = null; Nomenclature nomenclatureAlias = null; var notConfirmedQueryResult = uow.Session.QueryOver <Order>(() => orderAlias) .Where(() => orderAlias.DeliveryPoint.Id == deliveryPoint.Id) .Where(() => start < orderAlias.DeliveryDate && orderAlias.DeliveryDate < end) .Where(() => orderAlias.OrderStatus != OrderStatus.Canceled) .JoinAlias(() => orderAlias.OrderItems, () => orderItemAlias) .JoinAlias(() => orderItemAlias.Nomenclature, () => nomenclatureAlias) .Where(() => nomenclatureAlias.Category == NomenclatureCategory.water && !nomenclatureAlias.IsDisposableTare) .Select(Projections.Sum(() => orderItemAlias.Count)).List <decimal?>(); var confirmedQueryResult = uow.Session.QueryOver <Order>(() => orderAlias) .Where(() => orderAlias.DeliveryPoint.Id == deliveryPoint.Id) .Where(() => start < orderAlias.DeliveryDate && orderAlias.DeliveryDate < end) .Where(() => orderAlias.OrderStatus == OrderStatus.Closed) .JoinAlias(() => orderAlias.OrderItems, () => orderItemAlias) .JoinAlias(() => orderItemAlias.Nomenclature, () => nomenclatureAlias) .Where(() => nomenclatureAlias.Category == NomenclatureCategory.water && !nomenclatureAlias.IsDisposableTare) .Where(() => orderItemAlias.ActualCount != null) .Select(Projections.Sum(() => orderItemAlias.ActualCount)).List <decimal?>(); var bottlesOrdered = notConfirmedQueryResult.FirstOrDefault().GetValueOrDefault() + confirmedQueryResult.FirstOrDefault().GetValueOrDefault(); return((int)bottlesOrdered); }
public Nomenclature AddNomenclature_(Nomenclature a) { var result = mos_Communes_DbContext.Nomenclatures.Add(a); mos_Communes_DbContext.SaveChanges(); return(result.Entity); }
public bool TryGetFixedPrice(Order order, Nomenclature nomenclature, out decimal fixedPrice) { NomenclatureFixedPrice nomenclatureFixedPrice; if (order.DeliveryPoint != null) { nomenclatureFixedPrice = order.DeliveryPoint.NomenclatureFixedPrices.SingleOrDefault(x => x.Nomenclature.Id == nomenclature.Id); if (nomenclatureFixedPrice != null) { fixedPrice = nomenclatureFixedPrice.Price; return(true); } } else { nomenclatureFixedPrice = order.Client.ObservableNomenclatureFixedPrices.SingleOrDefault(x => x.Nomenclature.Id == nomenclature.Id); if (nomenclatureFixedPrice != null) { fixedPrice = nomenclatureFixedPrice.Price; return(true); } } fixedPrice = default(int); return(false); }
public async Task <ActionResult> Create(Nomenclature nomenclature, string provider, string providerName, string providerEDRPOU, string providerAddress) { if (ModelState.IsValid) { int providerId = int.Parse(provider); if (providerId == -1) { Provider pr = new Provider() { Title = providerName, Address = providerAddress, EDRPOU = providerEDRPOU }; db.Providers.Add(pr); nomenclature.Provider = pr; } else if (providerId != 0) { nomenclature.Provider = db.Providers.FirstOrDefault(x => x.Id == providerId); } db.Nomenclatures.Add(nomenclature); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } else { return(View()); } }
public IEnumerable <Nomenclature> ReadNomenclatures(string path) { var nomenclatures = new List <Nomenclature>(); using (var package = new ExcelPackage()) { using (var stream = File.OpenRead(path)) { package.Load(stream); } var workSheet = package.Workbook.Worksheets.First(); for (int i = 2; i <= workSheet.Dimension.End.Row; i++) { var nomenclature = new Nomenclature { Id = (int)(double)workSheet.Cells[i, 1].Value, Name = (string)workSheet.Cells[i, 2].Value }; nomenclatures.Add(nomenclature); } if (nomenclatures.Count != workSheet.Dimension.Rows - 1) { _logger.Error("Считаны не все строки, на вход поданы некорретные данные"); return(null); } } return(nomenclatures); }
private void SetPrice(Nomenclature nomenclature, string price) { bool havePrice = false; decimal priceValue = 0; if (!string.IsNullOrWhiteSpace(price)) { price = price.Replace(",", "."); var culture = CultureInfo.CreateSpecificCulture("ru-RU"); culture.NumberFormat.NumberDecimalSeparator = "."; havePrice = decimal.TryParse(price, NumberStyles.AllowDecimalPoint, culture, out priceValue); } NomenclaturePrice nomenclaturePrice = nomenclature.NomenclaturePrice.FirstOrDefault(); if (nomenclaturePrice == null) { if (!havePrice) { return; } nomenclaturePrice = new NomenclaturePrice(); nomenclaturePrice.Nomenclature = nomenclature; nomenclaturePrice.Price = priceValue; nomenclaturePrice.MinCount = 1; nomenclature.NomenclaturePrice.Add(nomenclaturePrice); } else { nomenclaturePrice.Price = havePrice ? priceValue : 0; nomenclaturePrice.MinCount = 1; } }
public void GetReferencedDocuments_WriteOffTest() { var interactive = Substitute.For <IInteractiveQuestion>(); interactive.Question(string.Empty).ReturnsForAnyArgs(true); var baseParameters = Substitute.For <BaseParameters>(); using (var uow = UnitOfWorkFactory.CreateWithoutRoot()) { var warehouse = new Warehouse(); uow.Save(warehouse); var nomenclatureType = new ItemsType { Name = "Тестовый тип номенклатуры" }; uow.Save(nomenclatureType); var nomenclature = new Nomenclature { Type = nomenclatureType }; uow.Save(nomenclature); var employee = new EmployeeCard(); uow.Save(employee); var expense = new Expense { Date = new DateTime(2021, 9, 10), Employee = employee, Operation = ExpenseOperations.Employee, Warehouse = warehouse, }; var size = new Size(); var height = new Size(); uow.Save(size); uow.Save(height); var stockPosition = new StockPosition(nomenclature, 0, size, height); var item = expense.AddItem(stockPosition, 10); expense.UpdateOperations(uow, baseParameters, interactive); uow.Save(expense); //Списываем 3 штуки var writeoff = new Writeoff() { Date = new DateTime(2021, 9, 11), }; var writeoffItem = writeoff.AddItem(item.EmployeeIssueOperation, 2); writeoff.UpdateOperations(uow); uow.Save(writeoff); uow.Commit(); var repository = new EmployeeIssueRepository(uow); var result = repository.GetReferencedDocuments(writeoffItem.EmployeeWriteoffOperation.Id); Assert.That(result.First().DocumentType, Is.EqualTo(StokDocumentType.WriteoffDoc)); Assert.That(result.First().DocumentId, Is.EqualTo(writeoff.Id)); Assert.That(result.First().ItemId, Is.EqualTo(writeoffItem.Id)); } }
public async Task <IActionResult> Create(Nomenclature Nomenclature) { db.Nomenclatures.Add(Nomenclature); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public void UpdateReturnedOperations_WhenSetAmountOfExistingNomenclatureToZero_ThenDeleteItsSelfDeliveryDocumentReturnedObject() { // arrange //Order order = Substitute.For<Order>(); Nomenclature nomenclatureMock = Substitute.For <Nomenclature>(); nomenclatureMock.Id.Returns(19); Dictionary <int, decimal> returnedNomenclatures = new Dictionary <int, decimal> { { 19, 0 } }; SelfDeliveryDocument selfDelivery = new SelfDeliveryDocument { TimeStamp = new DateTime(2000, 01, 01, 12, 00, 00), Order = Substitute.For <Order>(), Warehouse = Substitute.For <Warehouse>(), ReturnedItems = new List <SelfDeliveryDocumentReturned> { new SelfDeliveryDocumentReturned { Amount = 2, Nomenclature = nomenclatureMock, WarehouseMovementOperation = Substitute.For <WarehouseMovementOperation>() } } }; // act selfDelivery.UpdateReturnedOperations(Substitute.For <IUnitOfWork>(), returnedNomenclatures); // assert Assert.That(selfDelivery.ReturnedItems.Count, Is.EqualTo(0)); }
public void UpdateReturnedOperations_WhenAddNewNomenclatureToReturn_CreateNewSelfDeliveryDocumentReturnedAndNewWarehouseMovementOperation() { // arrange Nomenclature nomenclatureMock = Substitute.For <Nomenclature>(); nomenclatureMock.Id.Returns(15); Dictionary <int, decimal> returnedNomenclatures = new Dictionary <int, decimal> { { 15, 4 } }; SelfDeliveryDocument selfDelivery = new SelfDeliveryDocument { TimeStamp = new DateTime(2000, 01, 01, 12, 00, 00), Order = Substitute.For <Order>(), Warehouse = Substitute.For <Warehouse>(), ReturnedItems = new List <SelfDeliveryDocumentReturned>() }; IUnitOfWork uow = Substitute.For <IUnitOfWork>(); uow.GetById <Nomenclature>(15).Returns(nomenclatureMock); // act selfDelivery.UpdateReturnedOperations(uow, returnedNomenclatures); // assert Assert.That(selfDelivery.ReturnedItems.Count, Is.EqualTo(1)); Assert.That(selfDelivery.ReturnedItems.FirstOrDefault(s => s.Nomenclature == nomenclatureMock).Amount, Is.EqualTo(4)); Assert.That(selfDelivery.ReturnedItems.FirstOrDefault(s => s.Nomenclature == nomenclatureMock).WarehouseMovementOperation.Amount, Is.EqualTo(4)); }
private Order CreateTestOrderWithEquipmentRefundAndRecivedDeposit() { Order testOrder = new Order { OrderItems = new List <OrderItem>(), DeliveryDate = DateTime.Now, OrderDepositItems = new List <OrderDepositItem>(), DepositOperations = new List <DepositOperation>() }; Nomenclature depositNomenclature = Substitute.For <Nomenclature>(); depositNomenclature.TypeOfDepositCategory.Returns(TypeOfDepositCategory.EquipmentDeposit); OrderItem recivedDepositOrderItem = new OrderItem { Nomenclature = depositNomenclature, ActualCount = 2, Count = 3, Price = 150m, }; testOrder.OrderItems.Add(recivedDepositOrderItem); OrderDepositItem refundOrderDepositItem = new OrderDepositItem { ActualCount = 3, Count = 4, Deposit = 500m, DepositType = DepositType.Equipment }; testOrder.OrderDepositItems.Add(refundOrderDepositItem); return(testOrder); }
/// <summary> /// Добавить в список спецификаций /// </summary> /// <param name="nomenclature">Номенклатура</param> /// <param name="feature">Характеристика</param> /// <returns></returns> private OrderSpecificationItem AddToOrderSpecificationItems(Nomenclature nomenclature, Feature feature) { var exist = _specificationItems.FirstOrDefault(os => os.Nomenclature == nomenclature && os.Feature == feature); var orderSpesific = exist ?? new OrderSpecificationItem() { Guid = Guid.NewGuid(), Nomenclature = nomenclature, NomenclatureId = nomenclature.Id, Feature = feature, FeatureId = feature.Id, Price = feature.Price, }; orderSpesific.Count++; orderSpesific.PriceWithDiscount = orderSpesific.Price * orderSpesific.Count; if (exist == null) { _specificationItems.Add(orderSpesific); } MainController.RecalculatePayment(); return(orderSpesific); }
/// <summary> /// /// </summary> private void AddNomencl() { using (var uf = new ApplicationDbContext()) { for (int i = 0; i < 10; i++) { var mainGuid = Guid.NewGuid(); var newNomencl = new Nomenclature { Guid = mainGuid, Name = "Диван_" + mainGuid.ToString().Substring(0, 4) }; uf.Set <Nomenclature>().Add(newNomencl); uf.SaveChanges(); for (int j = 0; j < 2; j++) { var childGuid = Guid.NewGuid(); var childNomencl = new Nomenclature { Guid = childGuid, Parent = newNomencl, Name = newNomencl.Name + "_Inner_" + childGuid.ToString().Substring(0, 4) }; uf.Set <Nomenclature>().Add(childNomencl); uf.SaveChanges(); AddCharact(childNomencl, uf); } } } }
private void dataGridView_MouseDoubleClick(object sender, MouseEventArgs e) { var currentRow = dataGridView.CurrentRow; if (currentRow != null) { FormElementNomenclature formElementNomenclature = new FormElementNomenclature(); int idNomenclature = Int32.Parse(currentRow.Cells["id"].Value.ToString()); Nomenclature nomenclature = db.Nomenclature.Find(idNomenclature); formElementNomenclature.textBoxId.Text = currentRow.Cells["id"].Value.ToString(); formElementNomenclature.textBoxName.Text = currentRow.Cells["name"].Value.ToString(); formElementNomenclature.textBoxManufacturer.Text = currentRow.Cells["manufacturer"].Value.ToString(); formElementNomenclature.textBoxCountry.Text = currentRow.Cells["country"].Value.ToString(); DialogResult result = formElementNomenclature.ShowDialog(this); if (result == DialogResult.OK && nomenclature != null) { nomenclature.name = formElementNomenclature.textBoxName.Text.ToString(); nomenclature.manufacturer = formElementNomenclature.textBoxManufacturer.Text.ToString(); nomenclature.country = formElementNomenclature.textBoxCountry.Text.ToString(); db.SaveChanges(); checkFilterNomenclature(); dataGridView.Refresh(); } } }
public IList <GoodsInRouteListResult> GetEquipmentsInRL(IUnitOfWork uow, RouteList routeList) { GoodsInRouteListResult resultAlias = null; Vodovoz.Domain.Orders.Order orderAlias = null; OrderEquipment orderEquipmentAlias = null; Nomenclature OrderEquipmentNomenclatureAlias = null; //Выбирается список Id заказов находящихся в МЛ var ordersQuery = QueryOver.Of <Vodovoz.Domain.Orders.Order>(() => orderAlias); var routeListItemsSubQuery = QueryOver.Of <RouteListItem>() .Where(r => r.RouteList.Id == routeList.Id) .Where(r => !r.WasTransfered || (r.WasTransfered && r.NeedToReload)) .Select(r => r.Order.Id); ordersQuery.WithSubquery.WhereProperty(o => o.Id).In(routeListItemsSubQuery).Select(o => o.Id); var orderEquipmentsQuery = uow.Session.QueryOver <OrderEquipment>(() => orderEquipmentAlias) .WithSubquery.WhereProperty(i => i.Order.Id).In(ordersQuery) .Where(() => orderEquipmentAlias.Direction == Direction.Deliver) .JoinAlias(() => orderEquipmentAlias.Nomenclature, () => OrderEquipmentNomenclatureAlias); return(orderEquipmentsQuery .SelectList(list => list .SelectGroup(() => OrderEquipmentNomenclatureAlias.Id).WithAlias(() => resultAlias.NomenclatureId) .Select(Projections.Sum( Projections.Cast(NHibernateUtil.Decimal, Projections.Property(() => orderEquipmentAlias.Count)))).WithAlias(() => resultAlias.Amount) ) .TransformUsing(Transformers.AliasToBean <GoodsInRouteListResult>()) .List <GoodsInRouteListResult>()); }
void FillListEquipmentFromRoute() { ReceptionNonSerialEquipmentList.Clear(); ReceptionNonSerialEquipmentItemNode resultAlias = null; Vodovoz.Domain.Orders.Order orderAlias = null; OrderEquipment orderEquipmentAlias = null; Nomenclature NomenclatureAlias = null; var equipmentItems = MyOrmDialog.UoW.Session.QueryOver <RouteListItem>() .Where(r => r.RouteList.Id == RouteList.Id) .JoinAlias(rli => rli.Order, () => orderAlias) .JoinAlias(() => orderAlias.OrderEquipments, () => orderEquipmentAlias) .Where(() => orderEquipmentAlias.Direction == Domain.Orders.Direction.PickUp) .JoinAlias(() => orderEquipmentAlias.Nomenclature, () => NomenclatureAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .SelectList(list => list .SelectGroup(() => NomenclatureAlias.Id).WithAlias(() => resultAlias.NomenclatureId) .Select(() => NomenclatureAlias.Name).WithAlias(() => resultAlias.Name) .SelectSum(() => orderEquipmentAlias.Count).WithAlias(() => resultAlias.NeedReceptionCount) ) .TransformUsing(Transformers.AliasToBean <ReceptionNonSerialEquipmentItemNode>()) .List <ReceptionNonSerialEquipmentItemNode>(); foreach (var equipment in equipmentItems) { ReceptionNonSerialEquipmentList.Add(equipment); } }
public bool TryGetFixedPrice(Counterparty counterparty, Nomenclature nomenclature, out decimal fixedPrice) { var nomenclatureFixedPrice = counterparty.ObservableNomenclatureFixedPrices .SingleOrDefault(x => x.Nomenclature.Id == nomenclature.Id); return(CheckFixedPrice(out fixedPrice, nomenclatureFixedPrice)); }
public IEntitySelector CreateNomenclatureSelector(IEnumerable <int> excludedNomenclatures) { NomenclatureFilterViewModel nomenclatureFilter = new NomenclatureFilterViewModel(); nomenclatureFilter.RestrictArchive = true; nomenclatureFilter.AvailableCategories = Nomenclature.GetCategoriesForGoods(); var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider()); var counterpartySelectorFactory = new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>( ServicesConfig.CommonServices); var nomenclatureSelectorFactory = new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>( ServicesConfig.CommonServices, nomenclatureFilter, counterpartySelectorFactory, nomenclatureRepository, UserSingletonRepository.GetInstance()); NomenclaturesJournalViewModel vm = new NomenclaturesJournalViewModel( nomenclatureFilter, UnitOfWorkFactory.GetDefaultFactory, ServicesConfig.CommonServices, new EmployeeService(), nomenclatureSelectorFactory, counterpartySelectorFactory, nomenclatureRepository, UserSingletonRepository.GetInstance() ); vm.SelectionMode = JournalSelectionMode.Multiple; return(vm); }
public static Nomenclature rebuildNomenclature(Nomenclature inNomenclature, List <string> excludeProperty) { Nomenclature nomenclature = null; if (inNomenclature != null) { nomenclature = new Nomenclature(inNomenclature.Id); nomenclature.IsActive = inNomenclature.IsActive; nomenclature.Enabled = inNomenclature.Enabled; nomenclature.Name = inNomenclature.Name; nomenclature.ExternalCode = inNomenclature.ExternalCode; if (!isExclude(excludeProperty, "StartDate")) { nomenclature.StartDate = inNomenclature.StartDate; } if (!isExclude(excludeProperty, "FinishDate")) { nomenclature.FinishDate = inNomenclature.FinishDate; } if (!isExclude(excludeProperty, "Organization")) { nomenclature.Organization = rebuildOrganizationSimple(inNomenclature.Organization, rebuildExcludeProperty(excludeProperty, "Organization")); } if (!isExclude(excludeProperty, "NomBodyPart")) { nomenclature.NomBodyPart = rebuildNomBodyPart(inNomenclature.NomBodyPart); } if (!isExclude(excludeProperty, "NomBodyPartSize")) { nomenclature.NomBodyPartSize = rebuildNomBodyPartSize(inNomenclature.NomBodyPartSize); } if (!isExclude(excludeProperty, "Growth")) { nomenclature.Growth = rebuildNomBodyPartSize(inNomenclature.Growth); } if (!isExclude(excludeProperty, "NomGroup")) { nomenclature.NomGroup = rebuildNomGroup(inNomenclature.NomGroup); } if (!isExclude(excludeProperty, "Unit")) { Unit unit = new Unit(inNomenclature.Unit.Id, inNomenclature.Unit.Name); nomenclature.Unit = unit; } if (!isExclude(excludeProperty, "Sex")) { if (inNomenclature.Sex != null) { Sex sex = new Sex(inNomenclature.Sex.Id, inNomenclature.Sex.Name); nomenclature.Sex = sex; } } } return(nomenclature); }
public ActionResult Nomenclature_Delete(string id) { Nomenclature obj = nomenclatureRepository.Get(int.Parse(id)); nomenclatureRepository.Delete(obj); return(Nomenclature_Select()); }
public decimal GetUndelivered19LBottlesQuantity(IUnitOfWork uow, DateTime?start = null, DateTime?end = null) { Order orderAlias = null; Nomenclature nomenclatureAlias = null; var subquery = QueryOver.Of <UndeliveredOrder>() .Left.JoinAlias(u => u.OldOrder, () => orderAlias); if (start != null && end != null) { subquery.Where(() => orderAlias.DeliveryDate >= start) .Where(() => orderAlias.DeliveryDate <= end); } subquery.Select(u => u.OldOrder.Id); var bottles19L = uow.Session.QueryOver <OrderItem>() .WithSubquery.WhereProperty(i => i.Order.Id).In(subquery) .Left.JoinQueryOver(i => i.Nomenclature, () => nomenclatureAlias) .Where(n => n.Category == NomenclatureCategory.water && n.TareVolume == TareVolume.Vol19L) .SelectList(list => list.SelectSum(i => i.Count)) .List <decimal?>() .FirstOrDefault(); return(bottles19L ?? 0); }
public static int GetStockForNomenclature(IUnitOfWork uow, int nomenclatureId) { Nomenclature nomenclatureAlias = null; WarehouseMovementOperation operationAddAlias = null; WarehouseMovementOperation operationRemoveAlias = null; var subqueryAdd = QueryOver.Of <WarehouseMovementOperation>(() => operationAddAlias) .Where(() => operationAddAlias.Nomenclature.Id == nomenclatureAlias.Id) .Select(Projections.Sum <WarehouseMovementOperation>(o => o.Amount)); var subqueryRemove = QueryOver.Of <WarehouseMovementOperation>(() => operationRemoveAlias) .Where(() => operationRemoveAlias.Nomenclature.Id == nomenclatureAlias.Id) .Select(Projections.Sum <WarehouseMovementOperation>(o => o.Amount)); var amountProjection = Projections.SqlFunction(new SQLFunctionTemplate(NHibernateUtil.Int32, "( ?1 - ?2 )"), NHibernateUtil.Int32, new IProjection[] { Projections.SubQuery(subqueryAdd), Projections.SubQuery(subqueryRemove) } ); ItemInStock inStock = null; var queryResult = uow.Session.QueryOver <Nomenclature>(() => nomenclatureAlias) .Where(() => nomenclatureAlias.Id == nomenclatureId) .SelectList(list => list .SelectGroup(() => nomenclatureAlias.Id) .Select(amountProjection) ).SingleOrDefault <object[]>(); return((int)queryResult[1]); }
public int DeleteValue(Nomenclature nomenclature) { Bm2s.Connectivity.Common.Article.Nomenclature connect = new Bm2s.Connectivity.Common.Article.Nomenclature(); connect.Request.Nomenclature = nomenclature; connect.Delete(); return connect.Request.Nomenclature.Id; }
public HtmlString SetValue(Nomenclature nomenclature) { Bm2s.Connectivity.Common.Article.Nomenclature connect = new Bm2s.Connectivity.Common.Article.Nomenclature(); connect.Request.Nomenclature = nomenclature; connect.Post(); return connect.Response.Nomenclatures.FirstOrDefault().ToHtmlJson(); }
public virtual void AddFixedPrice(Nomenclature nomenclature, decimal price) { var nomenculaturePrice = new WaterSalesAgreementFixedPrice{ Nomenclature = nomenclature, AdditionalAgreement = this, Price = price }; ObservablFixedPrices.Add(nomenculaturePrice); }
public Nomenclature SearchNomenclatureByCode(string name) { dynamic meta = Result.Справочники.Номенклатура.НайтиПоКоду(name); var value = new Nomenclature { Code = meta.Код, Description = meta.Наименование }; return value; }
public List<Nomenclature> SearchNomenclatureByName(string name) { var list = new List<Nomenclature>(); dynamic qr = Result.NewObject("Запрос"); qr.Текст = "ВЫБРАТЬ первые 50 * ИЗ Справочник.Номенклатура КАК Спр ГДЕ (Спр.Наименование ПОДОБНО &Наименование)"; qr.УстановитьПараметр("Наименование", "%" + name + "%"); dynamic выборка = qr.Выполнить().Выбрать(); while (выборка.Следующий()) { var value = new Nomenclature { Code = выборка.Код, Description = выборка.Наименование }; //MessageBox.Show(выборка.Наименование); list.Add(value); } return list; }
protected void OnRunReferenceItemDialog(object sender, Reference.RunReferenceItemDlgEventArgs e) { ResponseType Result; switch (e.TableName) { case "nomenclature": Nomenclature ItemNomen = new Nomenclature(); if(e.NewItem) ItemNomen.NewItem = true; else ItemNomen.Fill(e.ItemId); ItemNomen.Show(); Result = (ResponseType)ItemNomen.Run(); ItemNomen.Destroy(); break; case "basis": Basis BasisEdit = new Basis(); if(e.NewItem) BasisEdit.NewItem = true; else BasisEdit.Fill(e.ItemId); BasisEdit.Show(); Result = (ResponseType)BasisEdit.Run(); BasisEdit.Destroy(); break; case "cubes": CubesDlg CubesEdit = new CubesDlg(); if(e.NewItem) CubesEdit.NewItem = true; else CubesEdit.Fill(e.ItemId); CubesEdit.Show(); Result = (ResponseType)CubesEdit.Run(); CubesEdit.Destroy(); break; case "exhibition": Exhibition ExhibitionEdit = new Exhibition(); if(!e.NewItem) ExhibitionEdit.Fill(e.ItemId); ExhibitionEdit.Show(); Result = (ResponseType)ExhibitionEdit.Run(); ExhibitionEdit.Destroy(); break; default: logger.Warn("Диалог для справочника {0} не найден.", e.TableName); Result = ResponseType.None; break; } e.Result = Result; }
public static QueryOver<Equipment> GetUnusedEquipment(Nomenclature nomenclature) { Equipment equipmantAlias = null; var counterpartyOperationsSubquery = QueryOver.Of<CounterpartyMovementOperation> () .Where (op => op.Equipment.Id == equipmantAlias.Id) .Select (op=>op.Id); var warehouseOperationsSubquery = QueryOver.Of<WarehouseMovementOperation> () .Where (op => op.Equipment.Id == equipmantAlias.Id) .Select (op=>op.Id); return QueryOver.Of<Equipment>(() => equipmantAlias) .Where(() => equipmantAlias.Nomenclature.Id == nomenclature.Id) .WithSubquery.WhereNotExists(counterpartyOperationsSubquery) .WithSubquery.WhereNotExists(warehouseOperationsSubquery); }
public static int NomenclatureReserved(IUnitOfWork uow, Nomenclature nomenclature) { return NomenclatureReserved(uow, nomenclature.Id); }
public static decimal NomenclatureInStock(IUnitOfWork UoW, Nomenclature nomenclature) { return NomenclatureInStock(UoW, nomenclature.Warehouse.Id, new int[]{ nomenclature.Id }).Values.FirstOrDefault(); }
public static QueryOver<Equipment> GetEquipmentByNomenclature(Nomenclature nomenclature) { Nomenclature nomenclatureAlias = null; return QueryOver.Of<Equipment> () .JoinAlias (e => e.Nomenclature, () => nomenclatureAlias) .Where (() => nomenclatureAlias.Id == nomenclature.Id); }
public virtual void AddItem(Nomenclature nomenclature, decimal amountInDB, decimal amountInFact) { var item = new InventoryDocumentItem() { Nomenclature = nomenclature, AmountInDB = amountInDB, AmountInFact = amountInFact, Document = this }; ObservableItems.Add (item); }
public virtual void AddItem(Nomenclature nomenclature, decimal amount, decimal inStock) { var item = new WriteoffDocumentItem { Nomenclature = nomenclature, AmountOnStock = inStock, Amount = amount, Document = this }; if (WriteoffWarehouse != null) item.CreateOperation(WriteoffWarehouse, TimeStamp); else item.CreateOperation(Client, DeliveryPoint, TimeStamp); ObservableItems.Add (item); }
public static Equipment GetEquipmentForSaleByNomenclature(IUnitOfWork uow, Nomenclature nomenclature) { return AvailableEquipmentQuery ().GetExecutableQueryOver (uow.Session) .Where (eq => eq.Nomenclature.Id == nomenclature.Id) .Where (eq => !eq.OnDuty) .Take (1) .List ().First (); }
public static IList<Equipment> GetEquipmentForSaleByNomenclature(IUnitOfWork uow, Nomenclature nomenclature, int count=0, int[] exceptIDs=null) { if(exceptIDs==null) exceptIDs=new int[0]; return (count > 0) ? AvailableEquipmentQuery().GetExecutableQueryOver(uow.Session) .Where(eq => eq.Nomenclature.Id == nomenclature.Id) .Where(eq => !eq.OnDuty) .Where(eq => !eq.Id.IsIn(exceptIDs)) .Take(count) .List() : new List<Equipment>(); }
public virtual void AddItem(Nomenclature nomenclature, decimal amount, decimal inStock) { var item = new MovementDocumentItem { Nomenclature = nomenclature, Amount = amount, AmountOnSource = inStock, Document = this }; if (Category == MovementDocumentCategory.counterparty) item.CreateOperation(FromClient, FromDeliveryPoint, ToClient, ToDeliveryPoint, TimeStamp); else if (Category == MovementDocumentCategory.warehouse) item.CreateOperation(FromWarehouse, ToWarehouse, TimeStamp, TransportationStatus); else { if (TransportationStatus == TransportationStatus.WithoutTransportation) TransportationStatus = TransportationStatus.Submerged; item.CreateOperation(FromWarehouse, ToWarehouse, TimeStamp, TransportationStatus); } ObservableItems.Add (item); }