Beispiel #1
0
 private void barButtonItemDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     using (UnitOfWork u = new UnitOfWork())
     {
         device_WorkShifts currentWorkShifts = u.GetObjectByKey <device_WorkShifts>((Guid)workShiftsGridView.GetFocusedRowCellValue("GUID"));
         DialogResult      d = XtraMessageBox.Show(string.Format("Удалить тип ремонта {0}?", currentWorkShifts.TypeOfShift), "Подтверждение действия", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (d == DialogResult.Yes)
         {
             currentWorkShifts.DeletedDate = DateTime.Now;
             currentWorkShifts.Save();
             u.CommitChanges();
         }
     }
     loadData();
 }
        void SaveVendor()
        {
            if (formValid)
            {
                currentWorkShifts.TypeOfShift  = typeOfShiftTextEdit.Text;
                currentWorkShifts.WorkingHours = Convert.ToDecimal(WorkingHoursTextEdit.Text);
                currentWorkShifts.ShiftType    = shiftTypeTextEdit.Text;

                if (edit)
                {
                    currentWorkShifts.DateOfChange = DateTime.Now;
                    currentWorkShifts.Save();
                }
            }
        }