Ejemplo n.º 1
0
        /// <summary>
        /// Validates Form Fields data
        /// </summary>
        /// <returns>If Validation succed, returns True. If not, returns false.</returns>
        private bool ValidatedFields()
        {
            var ctrlTextBoxes2 = LocalUtils.GetAll(pageProductDetail, typeof(BunifuTextBox))
                                 .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);

            foreach (BunifuTextBox item in ctrlTextBoxes2)
            {
                if (item.Text == string.Empty)
                {
                    LocalUtils.ShowValidationFailedMessage(this);
                    return(false);
                }
            }
            var ctrlDropdown = LocalUtils.GetAll(pageProductDetail, typeof(Bunifu.UI.WinForms.BunifuDropdown))
                               .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);

            foreach (Bunifu.UI.WinForms.BunifuDropdown item in ctrlDropdown)
            {
                if (item.SelectedIndex < 0)
                {
                    item.Focus();
                    LocalUtils.ShowValidationFailedMessage(this);
                    return(false);
                }
            }

            return(true);
        }
        private bool ValidatedFields()
        {
            var ctrlTextBoxes2 = LocalUtils.GetAll(tabSupplierDetail, typeof(BunifuTextBox))
                                 .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);

            foreach (BunifuTextBox item in ctrlTextBoxes2)
            {
                if (item.Text == string.Empty)
                {
                    item.Focus();
                    LocalUtils.ShowValidationFailedMessage(this);
                    return(false);
                }
            }

            var ctrlDropdown = LocalUtils.GetAll(tabSupplierDetail, typeof(Bunifu.UI.WinForms.BunifuDropdown))
                               .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);

            foreach (Bunifu.UI.WinForms.BunifuDropdown item in ctrlDropdown)
            {
                if (item.SelectedIndex < 0)
                {
                    item.Focus();
                    MetroMessageBox.Show(this, string.Format("Empty field {0 }", item.Tag), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
        private void AddHandlers()
        {
            var flatButtons = LocalUtils.GetAll(this, typeof(BunifuFlatButton))
                              .OrderBy(c => c.TabIndex);

            foreach (BunifuFlatButton item in flatButtons)
            {
                item.Click += flatButton_OnSetFormTitle;
            }
            var textboxes = LocalUtils.GetAll(this, typeof(BunifuTextBox))
                            .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);

            foreach (BunifuTextBox item in textboxes)
            {
                if (item.Tag != null)
                {
                    if (item.Tag.ToString().Contains("integer"))
                    {
                        item.TextChange += item_IntCheckTextChange;
                    }
                    else if (item.Tag.ToString().Contains("double"))
                    {
                        item.TextChange += item_DoubleCheckTextChange;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void AddHandlers()
        {
            var textboxes = LocalUtils.GetAll(this, typeof(BunifuTextBox))
                            .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);

            foreach (BunifuTextBox item in textboxes)
            {
                if (item.Tag != null)
                {
                    if (item.Tag.ToString().Contains("integer") || item.Tag.ToString().Contains("double"))
                    {
                        item.KeyPress += textBox_keyPress;
                    }
                }
            }
            //We get all textboxes with tag compute to compute textbox value
            // after text change event fires
            var computeTextBoxes = LocalUtils.GetAll(this, typeof(BunifuTextBox))
                                   .Where(c => c.Tag.ToString().Contains("compute")).OrderBy(c => c.TabIndex);

            foreach (BunifuTextBox item in computeTextBoxes)
            {
                item.TextChange += item_TextChange;
            }
        }
Ejemplo n.º 5
0
        private void ResetInputs()
        {
            var controls = LocalUtils.GetAll(pageUpdateProduction, typeof(BunifuTextBox));

            foreach (BunifuTextBox item in controls)
            {
                item.Text = string.Empty;
            }
        }
Ejemplo n.º 6
0
        private void ResetInputs()
        {
            var controls = LocalUtils.GetAll(pnlAddEdit, typeof(BunifuTextBox));

            foreach (BunifuTextBox item in controls)
            {
                item.Text = string.Empty;
            }
        }
Ejemplo n.º 7
0
        private void AddHandlers()
        {
            var flatButtons = LocalUtils.GetAll(this, typeof(BunifuFlatButton))
                              .OrderBy(c => c.TabIndex);

            foreach (BunifuFlatButton item in flatButtons)
            {
                item.IconVisible = true;
            }
        }
Ejemplo n.º 8
0
        private void ResetInputs()
        {
            var textboxes = LocalUtils.GetAll(pnlMainData, typeof(BunifuTextBox));

            foreach (BunifuTextBox item in textboxes)
            {
                item.Text = string.Empty;
            }
            var comboboxes = LocalUtils.GetAll(pnlMainData, typeof(BunifuDropdown));

            foreach (BunifuDropdown item in comboboxes)
            {
                item.Text = string.Empty;
            }
        }
Ejemplo n.º 9
0
        private void AddHandlers()
        {
            var textboxes = LocalUtils.GetAll(pnlAddEdit, typeof(BunifuTextBox))
                            .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);

            foreach (BunifuTextBox item in textboxes)
            {
                if (item.Tag != null)
                {
                    if (item.Tag.ToString().Contains("integer") || item.Tag.ToString().Contains("double"))
                    {
                        item.KeyPress += textBox_keyPress;
                    }
                }
            }
        }
Ejemplo n.º 10
0
        private void AddHandlers()
        {
            // Use to automatically add text change validation on special type inputs like int, double etc value
            var textboxes = LocalUtils.GetAll(this, typeof(BunifuTextBox))
                            .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);

            foreach (BunifuTextBox item in textboxes)
            {
                if (item.Tag != null)
                {
                    if (item.Tag.ToString().Contains("integer") || item.Tag.ToString().Contains("double"))
                    {
                        item.KeyPress += textBox_keyPress;
                    }
                }
            }
        }
Ejemplo n.º 11
0
        private void ResetInputs(Control parent)
        {
            var textboxes   = LocalUtils.GetAll(parent, typeof(BunifuTextBox));
            var dropdowns   = LocalUtils.GetAll(parent, typeof(BunifuDropdown));
            var datepickers = LocalUtils.GetAll(parent, typeof(BunifuDatePicker));

            foreach (BunifuTextBox item in textboxes)
            {
                item.Text = string.Empty;
            }
            foreach (BunifuDropdown item in dropdowns)
            {
                item.Text = string.Empty;
            }
            foreach (BunifuDatePicker item in datepickers)
            {
                item.Value = DateTime.Now;
            }
        }
Ejemplo n.º 12
0
        private void AddHandlers()
        {
            // fires checked events when
            var radios = LocalUtils.GetAll(this, typeof(BunifuRadioButton))
                         .OrderBy(c => c.TabIndex);

            foreach (BunifuRadioButton item in radios)
            {
                item.CheckedChanged += radio_CheckedChanged;
            }
            // fires checked events when
            var dates = LocalUtils.GetAll(this, typeof(BunifuDatePicker))
                        .OrderBy(c => c.TabIndex);

            foreach (BunifuDatePicker item in dates)
            {
                item.ValueChanged += dates_ValueChanged;
            }
            //var textboxes = LocalUtils.GetAll(this, typeof(BunifuTextBox))
            //         .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);
            //foreach (BunifuTextBox item in textboxes)
            //{
            //    if (item.Tag != null)
            //    {


            //        if (item.Tag.ToString().Contains("integer") || item.Tag.ToString().Contains("double"))
            //        {
            //            item.KeyPress += textBox_keyPress;
            //        }


            //    }
            //}
            ////We get all textboxes with tag compute to compute textbox value
            //// after text change event fires
            //var computeTextBoxes = LocalUtils.GetAll(this, typeof(BunifuTextBox))
            //        .Where(c => c.Tag.ToString().Contains("compute")).OrderBy(c => c.TabIndex);
            //foreach (BunifuTextBox item in computeTextBoxes)
            //{
            //    item.TextChange += item_TextChange;
            //}
        }
        void AddToolTipToFields()
        {
            var ctrlTextBoxes2 = LocalUtils.GetAll(pnlContents, typeof(MyTextBox))
                                 .OrderBy(c => c.TabIndex);

            foreach (MyTextBox item in ctrlTextBoxes2)
            {
                bunifuToolTip1.SetToolTip(item, item.ToolTipText);
            }



            var ctrlDropdown = LocalUtils.GetAll(pnlContents, typeof(Bunifu.UI.WinForms.BunifuDropdown))
                               .OrderBy(c => c.TabIndex);

            foreach (Bunifu.UI.WinForms.BunifuDropdown item in ctrlDropdown)
            {
                bunifuToolTip1.SetToolTip(item, item.Tag.ToString());
            }
        }
Ejemplo n.º 14
0
        public void ResetInputs()
        {
            var textboxes = LocalUtils.GetAll(pageDetail, typeof(BunifuTextBox));

            foreach (BunifuTextBox item in textboxes)
            {
                item.Text = string.Empty;
            }
            var comboboxes = LocalUtils.GetAll(pageDetail, typeof(BunifuDropdown));

            foreach (BunifuDropdown item in comboboxes)
            {
                item.Text = string.Empty;
            }
            var chks = LocalUtils.GetAll(pageDetail, typeof(BunifuCheckBox));

            foreach (BunifuCheckBox item in chks)
            {
                item.Checked = false;
            }
        }
Ejemplo n.º 15
0
        private void AddHandlers()
        {
            var textboxes = LocalUtils.GetAll(pnlAddEdit, typeof(BunifuTextBox))
                            .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);

            foreach (BunifuTextBox item in textboxes)
            {
                if (item.Tag != null)
                {
                    if (item.Tag.ToString().Contains("integer"))
                    {
                        item.TextChange += item_IntCheckTextChange;
                    }
                    else
                    if (item.Tag.ToString().Contains("double"))
                    {
                        item.TextChange += item_DoubleCheckTextChange;
                    }
                }
            }
        }
Ejemplo n.º 16
0
        private void ResetInputs()
        {
            var controls = LocalUtils.GetAll(pnlAddEdit, typeof(BunifuTextBox));

            foreach (BunifuTextBox item in controls)
            {
                item.Text = string.Empty;
            }
            var dropdowns = LocalUtils.GetAll(pnlAddEdit, typeof(BunifuDropdown));

            foreach (BunifuDropdown item in dropdowns)
            {
                item.Text = string.Empty;
            }
            var datepickers = LocalUtils.GetAll(pnlAddEdit, typeof(BunifuDatePicker));

            foreach (BunifuDatePicker item in datepickers)
            {
                item.Value = DateTime.Now;
            }
        }
Ejemplo n.º 17
0
        private void AddHandlers()
        {
            var controls = LocalUtils.GetAll(this, typeof(MyTextBox));

            foreach (MyTextBox control in controls)
            {
                control.KeyDown += control_KeyDown;
                control.Enter   += control_Enter;

                if (control.Tag != null)
                {
                    if (control.Tag.ToString().Contains("int"))
                    {
                        control.TextChange += item_IntCheckTextChange;
                    }
                    else if (control.Tag.ToString().Contains("double"))
                    {
                        control.TextChange += item_DoubleCheckTextChange;
                    }
                }
            }
        }
Ejemplo n.º 18
0
        private void ResetInputs()
        {
            var textboxes = LocalUtils.GetAll(pageProductDetail, typeof(BunifuTextBox));

            foreach (BunifuTextBox item in textboxes)
            {
                item.Text = string.Empty;
            }
            var comboboxes = LocalUtils.GetAll(pageProductDetail, typeof(Bunifu.UI.WinForms.BunifuDropdown));

            foreach (Bunifu.UI.WinForms.BunifuDropdown item in comboboxes)
            {
                item.SelectedIndex = -1;
                item.Enabled       = true;
            }
            var dates = LocalUtils.GetAll(pageProductDetail, typeof(BunifuDatepicker));

            foreach (BunifuDatepicker item in dates)
            {
                item.Value = DateTime.UtcNow;
            }
        }
Ejemplo n.º 19
0
        private bool ValidateFields(Control parent)
        {
            var textboxes = LocalUtils.GetAll(parent, typeof(BunifuTextBox))
                            .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);
            var dropdowns = LocalUtils.GetAll(parent, typeof(BunifuDropdown))
                            .Where(c => c.CausesValidation == true).OrderBy(c => c.TabIndex);

            foreach (BunifuTextBox item in textboxes)
            {
                if (item.Text == string.Empty)
                {
                    return(false);
                }
            }
            foreach (BunifuDropdown item in dropdowns)
            {
                if (item.Text == string.Empty)
                {
                    return(false);
                }
            }
            return(true);
        }