private void Query_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Domain.Configuration.FormPage formPage = new Domain.Configuration.FormPage();
                formPage.FormPageCode = txtQueryFormPageCode.Text;
                formPage.FormPageName = txtQueryFormPageName.Text;

                List <FormPageView> lstFormPage = GlobalFacade.ConfigurationFacade.GetFormPageList(formPage).ToList();

                dgQuery.ItemsSource = lstFormPage;
            }
            catch (Exception ex)
            {
                //LogHelper.LogMsg("btnLogin_Click>>" + ex.Message, true);
            }
        }
        private void btnSubmitEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                formPageEdit = VerifyData(OperationType.Edit);

                if (formPageEdit == null)
                {
                    return;
                }

                bool blAddResult = GlobalFacade.ConfigurationFacade.UpdateSingleFormPage(formPageEdit);
            }
            catch (Exception excp)
            {
            }
        }
        private void btnSubmitAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Domain.Configuration.FormPage formPageAdd = new Domain.Configuration.FormPage();
                formPageAdd = VerifyData(OperationType.Add);

                if (formPageAdd == null)
                {
                    return;
                }

                bool blAddResult = GlobalFacade.ConfigurationFacade.InsertSingleFormPage(formPageAdd);
            }
            catch (Exception excp)
            {
            }
        }
        private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (this.dgQuery.SelectedIndex == -1)
            {
                return;
            }

            FormPageView formPageSelect = dgQuery.Items[dgQuery.SelectedIndex] as FormPageView;

            if (formPageSelect == null)
            {
                return;
            }

            formPageEdit                   = new Domain.Configuration.FormPage();
            formPageEdit.FPID              = formPageSelect.FPID;
            formPageEdit.FormPageCode      = formPageSelect.FormPageCode;
            formPageEdit.FormPageName      = formPageSelect.FormPageName;
            formPageEdit.FormPageParameter = formPageSelect.FormPageParameter;
            formPageEdit.FormPageRoute     = formPageSelect.FormPageRoute;
            formPageEdit.Sequence          = formPageSelect.Sequence;
            formPageEdit.Description       = formPageSelect.Description;
            formPageEdit.CreatedUser       = formPageSelect.CreatedUserGuid;
            formPageEdit.CreatedTime       = formPageSelect.CreatedTime;
            formPageEdit.Disable           = formPageSelect.Disable;

            //tbMainContent.SelectedItem = tbiEdit;

            txtFormPageCodeEdit.Text      = formPageEdit.FormPageCode;
            txtFormPageNameEdit.Text      = formPageEdit.FormPageName;
            txtFormPageParameterEdit.Text = formPageEdit.FormPageParameter;
            txtFormPageRouteEdit.Text     = formPageEdit.FormPageRoute;
            txtSequenceEdit.Text          = formPageEdit.Sequence.ToString();
            txtDescriptionEdit.Text       = formPageEdit.Description;
            cbDisableEdit.IsChecked       = formPageEdit.Disable;

            tbMainContent.SelectedItem = tbiEdit;
        }
        private FormPage VerifyData(OperationType operationType)
        {
            Domain.Configuration.FormPage formPage = new Domain.Configuration.FormPage();
            if (operationType == OperationType.Add)
            {
                if (txtFormPageCodeAdd.Text.IsNullOrEmptyOrWhiteSpace())
                {
                    return(null);
                }
                if (txtFormPageNameAdd.Text.IsNullOrEmptyOrWhiteSpace())
                {
                    return(null);
                }
                if (txtFormPageRouteAdd.Text.IsNullOrEmptyOrWhiteSpace())
                {
                    return(null);
                }
                //if (txtFormPageParameterAdd.Text.IsNullOrEmptyOrWhiteSpace())
                //{
                //return;
                //}
                if (txtSequenceAdd.Text.IsNullOrEmptyOrWhiteSpace())
                {
                    return(null);
                }

                formPage.FPID              = Guid.NewGuid();
                formPage.FormPageCode      = txtFormPageCodeAdd.Text;
                formPage.FormPageName      = txtFormPageNameAdd.Text;
                formPage.FormPageRoute     = txtFormPageRouteAdd.Text;
                formPage.FormPageParameter = txtFormPageParameterAdd.Text;
                formPage.Sequence          = Int32.Parse(txtSequenceAdd.Text);
                formPage.Description       = txtDescriptionAdd.Text;
                formPage.Disable           = cbDisableAdd.IsChecked == null ? false : (bool)cbDisableAdd.IsChecked;
                formPage.CreatedUser       = GlobalVariable.UserEntity.UID;
                formPage.CreatedTime       = DateTime.Now;
            }
            else
            {
                if (formPageEdit == null)
                {
                    return(null);
                }

                if (txtFormPageCodeEdit.Text.IsNullOrEmptyOrWhiteSpace())
                {
                    return(null);
                }
                if (txtFormPageNameEdit.Text.IsNullOrEmptyOrWhiteSpace())
                {
                    return(null);
                }
                if (txtFormPageRouteEdit.Text.IsNullOrEmptyOrWhiteSpace())
                {
                    return(null);
                }
                //if (txtFormPageParameterEdit.Text.IsNullOrEmptyOrWhiteSpace())
                //{
                //return;
                //}
                if (txtSequenceEdit.Text.IsNullOrEmptyOrWhiteSpace())
                {
                    return(null);
                }

                formPage.FPID              = formPageEdit.FPID;
                formPage.FormPageCode      = txtFormPageCodeEdit.Text;
                formPage.FormPageName      = txtFormPageNameEdit.Text;
                formPage.FormPageRoute     = txtFormPageRouteEdit.Text;
                formPage.FormPageParameter = txtFormPageParameterEdit.Text;
                formPage.Sequence          = Int32.Parse(txtSequenceEdit.Text);
                formPage.Description       = txtDescriptionEdit.Text;
                formPage.Disable           = cbDisableEdit.IsChecked == null ? false : (bool)cbDisableEdit.IsChecked;
                formPage.CreatedUser       = formPageEdit.CreatedUser;
                formPage.CreatedTime       = formPageEdit.CreatedTime;
                formPage.ModifiedUser      = GlobalVariable.UserEntity.UID;
                formPage.ModifiedTime      = DateTime.Now;
            }

            return(formPage);
        }