private void packingTypeEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { switch (e.Button.Index) //Тип Упаковки PackingTypes { case 1: //Очистить { packingTypeEdit.EditValue = null; packingTypeEdit.Properties.NullText = "Нет данных"; PackingTypeEditBtnEnabled(false); break; } case 2: //ДОБАВИТЬ { new PackingTypeEditFm(Utils.Operation.Add, (PackingTypesDTO)packingTypesBS.Current, (obj) => { packingTypesBS.Add(obj); }).ShowDialog(); break; } case 3://РЕДАКТИРОВАТЬ { new PackingTypeEditFm(Utils.Operation.Update, (PackingTypesDTO)packingTypeEdit.GetSelectedDataRow(), (obj) => { }).ShowDialog(); break; } case 4://УДАЛИТЬ { if (packingTypesBS.Count != 0) { if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.packingTypesService.PackingTypeDelete((PackingTypesDTO)packingTypeEdit.GetSelectedDataRow()); packingTypeEdit.EditValue = null; packingTypeEdit.Properties.NullText = "Нет данных"; } } break; } default: { break; } } if (e.Button.Index != 0)// для кнопки выбора индекс 0 ,не обновлять { packingTypesService = Program.kernel.Get<IPackingTypesService>(); packingTypesBS.DataSource = packingTypesService.GetPackingTypes(); packingTypeEdit.Properties.DataSource = null; packingTypeEdit.Properties.DataSource = packingTypesBS; } }
private void LoadMeasuresData() { measuresService = Program.kernel.Get<IMeasuresService>(); packingTypesService = Program.kernel.Get<IPackingTypesService>(); unitsService = Program.kernel.Get<IUnitsService>(); }
private void LoadData() { packingTypesService = Program.kernel.Get <IPackingTypesService>(); }