示例#1
0
        private void OnAdd()
        {
            var win = new ManualAddWindow();

            win.ShowDialog();

            Manuals = _mSrv.GetManuals();
            if (Manuals.Count != 0)
            {
                SelManual = Manuals.First();
            }
        }
示例#2
0
        public ManualViewModel(IMapper mapper, Fanuc fanuc, ManualService mSrv)
        {
            this._fanuc  = fanuc;
            this._mapper = mapper;
            this._mSrv   = mSrv;

            _AddCmd    = new RelayCommand(OnAdd);
            _DeleteCmd = new RelayCommand(OnDelete);
            _OpenCmd   = new RelayCommand(OnOpen);

            Manuals = _mSrv.GetManuals();
            if (Manuals.Count != 0)
            {
                SelManual = Manuals.First();
            }
        }
示例#3
0
        public void Delete(ManualDto dto)
        {
            try
            {
                using (var scope = new LaserEngineDBEntities())
                {
                    var list = scope.ManualInfo.Where(x => x.Id == dto.Id).ToList();
                    scope.ManualInfo.RemoveRange(list);


                    scope.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        public void Add(ManualDto dto)
        {
            try
            {
                using (var scope = new LaserEngineDBEntities())
                {
                    var list = scope.ManualInfo.Add(new ManualInfo()
                    {
                        Id            = BaseIdGenerator.Instance.GetId(),
                        Path          = dto.Path,
                        Name          = dto.Name,
                        Specification = dto.Specification,
                        Version       = dto.Version
                    });


                    scope.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        private void OnDelete()
        {
            if (SelManual == null)
            {
                Messenger.Default.Send <string>("请选择说明书", "OperateNotice");
                return;
            }

            try
            {
                _mSrv.Delete(SelManual);
            }
            catch (Exception ex)
            {
                Messenger.Default.Send <string>("删除说明书失败", "OperateNotice");
            }


            Manuals = _mSrv.GetManuals();
            if (Manuals.Count != 0)
            {
                SelManual = Manuals.First();
            }
        }