Пример #1
0
        void initForm()
        {
            if (edit)
            {
                currentTypeOperations = uow.GetObjectByKey <device_TypeOperations>(currentTypeOperationsGuid);
            }
            else
            {
                currentTypeOperations = new device_TypeOperations(uow);
            }

            #region Настройка внешнего вида
            if (edit)
            {
                Text           = string.Format("Редактирование тип операции {0}", currentTypeOperations.NameOperationsType);
                addButton.Text = "Сохранить";
            }

            if (view)
            {
                Text = string.Format("Просмотр тип операции{0}", currentTypeOperations.NameOperationsType);
                nameOperationsTypeTextEdit.ReadOnly = true;
                layoutControlItem7.Visibility       = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            }
            #endregion


            if (edit)
            {
                nameOperationsTypeTextEdit.Text = currentTypeOperations.NameOperationsType;
            }
        }
Пример #2
0
 private void barButtonItemDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     using (UnitOfWork u = new UnitOfWork())
     {
         device_TypeOperations currentTypeOperations = u.GetObjectByKey <device_TypeOperations>((Guid)typeOperationsGridView.GetFocusedRowCellValue("GUID"));
         DialogResult          d = XtraMessageBox.Show(string.Format("Удалить тип операции {0} ", currentTypeOperations.NameOperationsType), "Подтверждение действия", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (d == DialogResult.Yes)
         {
             currentTypeOperations.DeletedDate = DateTime.Now;
             currentTypeOperations.Save();
             u.CommitChanges();
         }
     }
     loadData();
 }