private void DgResultsMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var source = (DependencyObject)e.OriginalSource;
            var row    = source.TryFindParent <DataGridRow>();

            if (row == null)
            {
                return;
            }

            if (!AppContext.CanUpdateProps)
            {
                return;
            }

            if (OnReloading)
            {
                return;
            }

            var prop = (Prop)dgResults.SelectedItem;

            if (prop != null)
            {
                EditMode            = btnCancelChanges.IsEnabled = true;
                btnDelete.IsEnabled = cutTextBox.IsEnabled = false;
                if ((AppContext.CanInsertProps && ChangesHappened) ||
                    (!AppContext.CanInsertProps && EditMode && ChangesHappened))
                {
                    if (Global.SubmitQuestion(this))
                    {
                        BtnSubmitClick(null, null);
                        return;
                    }
                    btnSubmit.IsEnabled = false;
                }

                _current       = prop;
                OnSafeChanging = true;
                cmbNames.Text  = _current.Name;
                cmbCategories.SelectedValue = _current.CategoryID;
                if (_current.PropNo.HasValue)
                {
                    tbPropNo.Text = _current.PropNo.ToString();
                }
                tbSerialNo.Text                 = _current.SerialNo;
                dtpPurchasingDate.Value         = _current.PurchasingDate;
                dtpWarrantyExpirationDate.Value = _current.WarrantyExpirationDate;
                tbDescription.Text              = _current.Description;
                cmbNames.Focus();
                OnSafeChanging = false;
            }
        }
Beispiel #2
0
        private void DgResultsMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var source = (DependencyObject)e.OriginalSource;
            var row    = source.TryFindParent <DataGridRow>();

            if (row == null)
            {
                return;
            }

            if (!AppContext.CanUpdateMaterials)
            {
                return;
            }

            if (OnReloading)
            {
                return;
            }
            var material = (Material)dgResults.SelectedItem;

            if (material != null)
            {
                EditMode            = btnCancelChanges.IsEnabled = true;
                btnDelete.IsEnabled = cutTextBox.IsEnabled = false;
                if ((AppContext.CanInsertMaterials && ChangesHappened) ||
                    (!AppContext.CanInsertMaterials && EditMode && ChangesHappened))
                {
                    if (Global.SubmitQuestion(this))
                    {
                        BtnSubmitClick(null, null);
                        return;
                    }
                    btnSubmit.IsEnabled = false;
                }

                _current       = material;
                OnSafeChanging = true;
                cmbNames.Text  = _current.Name;
                cmbCategories.SelectedValue = _current.CategoryID;
                tbFormula.Text              = _current.Formula;
                tbMolecularMass.Text        = _current.MolecularMass;
                cmbMesureUnit.SelectedIndex = _current.Unit;
                cmbMesureUnit.IsEnabled     = false;
                tbLowestAmount.Text         = _current.LowestAmount.ToString();
                tbDescription.Text          = _current.Description;
                cmbNames.Focus();
                OnSafeChanging = false;
            }
        }
Beispiel #3
0
        private void DgResultsMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var source = (DependencyObject)e.OriginalSource;
            var row    = source.TryFindParent <DataGridRow>();

            if (row == null)
            {
                return;
            }

            if (!AppContext.CanUpdateUsers)
            {
                return;
            }

            if (OnReloading)
            {
                return;
            }
            var user = (User)dgResults.SelectedItem;

            if (user != null)
            {
                EditMode            = btnCancelChanges.IsEnabled = true;
                btnDelete.IsEnabled = cutTextBox.IsEnabled = false;

                if ((AppContext.CanInsertUsers && ChangesHappened) ||
                    (!AppContext.CanInsertUsers && EditMode && ChangesHappened))
                {
                    if (Global.SubmitQuestion(this))
                    {
                        BtnSubmitClick(null, null);
                        return;
                    }
                    btnSubmit.IsEnabled = false;
                }

                _current               = user;
                OnSafeChanging         = true;
                tbUserName.Text        = _current.UserName;
                tbUserName.IsEnabled   = false;
                cmbRoles.SelectedValue = _current.RoleID;
                chbLockedOut.IsChecked = _current.LockedOut;
                tbDescription.Text     = _current.Description;
                pbPassword.Password    = pbConfirmPassword.Password = _current.Password;
                pbPassword.FocusAndSelect();
                OnSafeChanging = false;
            }
        }
Beispiel #4
0
        private void DgResultsMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var source = (DependencyObject)e.OriginalSource;
            var row    = source.TryFindParent <DataGridRow>();

            if (row == null)
            {
                return;
            }

            if (!AppContext.CanUpdateLabs)
            {
                return;
            }

            if (OnReloading)
            {
                return;
            }
            var lab = (Lab)dgResults.SelectedItem;

            if (lab != null)
            {
                EditMode            = btnCancelChanges.IsEnabled = true;
                btnDelete.IsEnabled = cutTextBox.IsEnabled = false;

                if ((AppContext.CanInsertLabs && ChangesHappened) ||
                    (!AppContext.CanInsertLabs && EditMode && ChangesHappened))
                {
                    if (Global.SubmitQuestion(this))
                    {
                        BtnSubmitClick(null, null);
                        return;
                    }
                    btnSubmit.IsEnabled = false;
                }

                _current       = lab;
                OnSafeChanging = true;
                tbName.Text    = _current.Name;
                cmbCategories.SelectedValue = _current.CategoryID;
                tbPlaqueNo.Text             = _current.PlaqueNo.ToString();
                tbDescription.Text          = _current.Description;
                tbName.FocusAndSelect();
                OnSafeChanging = false;
            }
        }
Beispiel #5
0
        private void DgvResultsMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var source = (DependencyObject)e.OriginalSource;
            var row    = source.TryFindParent <DataGridRow>();

            if (row == null)
            {
                return;
            }

            if (!AppContext.CanUpdateRoles)
            {
                return;
            }

            if (OnReloading)
            {
                return;
            }
            var role = (Role)dgvResults.SelectedItem;

            if (role != null)
            {
                EditMode            = btnCancelChanges.IsEnabled = true;
                btnDelete.IsEnabled = cutTextBox.IsEnabled = false;

                if ((AppContext.CanInsertRoles && ChangesHappened) ||
                    (!AppContext.CanInsertRoles && EditMode && ChangesHappened))
                {
                    if (Global.SubmitQuestion(this))
                    {
                        BtnSubmitClick(null, null);
                        return;
                    }
                    btnSubmit.IsEnabled = false;
                }

                _current           = role;
                OnSafeChanging     = true;
                tbName.Text        = _current.Name;
                tbDescription.Text = _current.Description;

                chbCategoriesDisplay.IsChecked = _current.CategoriesDisplay;
                chbCategoriesInsert.IsChecked  = _current.CategoriesInsert;
                chbCategoriesUpdate.IsChecked  = _current.CategoriesUpdate;
                chbCategoriesDelete.IsChecked  = _current.CategoriesDelete;

                chbPropsDisplay.IsChecked = _current.PropsDisplay;
                chbPropsInsert.IsChecked  = _current.PropsInsert;
                chbPropsUpdate.IsChecked  = _current.PropsUpdate;
                chbPropsDelete.IsChecked  = _current.PropsDelete;

                chbPropStatusDisplay.IsChecked = _current.PropStatusDisplay;
                chbPropStatusUpdate.IsChecked  = _current.PropStatusUpdate;

                chbMaterialsDisplay.IsChecked = _current.MaterialsDisplay;
                chbMaterialsInsert.IsChecked  = _current.MaterialsInsert;
                chbMaterialsUpdate.IsChecked  = _current.MaterialsUpdate;
                chbMaterialsDelete.IsChecked  = _current.MaterialsDelete;

                chbItemsDisplay.IsChecked = _current.ItemsDisplay;
                chbItemsInsert.IsChecked  = _current.ItemsInsert;
                chbItemsUpdate.IsChecked  = _current.ItemsUpdate;
                chbItemsDelete.IsChecked  = _current.ItemsDelete;

                chbRepositoryMaterialsAndItemsInsert.IsChecked = _current.RepositoryMaterialsAndItemsInsert;
                chbRepositoryMaterialsAndItemsDelete.IsChecked = _current.RepositoryMaterialsAndItemsDelete;

                chbLabsDisplay.IsChecked = _current.LabsDisplay;
                chbLabsInsert.IsChecked  = _current.LabsInsert;
                chbLabsUpdate.IsChecked  = _current.LabsUpdate;
                chbLabsDelete.IsChecked  = _current.LabsDelete;

                chbLabPropsDisplay.IsChecked = _current.LabPropsDisplay;
                chbLabPropsInsert.IsChecked  = _current.LabPropsInsert;
                chbLabPropsDelete.IsChecked  = _current.LabPropsDelete;

                chbUsersDisplay.IsChecked = _current.UsersDisplay;
                chbUsersInsert.IsChecked  = _current.UsersInsert;
                chbUsersUpdate.IsChecked  = _current.UsersUpdate;
                chbUsersDelete.IsChecked  = _current.UsersDelete;

                chbSearchDisplay.IsChecked             = _current.SearchDisplay;
                chbPropsSearch.IsChecked               = _current.PropsSearch;
                chbMaterialsSearch.IsChecked           = _current.MaterialsSearch;
                chbItemsSearch.IsChecked               = _current.ItemsSearch;
                chbRepositoryMaterialsSearch.IsChecked = _current.RepositoryMaterialsSearch;
                chbRepositoryItemsSearch.IsChecked     = _current.RepositoryItemsSearch;
                chbLabsSearch.IsChecked     = _current.LabsSearch;
                chbLabPropsSearch.IsChecked = _current.LabPropsSearch;
                chbLogsSearch.IsChecked     = _current.LogsSearch;

                chbRolesDisplay.IsChecked = _current.RolesDisplay;
                chbRolesInsert.IsChecked  = _current.RolesInsert;
                chbRolesUpdate.IsChecked  = _current.RolesUpdate;
                chbRolesDelete.IsChecked  = _current.RolesDelete;

                chbLogsDisplay.IsChecked = _current.LogsDisplay;
                chbLogsDelete.IsChecked  = _current.LogsDelete;

                tbName.FocusAndSelect();
                OnSafeChanging = false;
            }
        }