Esempio n. 1
0
        //validate update employee part
        private bool validateUpdate_employee()
        {
            Buisness_Logic.validation val1 = new Buisness_Logic.validation();
            bool phone, email, address, name, nic, gender, dob, jdate, profile, position;

            //phone
            if (!val1.IsPhone(txtEmp2_phone.Text))
            {
                this.errorProvider1.SetError(txtEmp2_phone, "Phone is invalid.");
                phone = false;
            }
            else
            {
                this.errorProvider1.SetError(txtEmp2_phone, (string)null);
                phone = true;
            }

            //Email

            if (!val1.IsEmail2(txtEmp2_email.Text))
            {
                this.errorProvider1.SetError(txtEmp2_email, "Email is invalid.");
                email = false;
            }
            else
            {
                this.errorProvider1.SetError(txtEmp2_email, (string)null);
                email = true;
            }

            //Name
            if (!val1.IsName(txtEmp2_name.Text) && string.IsNullOrWhiteSpace(txtEmp2_name.Text))
            {
                this.errorProvider1.SetError(txtEmp2_name, "Name is invalid.");
                name = false;
            }
            else
            {
                this.errorProvider1.SetError(txtEmp2_name, (string)null);
                name = true;
            }
            //NIC
            if (!val1.IsNIC(txtEmp2_nic.Text))
            {
                this.errorProvider1.SetError(txtEmp2_nic, "NIC is invalid.");
                nic = false;
            }
            else
            {
                this.errorProvider1.SetError(txtEmp2_nic, (string)null);
                nic = true;
            }
            //address
            if (!val1.IsAddress(txtEmp2_address.Text))
            {
                this.errorProvider1.SetError(txtEmp2_address, "Address is invalid.");
                address = false;
            }
            else
            {
                this.errorProvider1.SetError(txtEmp2_address, (string)null);
                address = true;
            }
            //gender
            if (cmbEMP2_gender.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmbEMP2_gender, "Gender is not selected.");
                gender = false;
            }
            else
            {
                this.errorProvider1.SetError(cmbEMP2_gender, (string)null);
                gender = true;
            }
            //post or position of the employee
            if (cmbEMP2_post.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmbEMP2_post, "Employee post is not selected.");
                position = false;
            }
            else
            {
                this.errorProvider1.SetError(cmbEMP2_post, (string)null);
                position = true;
            }

            //dob
            DateTime dt;

            if (DateTime.TryParse(txtEmp2_dob.Text, out dt) && dt > DateTime.Today)
            {
                this.errorProvider1.SetError(txtEmp2_dob, "DOB is invalid.");
                dob = false;
            }
            else
            {
                this.errorProvider1.SetError(txtEmp2_dob, (string)null);
                dob = true;
            }

            //joined date
            DateTime dt1;

            if (DateTime.TryParse(txtEmp2_jDate.Text, out dt1) && dt1 > DateTime.Today)
            {
                this.errorProvider1.SetError(txtEmp2_jDate, "Joined date is invalid.");
                jdate = false;
            }
            else
            {
                this.errorProvider1.SetError(txtEmp2_jDate, (string)null);
                jdate = true;
            }

            //profile of the employee
            if (!val1.IsAlphaNumeric(txtEmp2_profile.Text))
            {
                this.errorProvider1.SetError(txtEmp2_profile, "Pofile is invalid.");
                profile = false;
            }
            else
            {
                this.errorProvider1.SetError(txtEmp2_profile, (string)null);
                profile = true;
            }

            //**** main returning part
            if (phone == true && email == true && name == true && nic == true && gender == true && position == true && dob && jdate == true && profile == true && address == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        private bool validateInvUpdate_Equipment()
        {
            bool make, price, model, name;
            bool equi;

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

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

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

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



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



            if (equi == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio 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);
            }
        }