Ejemplo n.º 1
0
        public bool validate_os()
        {
            bool exname, type, st;

            try
            {
                Buisness_Logic.validation val1 = new Buisness_Logic.validation();
                //Year
                if (!val1.IsNumeric(txtos_year.Text) && string.IsNullOrWhiteSpace(txtos_year.Text))
                {
                    this.errorProvider1.SetError(txtos_year, " Year is invalid.");
                    exname = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtos_year, (string)null);
                    exname = true;
                }

                //month
                if (cmbFin3Month.SelectedIndex.Equals(-1))
                {
                    this.errorProvider1.SetError(cmbFin3Month, "Month is not selected.");
                    type = false;
                }
                else
                {
                    this.errorProvider1.SetError(cmbFin3Month, (string)null);
                    type = true;
                }


                //service type
                if (cmbFin3_serviceType.SelectedIndex.Equals(-1))
                {
                    this.errorProvider1.SetError(cmbFin3_serviceType, "Service type is not selected.");
                    st = false;
                }
                else
                {
                    this.errorProvider1.SetError(cmbFin3_serviceType, (string)null);
                    st = true;
                }
            }
            catch (Exception fd)
            {
                throw;
            }

            if (type == true && exname == true && st == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        private bool validateRepItem_search()
        {
            Buisness_Logic.validation valp = new Buisness_Logic.validation();
            bool name, pid;

            if (string.IsNullOrWhiteSpace(txtEqui_code.Text) && string.IsNullOrWhiteSpace(txtEqui_name.Text))
            {
                MessageBox.Show("Please enter ItemID or Item name  to search inventory.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            else
            {
                //Product name
                if (!valp.IsWord(txtEqui_name.Text) && !string.IsNullOrWhiteSpace(txtEqui_name.Text))
                {
                    this.errorProvider1.SetError(txtEqui_name, "Item name is invalid.");
                    name = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtEqui_name, (string)null);
                    name = true;
                }

                //Produt ID

                if (!valp.IsNumeric(txtEqui_code.Text) && !string.IsNullOrWhiteSpace(txtEqui_code.Text))
                {
                    this.errorProvider1.SetError(txtEqui_code, "Item ID is invalid.");
                    pid = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtEqui_code, (string)null);
                    pid = true;
                }

                //return all

                bool condition = pid == true && name == true;

                if (condition)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 3
0
        private bool validateInvAdd()
        {
            bool make, qty, weight, price, model, name;
            bool weightLiftItem, all;

            Buisness_Logic.validation val = new Buisness_Logic.validation();

            //Inventory product price
            if (!val.isPrice(txtI1_iprice.Text))
            {
                this.errorProvider1.SetError(txtI1_iprice, "Price is invalid.");
                price = false;
            }
            else
            {
                this.errorProvider1.SetError(txtI1_iprice, (string)null);
                price = true;
            }

            //Inventory product name
            if (!val.IsWord(txtI1_iname.Text))
            {
                this.errorProvider1.SetError(txtI1_iname, "Name is invalid.");
                name = false;
            }
            else
            {
                this.errorProvider1.SetError(txtI1_iname, (string)null);
                name = true;
            }

            //model
            if (!val.IsAlphaNumeric(txtI1_imodel.Text))
            {
                this.errorProvider1.SetError(txtI1_imodel, "Model is invalid.");
                model = false;
            }
            else
            {
                this.errorProvider1.SetError(txtI1_imodel, (string)null);
                model = true;
            }
            //make
            if (!val.IsAlphaNumeric(txtI1_imake.Text))
            {
                this.errorProvider1.SetError(txtI1_imake, "Make is invalid.");
                make = false;
            }
            else
            {
                this.errorProvider1.SetError(txtI1_imake, (string)null);
                make = true;
            }

            all = make == true && price == true && name == true && model == true;

            //weight liftin items or non repair items
            if (radio_nonRep.Checked)
            {
                //Inventory product quantity
                if (!val.IsNumeric(txtInv_1qty.Text))
                {
                    this.errorProvider1.SetError(txtInv_1qty, "Quantity is invalid.");
                    qty = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtInv_1qty, (string)null);
                    qty = true;
                }

                //Product weight
                if (!val.IsWeight(txtInv1Weight.Text))
                {
                    this.errorProvider1.SetError(txtInv1Weight, "Weight is invalid.");
                    weight = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtInv1Weight, (string)null);
                    weight = true;
                }
                weightLiftItem = weight == true && qty == true && all;

                if (weightLiftItem == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            if (all == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        private bool validateInvUpdate_weightLifting()
        {
            bool make, qty, weight, price, model, name;
            bool weightLiftItem;

            Buisness_Logic.validation val = new Buisness_Logic.validation();

            //Inventory product price
            if (!val.isPrice(txtwl_price.Text))
            {
                this.errorProvider1.SetError(txtwl_price, "Price is invalid.");
                price = false;
            }
            else
            {
                this.errorProvider1.SetError(txtwl_price, (string)null);
                price = true;
            }

            //Inventory product name
            if (!val.IsWord(txtwl_name.Text))
            {
                this.errorProvider1.SetError(txtwl_name, "Name is invalid.");
                name = false;
            }
            else
            {
                this.errorProvider1.SetError(txtwl_name, (string)null);
                name = true;
            }

            //model
            if (!val.IsAlphaNumeric(txtwl_model.Text))
            {
                this.errorProvider1.SetError(txtwl_model, "Model is invalid.");
                model = false;
            }
            else
            {
                this.errorProvider1.SetError(txtwl_model, (string)null);
                model = true;
            }
            //make
            if (!val.IsAlphaNumeric(txtwl_make.Text))
            {
                this.errorProvider1.SetError(txtwl_make, "Make is invalid.");
                make = false;
            }
            else
            {
                this.errorProvider1.SetError(txtwl_make, (string)null);
                make = true;
            }



            //Inventory product quantity
            if (!val.IsNumeric(txtwl_qty.Text))
            {
                this.errorProvider1.SetError(txtwl_qty, "Quantity is invalid.");
                qty = false;
            }
            else
            {
                this.errorProvider1.SetError(txtwl_qty, (string)null);
                qty = true;
            }

            //Product weight
            if (!val.IsWeight(txtwl_weight.Text))
            {
                this.errorProvider1.SetError(txtwl_weight, "Weight is invalid.");
                weight = false;
            }
            else
            {
                this.errorProvider1.SetError(txtwl_weight, (string)null);
                weight = true;
            }
            weightLiftItem = weight == true && qty == true && make == true && price == true && name == true && model == true;;



            if (weightLiftItem == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        private bool validateProduct()
        {
            Buisness_Logic.validation valp = new Buisness_Logic.validation();
            bool name, make, type, qty, bprice, sprice;

            //Product name
            if (!valp.IsWord(txtAddp_name.Text))
            {
                this.errorProvider1.SetError(txtAddp_name, "Product name is invalid.");
                name = false;
            }
            else
            {
                this.errorProvider1.SetError(txtAddp_name, (string)null);
                name = true;
            }

            //Product make

            if (!valp.IsWord(txtAddp_make.Text))
            {
                this.errorProvider1.SetError(txtAddp_make, "Product make is invalid.");
                make = false;
            }
            else
            {
                this.errorProvider1.SetError(txtAddp_make, (string)null);
                make = true;
            }

            //Product type

            if (cmb_addproduct_type.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmb_addproduct_type, "Product type is not selected.");
                type = false;
            }
            else
            {
                this.errorProvider1.SetError(cmb_addproduct_type, (string)null);
                type = true;
            }

            //Quantity

            if (!valp.IsNumeric(txtadd_qty.Text))
            {
                this.errorProvider1.SetError(txtadd_qty, "Product quantity is invalid.");
                qty = false;
            }
            else
            {
                this.errorProvider1.SetError(txtadd_qty, (string)null);
                qty = true;
            }

            //Buying price
            if (!valp.isPrice(txtAddp_bprice.Text))
            {
                this.errorProvider1.SetError(txtAddp_bprice, "Product buying price is invalid.");
                bprice = false;
            }
            else
            {
                this.errorProvider1.SetError(txtAddp_bprice, (string)null);
                bprice = true;
            }

            //Selling price
            if (!valp.isPrice(txtAddp_sell_price.Text))
            {
                this.errorProvider1.SetError(txtAddp_sell_price, "Product selling price is invalid.");
                sprice = false;
            }
            else
            {
                this.errorProvider1.SetError(txtAddp_sell_price, (string)null);
                sprice = true;
            }


            //maing returning point

            bool condition = name == true && bprice == true && sprice == true && qty == true && type == true && make == true;

            if (condition)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        private bool validateUpdateProducts()
        {
            Buisness_Logic.validation valp = new Buisness_Logic.validation();
            bool name, make, type, qty, nqty, bprice, sprice;

            //Product name
            if (!valp.IsWord(txtp2name.Text))
            {
                this.errorProvider1.SetError(txtp2name, "Product name is invalid.");
                name = false;
            }
            else
            {
                this.errorProvider1.SetError(txtp2name, (string)null);
                name = true;
            }

            //Product make

            if (!valp.IsWord(txtp2_make.Text))
            {
                this.errorProvider1.SetError(txtp2_make, "Product make is invalid.");
                make = false;
            }
            else
            {
                this.errorProvider1.SetError(txtp2_make, (string)null);
                make = true;
            }

            //Product type

            if (cmbp2ProdType.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmbp2ProdType, "Product type is not selected.");
                type = false;
            }
            else
            {
                this.errorProvider1.SetError(cmbp2ProdType, (string)null);
                type = true;
            }

            //Quantity

            if (!valp.IsNumeric(txtp2_availableqty.Text))
            {
                this.errorProvider1.SetError(txtp2_availableqty, "Product quantity is invalid.");
                qty = false;
            }
            else
            {
                this.errorProvider1.SetError(txtp2_availableqty, (string)null);
                qty = true;
            }

            //updated qty after adding to the stock

            if (!valp.IsNumeric(txtp2Newqty.Text) && !string.IsNullOrWhiteSpace(txtp2Newqty.Text))
            {
                this.errorProvider1.SetError(txtp2Newqty, "Product quantity is invalid.");
                nqty = false;
            }
            else
            {
                this.errorProvider1.SetError(txtp2Newqty, (string)null);
                nqty = true;
            }
            //Buying price
            if (!valp.isPrice(txtp2_bprice.Text))
            {
                this.errorProvider1.SetError(txtp2_bprice, "Product buying price is invalid.");
                bprice = false;
            }
            else
            {
                this.errorProvider1.SetError(txtp2_bprice, (string)null);
                bprice = true;
            }

            //Selling price
            if (!valp.isPrice(txtp2_sellingprice.Text))
            {
                this.errorProvider1.SetError(txtp2_sellingprice, "Product selling price is invalid.");
                sprice = false;
            }
            else
            {
                this.errorProvider1.SetError(txtp2_sellingprice, (string)null);
                sprice = true;
            }


            //maing returning point

            bool condition = name == true && bprice == true && sprice == true && qty == true && type == true && make == true && nqty == true;

            if (condition)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }