Beispiel #1
0
        public static void ShowKeyExist(Label lbl, UTextBox 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);
        }
        private void txtChequeNo_GotFocus(object sender, RoutedEventArgs e)
        {
            if (doc.ChequeID.Equals(""))
            {
                return;
            }

            UTextBox           txt = sender as UTextBox;
            MAccountDocPayment pmt = (MAccountDocPayment)txt.Tag;

            if (pmt.ChequeID.Equals(doc.ChequeID))
            {
                return;
            }

            MCheque cheq = getChequeByID(doc.ChequeID);

            if (cheq == null)
            {
                pmt.ChequeNo   = "";
                pmt.PaidAmount = "0.00";
                pmt.ChequeID   = "";
                pmt.ChequeNo   = "";
            }
            else
            {
                pmt.ChequeNo   = cheq.ChequeNo;
                pmt.BankID     = cheq.ChequeBankID;
                pmt.PaidAmount = cheq.ChequeAmount;
                pmt.ChequeID   = cheq.ChequeID;
            }
        }
        public WinTextIntellisense(String position, TextBox source, Window win, TextSearchNameSpace ns, MasterRefEnum mrt, Boolean showDetail, UTextBox caller, MBaseModel extParam)
        {
            int offset = 10;

            parentCaller = caller;
            nameSpace    = ns;
            mrType       = mrt;
            isShowDetail = showDetail;
            extraParam   = extParam;

            //https://social.msdn.microsoft.com/Forums/vstudio/en-US/281a8cdd-69a9-4a4a-9fc3-c039119af8ed/absolute-screen-coordinates-of-wpf-user-control?forum=wpf
            Point locationFromScreen = source.PointToScreen(new Point(0, 0));
            PresentationSource s     = PresentationSource.FromVisual(win);
            Point targetPoints       = s.CompositionTarget.TransformFromDevice.Transform(locationFromScreen);

            if (position.Equals("R"))
            {
                tp = targetPoints.Y;
                lf = targetPoints.X + source.ActualWidth + offset;
            }
            else if (position.Equals("B"))
            {
                tp = targetPoints.Y + source.ActualHeight + offset;
                lf = targetPoints.X;
            }

            InitializeComponent();
        }
        private void txtChequeNo_TextSelected(object sender, EventArgs e)
        {
            UTextBox           txt  = sender as UTextBox;
            MAccountDocPayment pmt  = (MAccountDocPayment)txt.Tag;
            String             code = txt.Text;

            MCheque cheq = getCheque(code);

            if (cheq == null)
            {
                pmt.ChequeNo   = "";
                pmt.PaidAmount = "0.00";
                pmt.ChequeID   = "";
            }
            else
            {
                pmt.BankID     = cheq.ChequeBankID;
                pmt.PaidAmount = cheq.ChequeAmount;
                pmt.ChequeID   = cheq.ChequeID;
            }
        }
Beispiel #5
0
        public static Boolean ValidateTextBox(Label lbl, UTextBox 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.Text.Trim().Equals(""))
                {
                    CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    tb.Focus();
                    return(false);
                }
            }

            return(true);
        }