示例#1
0
 // ЗАПЧАСТЬ - РЕДАКТИРОВАТЬ
 public void SpareEdit(int SpareID)
 {
     if (!ready())
         return;
     SpareEditView v = new SpareEditView();
     v.ParentWorkspace = mainWindowObj;
     v.LoadItem(SpareID);
     bool? res = v.ShowDialog();
     if (v._spare != null)
     {
         MainWindowObj.LoadSpares();
         MainWindowObj.dgSpares.SelectedItem = SpareContainer.Instance.Spares.FirstOrDefault(x => x.id == SpareID);
     }
 }
示例#2
0
        // ЗАПЧАСТЬ - ДОБАВИТЬ
        public SpareView SpareCreate()
        {
            if (!ready())
                return null;// null;
            SpareView result = null;

            SpareEditView v = new SpareEditView();
            v._id = -1;
            v.ParentWorkspace = mainWindowObj;
            v.ShowDialog();
            if (v._spare != null)
            {
                DataAccess db = new DataAccess();
                result = db.GetSpareView(v._spare.id);

                mainWindowObj.LoadSpares();
                mainWindowObj.LoadGroups(false);
            }
            return result;
        }