Esempio n. 1
0
        public void SetEnumerationCells(IEnumerable <WareHousesDTO> wareHouse)
        {
            WareHousesDTO[] outArray = new WareHousesDTO[] { };

            int curStoreId = wareHouse.First().StoreNameId;
            int?sortedType = StoreNames.GetAll().First(s => s.StoreNameId == curStoreId).EnumerationTypeId;

            var paramModel = StoreNames.GetAll().FirstOrDefault(w => w.StoreNameId == curStoreId);
            var paramArr   = wareHouse.Cast <WareHousesDTO>().ToArray();

            int arrCount = paramArr.Length;

            if (arrCount > 0)
            {
                outArray = GetSortedArray(paramArr, (int)paramModel.LineCount, (int)paramModel.ColumnCount, (int)paramModel.EnumerationTypeId);
            }

            int nextCellNumber = GetNextCellNumber(paramModel.ParentId ?? 0);

            for (int i = 0; i < arrCount; i++)
            {
                if (outArray[i].Checked)
                {
                    outArray[i].NumberCell = 0;
                }
                else
                {
                    outArray[i].NumberCell = nextCellNumber;
                    nextCellNumber++;
                }
                WareHousesUpdate(outArray[i]);
            }
        }
Esempio n. 2
0
        private void SaveDate()
        {
            expenditureMaterials = cellPresenceList.Where(c => c.QuantityChanged > 0).Select(c => new ExpendituresDTO {
                KeepingId = c.KeepingId, ReceiptAcceptanceId = c.ReceiptAcceptanceId, Quantity = c.QuantityChanged, ExpDate = DateTime.Today
            }).ToList();

            if (expenditureMaterials.Count > 0)
            {
                WareHousesDTO whdto = wareHousesService.GetWareHouseById(firstWindDefaultCell);

                int loading = (cellPresenceList.Sum(c => c.QuantityStore) == 0 ? 1 : 2);
                whdto.LoadingStatusId = (cellCompletedFirstChk.Checked) ? 3 : loading;
                wareHousesService.WareHousesUpdate(whdto);

                expendituresService.CreateRange(expenditureMaterials);
                expenditureMaterials.Clear();
                cellPresenceList.Clear();
                LoadKeepingData(storageId);
            }

            cellCompletedFirstChk.Checked = false;
            numberCellFirstLbl.Text       = "";
            keepingsFirtWndBS.DataSource  = null;
            firstWindDefaultCell          = -1;
        }
Esempio n. 3
0
        public void WareHousesUpdate(WareHousesDTO wareHouse)
        {
            var item = WareHouses.GetAll().SingleOrDefault(c => c.WareHouseId == wareHouse.WareHouseId);

            WareHouses.Update((mapper.Map <WareHousesDTO, WareHouses>(wareHouse, item)));
        }
Esempio n. 4
0
        private bool TakeKeeping(KeepingMaterialsDTO model)
        {
            receiptsService           = Program.kernel.Get <IReceiptsService>();
            receiptAcceptancesService = Program.kernel.Get <IReceiptAcceptancesService>();
            ordersService             = Program.kernel.Get <IOrdersService>();
            keepingsService           = Program.kernel.Get <IKeepingsService>();
            expendituresService       = Program.kernel.Get <IExpendituresService>();

            int wareHouseId = model.WareHouseId;

            if (wareHouseId > 0)
            {
                firstWindDefaultCell = wareHouseId;

                if ((int)barEditItem1.EditValue == 0)
                {
                    if (cellPresenceList == null)
                    {
                        cellPresenceList = wareHousesService.GetCellPresence(wareHouseId).ToList();
                    }

                    keepingsFirtWndBS.DataSource     = cellPresenceList;
                    keepingsFirstWindGrid.DataSource = keepingsFirtWndBS;

                    WareHousesDTO cellInfo = wareHousesService.GetCellInfo(wareHouseId);
                    numberCellFirstLbl.Text         = cellInfo.NumberCell.ToString();
                    cellCompletedFirstChk.EditValue = (cellInfo.LoadingStatusId == 3 ? true : false);

                    bool canEdit = true;

                    ConfirmQuantityDTO kdto = new ConfirmQuantityDTO
                    {
                        Quantity     = (decimal)model.QuantityStore,
                        Article      = model.Article,
                        MaterialName = model.MaterialName,
                        KeepingId    = model.KeepingId
                    };

                    //using (ConfirmQuantityFm confirmQuantityFm = new ConfirmQuantityFm(kdto, canEdit))
                    //{
                    //    if (confirmQuantityFm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    //    {
                    //        kdto = confirmQuantityFm.Return();

                    //        keepingsFirstWindGridView.BeginDataUpdate();
                    //        cellPresenceList.Where(c => c.KeepingId == (int)kdto.KeepingId).Select(c => { c.QuantityStore = (c.QuantityStore - kdto.Quantity); c.QuantityChanged = c.QuantityChanged + kdto.Quantity; return c; }).ToList();
                    //        keepingsFirstWindGridView.EndDataUpdate();

                    //        expendituresGridView.BeginDataUpdate();
                    //        keepingMaterials.Where(c => c.KeepingId == (int)kdto.KeepingId).Select(k => { k.QuantityStore = (k.QuantityStore - kdto.Quantity); return k; }).ToList();
                    //        expendituresGridView.EndDataUpdate();

                    //        int rowHandle = keepingsFirstWindGridView.LocateByValue("KeepingId", model.KeepingId);
                    //        keepingsFirstWindGridView.FocusedRowHandle = rowHandle;
                    //    }
                    //}
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }