Пример #1
0
 public RequestsViewModel(IRequestView view, IBusinessLogic logic, Employee currentUser)
 {
     this._businessLogic = logic;
     this._view          = view;
     this._view.SetViewModel(this);
     this.CurrentUser = currentUser;
     try
     {
         Config();
     }
     catch (Exception ex)
     {
         _view.Alert(ex.Message, "Error");
     }
 }
Пример #2
0
        /// <summary>
        /// Initializes and shows a new instance of <see cref="RequestView"/>
        /// </summary>
        public void AddRequest()
        {
            // create new AddRequestView form
            if (this.addRequestView == null || this.addRequestView.RequestForm.IsDisposed)
            {
                this.addRequestView = new AddRequestView();
            }
            this.SubscribeToEvents();

            // show RequestView form

            this.addRequestView.RequestForm.Show();

            // disable user interaction with MainView form until AddRequestView form is closed
            this.mainView.MainForm.Enabled = false;
        }
        public void EditRequest(DataGridViewRow r)
        {
            // create new EditRequestView form
            if (this.editRequestView == null || this.editRequestView.RequestForm.IsDisposed)
            {
                this.editRequestView = new EditRequestView();
                Console.WriteLine("this");
            }

            this.SubscribeToEvents();
            this.GetValuesFromDgvRow(r);

            // show RequestView form
            this.editRequestView.RequestForm.Show();

            // disable user interaction with MainView form until AddRequestView form is closed
            this.mainView.MainForm.Enabled = false;
        }