Пример #1
0
        public static void ShowKeyExist(Label lbl, ComboBox tb)
        {
            String str = CLanguage.getValue("ERROR_DUPLICATE_KEY");
            String fmt = String.Format(str, lbl.Content, tb.Text);

            CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
        }
Пример #2
0
        public static Boolean VerifyVersion()
        {
            String api  = CConfig.APIVersion;
            String prog = CConfig.Version;

            String[] apibuilt  = api.Split('-');
            String[] progbuilt = prog.Split('-');

            String str     = CLanguage.getValue("version_mismatch");
            String strwarn = CLanguage.getValue("version_mismatch_warn");
            String fmt     = String.Format(str, api, prog);
            String fmtwarn = String.Format(strwarn, api, prog);

            if (!apibuilt[0].Equals(progbuilt[0]))
            {
                if (progbuilt[0].Equals("$ONIX_BUILD_LABEL_VAR$"))
                {
                    //Run from source code is allow for version mismatch for the sake of debugging

                    CMessageBox.Show(fmtwarn, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    return(true);
                }

                CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                return(false);
            }

            return(true);
        }
Пример #3
0
        public static Boolean ValidateComboBox(Label lbl, UComboBox cb, Boolean AllowEmpty)
        {
            String lb = "";

            if (lbl != null)
            {
                lb = lbl.Content.ToString();
            }

            String str = CLanguage.getValue("ERROR_TEXT_VALIDATE");
            String fmt = String.Format(str, lbl.Content);

            if (cb.IsEnabled)
            {
                if (AllowEmpty)
                {
                    return(true);
                }

                if ((cb.SelectedObject == null) || (cb.IsEmpty()))
                {
                    CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    cb.Focus();
                    return(false);
                }
            }

            return(true);
        }
Пример #4
0
        public static void ShowErorMessage(String msg, String errcd, CTable param)
        {
            String str = CLanguage.getValue(errcd);
            String fmt = String.Format(str, msg);

            CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
        }
Пример #5
0
        public static Boolean AskConfirmSave()
        {
            String           str    = CLanguage.getValue("CONFIRM_SAVE");
            MessageBoxResult result = CMessageBox.Show(str, "CONFIRM", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                return(true);
            }

            return(false);
        }
Пример #6
0
        public static Boolean AskConfirmDelete(int cnt)
        {
            String           str    = CLanguage.getValue("CONFIRM_DELETE");
            String           msg    = String.Format(str, cnt);
            MessageBoxResult result = CMessageBox.Show(msg, "CONFIRM", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                return(true);
            }

            return(false);
        }
Пример #7
0
        public static Boolean AskConfirmMessage(String param, String cd)
        {
            String str = CLanguage.getValue(cd);
            String msg = String.Format(str, param);

            MessageBoxResult result = CMessageBox.Show(msg, "CONFIRM", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                return(true);
            }

            return(false);
        }
Пример #8
0
        public static Boolean VerifyAccessRight(String permName)
        {
            Boolean flag = CAccessValidator.VerifyAccessRight(permName);

            if (flag)
            {
                return(true);
            }

            String str = CLanguage.getValue("ERROR_VERIFY_ACCESS");
            String fmt = String.Format(str, "");

            CMessageBox.Show(fmt, permName, MessageBoxButton.OK, MessageBoxImage.Error);

            return(false);
        }
Пример #9
0
        public static Boolean ValidateConfirmPassword(Label lbl, PasswordBox tb, Label clbl, PasswordBox ctb)
        {
            String str = CLanguage.getValue("ERROR_PASSWORD_VALIDATE");
            String fmt = String.Format(str, lbl.Content, clbl.Content);

            if (tb.IsEnabled)
            {
                if (!tb.Password.Equals(ctb.Password))
                {
                    CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    tb.Focus();
                    return(false);
                }
            }

            return(true);
        }
Пример #10
0
        public static Boolean ValidateTextBoxEscape(Label lbl, TextBox tb, String esc)
        {
            String str = CLanguage.getValue("ERROR_TEXT_ESCAPE");
            String fmt = String.Format(str, esc);

            if (tb.IsEnabled)
            {
                if (tb.Text.Trim().Contains(esc))
                {
                    CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    tb.Focus();
                    return(false);
                }
            }

            return(true);
        }
Пример #11
0
        public static Boolean ValidateTextBox(Label lbl, TextBox tb, Boolean AllowEmpty, InputDataType dt)
        {
            String str = CLanguage.getValue("ERROR_TEXT_VALIDATE");
            String fmt = String.Format(str, lbl.Content);

            if (tb.IsEnabled)
            {
                if (AllowEmpty)
                {
                    return(true);
                }

                if (tb.Text.Trim().Equals(""))
                {
                    CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    tb.Focus();
                    return(false);
                }

                Regex regex = null;
                if (dt == InputDataType.InputTypeZeroPossitiveDecimal)
                {
                    regex = new Regex(@"^\d+(\.\d{1,2})?$");
                }
                else if (dt == InputDataType.InputTypeZeroPossitiveInt)
                {
                    regex = new Regex(@"^\d+$");
                }

                Boolean result = regex.IsMatch(tb.Text);
                if (!result)
                {
                    CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    tb.Focus();
                    return(false);
                }
            }

            return(true);
        }
Пример #12
0
        public static Boolean ValidatePasswordBox(Label lbl, PasswordBox tb, Boolean AllowEmpty)
        {
            String str = CLanguage.getValue("ERROR_TEXT_VALIDATE");
            String fmt = String.Format(str, lbl.Content);

            if (tb.IsEnabled)
            {
                if (AllowEmpty)
                {
                    return(true);
                }

                if (tb.Password.Trim().Equals(""))
                {
                    CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    tb.Focus();
                    return(false);
                }
            }

            return(true);
        }
Пример #13
0
        public static Boolean ValidateLookup(Label lbl, ULookupSearch2 ulk, Boolean AllowEmpty)
        {
            String str = CLanguage.getValue("ERROR_TEXT_VALIDATE");
            String fmt = String.Format(str, lbl.Content);

            if (ulk.IsEnabled)
            {
                if (AllowEmpty)
                {
                    return(true);
                }

                if (ulk.IsEmpty())
                {
                    CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    ulk.Focus();
                    return(false);
                }
            }

            return(true);
        }
Пример #14
0
        private static Boolean ValidateComboBox(String strMsg, Label lbl, ComboBox cb, Boolean AllowEmpty)
        {
            String lb = "";

            if (lbl != null)
            {
                lb = lbl.Content.ToString();
            }

            String str = CLanguage.getValue("ERROR_TEXT_VALIDATE");
            String fmt = "";

            if (!lb.Equals(""))
            {
                fmt = String.Format(str, lbl.Content);
            }
            else if (!strMsg.Equals(""))
            {
                fmt = String.Format(str, strMsg);
            }

            if (cb.IsEnabled)
            {
                if (AllowEmpty)
                {
                    return(true);
                }

                if (cb.Text.Trim().Equals(""))
                {
                    CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    cb.Focus();
                    return(false);
                }
            }

            return(true);
        }