Esempio n. 1
0
        private void LoadData()
        {
            storeNamesService = Program.kernel.Get <IStoreNamesService>();
            wareHousesService = Program.kernel.Get <IWareHousesService>();

            storeLoadList    = storeNamesService.GetStoreLoad().ToList();
            cellLoadList     = wareHousesService.GetWareHouses().ToList();
            cellPresenceList = wareHousesService.GetWareHousePresences().ToList();
        }
Esempio n. 2
0
        private void RunToControlVisual()
        {
            int line   = storeNames.LineCount ?? 0;
            int column = storeNames.ColumnCount ?? 0;
            int cell   = storeNames.CellCount ?? 0;

            cellList = wareHousesService.GetWareHouses().Where(s => s.StoreNameId == storeNames.StoreNameId).ToList();

            if ((cellList.Count != 0) && (cellList[1].NumberCell != null))
            {
                ControlVisual(line, column, cellList);
            }
            else
            {
                MessageBox.Show("Для выбранного ряда нет номеров ячеек!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 3
0
        private void GetCellList()
        {
            int curStoreId = ((StoreNamesDTO)storeNamesBS.Current).StoreNameId;

            cellList = wareHousesService.GetWareHouses().Where(s => s.StoreNameId == curStoreId).ToList();
        }
Esempio n. 4
0
        private void deleteSpravochItemBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            switch (gridName)
            {
            case Utils.GridName.Units:

                if (unitsBS.Count != 0)
                {
                    if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Error.ErrorCRUD result = this.unitsService.UnitDelete((UnitsDTO)unitsBS.Current);
                        if (result == Error.ErrorCRUD.NoError)
                        {
                            this.unitsBS.RemoveCurrent();
                            unitsService                 = Program.kernel.Get <IUnitsService>();
                            unitsBS.DataSource           = unitsService.GetUnits();
                            this.spravochGrid.DataSource = null;
                            this.spravochGrid.DataSource = this.unitsBS;
                        }
                        else
                        {
                            switch (result)
                            {
                            case Error.ErrorCRUD.RelationError:
                                MessageBox.Show("Ед.измерения нельзя удалить. Есть связанные данные!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                break;

                            case Error.ErrorCRUD.DatabaseError:
                                MessageBox.Show("Ошибка Базы данных!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
                break;

            case Utils.GridName.Users:

                if (usersBS.Count != 0)
                {
                    if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (this.usersService.UserDeleteById(((UsersDTO)usersBS.Current).UserId))
                        {
                            int rowHandle = spravochGridView.FocusedRowHandle - 1;
                            spravochGridView.BeginDataUpdate();

                            usersService            = Program.kernel.Get <IUsersService>();
                            usersBS.DataSource      = usersService.GetUsers();
                            spravochGrid.DataSource = usersBS;

                            spravochGridView.EndDataUpdate();
                            spravochGridView.FocusedRowHandle = (spravochGridView.IsValidRowHandle(rowHandle)) ? rowHandle : -1;
                        }
                    }
                }
                break;

            case Utils.GridName.Contractors:

                if (contractorsBS.Count != 0)
                {
                    if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Error.ErrorCRUD result = this.contractorsService.ContractorDelete((ContractorsDTO)contractorsBS.Current);
                        if (result == Error.ErrorCRUD.NoError)
                        {
                            this.contractorsBS.RemoveCurrent();

                            contractorsService           = Program.kernel.Get <IContractorsService>();
                            contractorsBS.DataSource     = contractorsService.GetContractors();
                            this.spravochGrid.DataSource = null;
                            this.spravochGrid.DataSource = this.contractorsBS;
                        }
                        else
                        {
                            switch (result)
                            {
                            case Error.ErrorCRUD.RelationError:
                                MessageBox.Show("Поставщика нельзя удалить. Есть связанные данные!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                break;

                            case Error.ErrorCRUD.DatabaseError:
                                MessageBox.Show("Ошибка Базы данных!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
                break;

            case Utils.GridName.StorageGroups:

                if (storageGroupsBS.Count != 0)
                {
                    if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Error.ErrorCRUD result = this.storageGroupsService.StorageGroupsDelete((StorageGroupsDTO)storageGroupsBS.Current);
                        if (result == Error.ErrorCRUD.NoError)
                        {
                            this.storageGroupsBS.RemoveCurrent();

                            storageGroupsService         = Program.kernel.Get <IStorageGroupsService>();
                            storageGroupsBS.DataSource   = storageGroupsService.GetStorageGroups();
                            this.spravochGrid.DataSource = null;
                            this.spravochGrid.DataSource = this.storageGroupsBS;
                        }
                        else
                        {
                            switch (result)
                            {
                            case Error.ErrorCRUD.RelationError:
                                MessageBox.Show("Складскую группу нельзя удалить. Есть связанные данные!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                break;

                            case Error.ErrorCRUD.DatabaseError:
                                MessageBox.Show("Ошибка Базы данных!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
                break;

            case Utils.GridName.Measures:

                if (measuresBS.Count != 0)
                {
                    if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (this.measuresService.MeasureDelete((MeasuresDTO)measuresBS.Current))
                        {
                            this.measuresBS.RemoveCurrent();
                        }

                        measuresService              = Program.kernel.Get <IMeasuresService>();
                        measuresBS.DataSource        = measuresService.GetMeasures();
                        this.spravochGrid.DataSource = null;
                        this.spravochGrid.DataSource = this.measuresBS;
                    }
                }
                break;

            case Utils.GridName.Currency:

                if (currencyBS.Count != 0)
                {
                    if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (this.currencyService.CurrencyDelete((CurrencyDTO)currencyBS.Current))
                        {
                            this.currencyBS.RemoveCurrent();
                        }

                        currencyService              = Program.kernel.Get <ICurrencyService>();
                        currencyBS.DataSource        = currencyService.GetCurrency();
                        this.spravochGrid.DataSource = null;
                        this.spravochGrid.DataSource = this.currencyBS;
                    }
                }
                break;

            case Utils.GridName.ZoneNames:

                if (zoneNamesBS.Count != 0)
                {
                    cellList = wareHousesService.GetWareHouses().ToList();
                    bool anyCellLoading = cellList.Any(s => s.ZoneNameId == (((ZoneNamesDTO)zoneNamesBS.Current).ZoneNameId) && s.LoadingStatusId > 1);    // проверка загруженности зоны

                    if (anyCellLoading)
                    {
                        if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            if (this.zoneNamesService.ZoneAllDelete(((ZoneNamesDTO)zoneNamesBS.Current).ZoneNameId))      //удаление данных по всем связанным таблицам
                            {
                                if (this.zoneNamesService.ZoneNameDelete((ZoneNamesDTO)zoneNamesBS.Current))
                                {
                                    this.zoneNamesBS.RemoveCurrent();
                                }

                                zoneNamesService             = Program.kernel.Get <IZoneNamesService>();
                                zoneNamesBS.DataSource       = zoneNamesService.GetZones();
                                this.spravochGrid.DataSource = null;
                                this.spravochGrid.DataSource = this.zoneNamesBS;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Нельзя удалить зону. В выбранной зоне находиться ТОВАР.", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                break;

            case Utils.GridName.Persons:

                if (personsBS.Count != 0)
                {
                    if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (this.personsService.PersonDelete((PersonsDTO)personsBS.Current))
                        {
                            this.personsBS.RemoveCurrent();
                        }

                        personsService               = Program.kernel.Get <IPersonsService>();
                        personsBS.DataSource         = personsService.GetPersons();
                        this.spravochGrid.DataSource = null;
                        this.spravochGrid.DataSource = this.personsBS;
                    }
                }
                break;

            case Utils.GridName.Profession:

                if (professionBS.Count != 0)
                {
                    if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (this.professionService.ProfessionDelete((ProfessionsDTO)professionBS.Current))
                        {
                            this.professionBS.RemoveCurrent();
                        }

                        professionService            = Program.kernel.Get <IProfessionService>();
                        professionBS.DataSource      = professionService.GetProfession();
                        this.spravochGrid.DataSource = null;
                        this.spravochGrid.DataSource = this.professionBS;
                    }
                }
                break;

            case Utils.GridName.Alarms:

                if (alarmsBS.Count != 0)
                {
                    if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (this.settingsService.AlarmDelete((AlarmsDTO)alarmsBS.Current))
                        {
                            this.alarmsBS.RemoveCurrent();
                        }

                        settingsService              = Program.kernel.Get <ISettingsService>();
                        alarmsBS.DataSource          = settingsService.GetAlarms();
                        this.spravochGrid.DataSource = null;
                        this.spravochGrid.DataSource = this.alarmsBS;
                    }
                }
                break;

            default:

                break;
            }
        }