Esempio n. 1
0
        public bool validate_expenxe()
        {
            bool exname, type, am;

            try
            {
                Buisness_Logic.validation val1 = new Buisness_Logic.validation();
                ////Year
                //if (!val1.IsNumeric(txtfin_expen_Year.Text) && string.IsNullOrWhiteSpace(txtFin_fitYear.Text))
                //{

                //    this.errorProvider1.SetError(txtFin_fitYear, " Year is invalid.");
                //    exname = false;

                //}
                //else
                //{
                //    this.errorProvider1.SetError(txtFin_fitYear, (string)null);
                //    exname = true;

                //}

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

                //amount
                if (!val1.isPrice(txtFin5_amount.Text) && string.IsNullOrWhiteSpace(txtFin5_amount.Text))
                {
                    this.errorProvider1.SetError(txtFin5_amount, " Income is invalid.");
                    am = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtFin5_amount, (string)null);
                    am = true;
                }
            }
            catch (Exception fd)
            {
                throw;
            }

            if (type == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        //validate employee search

        private bool validate_search_employee()
        {
            Buisness_Logic.validation val1 = new Buisness_Logic.validation();
            bool name, nic, empid;

            if (string.IsNullOrWhiteSpace(txtEmp2_empid.Text) && string.IsNullOrWhiteSpace(txtEmp2_nic.Text) && string.IsNullOrWhiteSpace(txtEmp2_name.Text))
            {
                MessageBox.Show("Please enter employee ID or NIC or name to search employee.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            else
            {
                // Member ID
                if (!txtEmp2_empid.Text.All(char.IsDigit) && !string.IsNullOrWhiteSpace(txtEmp2_empid.Text))
                {
                    this.errorProvider1.SetError(txtEmp2_empid, "Employee ID is invalid.");
                    empid = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtEmp2_empid, (string)null);
                    empid = 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) && !string.IsNullOrWhiteSpace(txtEmp2_nic.Text))
                {
                    this.errorProvider1.SetError(txtEmp2_nic, "NIC is invalid.");
                    nic = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtEmp2_nic, (string)null);
                    nic = true;
                }



                //**** main returning part
                if (empid == true || name == true || nic == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
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);
                }
            }
        }
Esempio n. 5
0
        private bool validateFeedatils()
        {
            Buisness_Logic.validation vf = new Buisness_Logic.validation();
            if (string.IsNullOrWhiteSpace(txtMF_memID.Text) && string.IsNullOrWhiteSpace(txtmfNIC.Text) && (string.IsNullOrWhiteSpace(txtMFee_name.Text)))
            {
                MessageBox.Show("Enter Member ID or Name or NIC to find fee payment details.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            else
            {
                if (!txtMF_memID.Text.All(char.IsDigit) && string.IsNullOrWhiteSpace(txtmfNIC.Text) && (string.IsNullOrWhiteSpace(txtMFee_name.Text)))
                {
                    MessageBox.Show("Member Id should include digits.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }
                //  else return true;
                else if ((!txtMFee_name.Text.All(char.IsLetter)) && string.IsNullOrWhiteSpace(txtmfNIC.Text) && string.IsNullOrWhiteSpace(txtMF_memID.Text))
                {
                    MessageBox.Show("Enter name in correct format.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }

                else if ((!vf.IsNIC(txtmfNIC.Text)) && string.IsNullOrWhiteSpace(txtMF_memID.Text) && (string.IsNullOrWhiteSpace(txtMFee_name.Text)))
                {
                    MessageBox.Show("NIC  is invalid!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }
                // else return true;


                else
                {
                    return(true);
                }
            }
        }
Esempio n. 6
0
        private bool validateEmp()
        {
            Buisness_Logic.validation val1 = new Buisness_Logic.validation();
            bool phone, email, address, name, nic, gender, dob, pp;

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

            //Email

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

            //Name
            if (!val1.IsName(txtEmp1_name.Text) && string.IsNullOrWhiteSpace(txtEmp1_name.Text))
            {
                this.errorProvider1.SetError(txtEmp1_name, "Name is invalid.");
                name = false;
            }
            else
            {
                this.errorProvider1.SetError(txtEmp1_name, (string)null);
                name = true;
            }
            //NIC
            if (!val1.IsNIC(txtEmp_nic.Text))
            {
                this.errorProvider1.SetError(txtEmp_nic, "NIC is invalid.");
                nic = false;
            }
            else
            {
                this.errorProvider1.SetError(txtEmp_nic, (string)null);
                nic = true;
            }
            //address
            if (!val1.IsAddress(txtEmp1_address.Text))
            {
                this.errorProvider1.SetError(txtEmp1_address, "Address is invalid.");
                address = false;
            }
            else
            {
                this.errorProvider1.SetError(txtEmp1_address, (string)null);
                address = true;
            }
            //gender
            if (cmbEmp1_gender.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmbEmp1_gender, "Gender is not selected.");
                gender = false;
            }
            else
            {
                this.errorProvider1.SetError(cmbEmp1_gender, (string)null);
                gender = true;
            }
            //post
            if (cmbEmp1_post.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmbEmp1_post, "Post is not selected.");
                pp = false;
            }
            else
            {
                this.errorProvider1.SetError(cmbEmp1_post, (string)null);
                pp = true;
            }

            //dob
            if (dateTimePickeremp.Value >= DateTime.Today)
            {
                this.errorProvider1.SetError(dateTimePickeremp, "DOB is invalid.");
                dob = false;
            }
            else
            {
                this.errorProvider1.SetError(dateTimePickeremp, (string)null);
                dob = true;
            }

            //resume


            //**** main returning part
            if (phone == true && email == true && name == true && nic == true && gender == true && dob == true && address == true && pp == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 7
0
        private bool validateExercise()
        {
            bool exname, type, des, eq, ad;

            try
            {
                Buisness_Logic.validation val1 = new Buisness_Logic.validation();
                //Name
                if (!val1.IsName(txtEx1_name.Text) && string.IsNullOrWhiteSpace(txtEx1_name.Text))
                {
                    this.errorProvider1.SetError(txtEx1_name, "Exercise name is invalid.");
                    exname = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtEx1_name, (string)null);
                    exname = true;
                }
                //description
                if (!val1.IsWord(txtEx2_description.Text) && string.IsNullOrWhiteSpace(txtEx2_description.Text))
                {
                    this.errorProvider1.SetError(txtEx2_description, "Exercise description is invalid.");
                    des = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtEx2_description, (string)null);
                    des = true;
                }
                //type
                if (cmbWork_cato.SelectedIndex.Equals(-1))
                {
                    this.errorProvider1.SetError(cmbWork_cato, "Exercise category is not selected.");
                    type = false;
                }
                else
                {
                    this.errorProvider1.SetError(cmbWork_cato, (string)null);
                    type = true;
                }
                //equipments

                if (!val1.IsWord(txtEx1_equi.Text))
                {
                    this.errorProvider1.SetError(txtEx1_equi, "Equipment name is invalid.");
                    eq = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtEx1_equi, (string)null);
                    eq = true;
                }

                //additional

                if (!val1.IsWord(txtEx1_Addionaequi.Text))
                {
                    this.errorProvider1.SetError(txtEx1_Addionaequi, "Additional equipment name is invalid.");
                    ad = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtEx1_Addionaequi, (string)null);
                    ad = true;
                }
            }
            catch (Exception fd)
            {
                throw;
            }

            if (type == true && exname == true && des == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 8
0
        //validate areaobic member updatetab2
        private bool validate_aerobicMemberUpdate()
        {
            Buisness_Logic.validation val1 = new Buisness_Logic.validation();
            bool phone, email, address, name, nic, gender, dob, pp;

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


            //Name
            if (!val1.IsName(txteditmem_name.Text) && string.IsNullOrWhiteSpace(txteditmem_name.Text))
            {
                this.errorProvider1.SetError(txteditmem_name, "Name is invalid.");
                name = false;
            }
            else
            {
                this.errorProvider1.SetError(txteditmem_name, (string)null);
                name = true;
            }
            //NIC
            if (!val1.IsNIC(txteditmem_nic.Text))
            {
                this.errorProvider1.SetError(txteditmem_nic, "NIC is invalid.");
                nic = false;
            }
            else
            {
                this.errorProvider1.SetError(txteditmem_nic, (string)null);
                nic = true;
            }
            //address
            if (!val1.IsAddress(txteditmem_address.Text))
            {
                this.errorProvider1.SetError(txteditmem_address, "Address is invalid.");
                address = false;
            }
            else
            {
                this.errorProvider1.SetError(txteditmem_address, (string)null);
                address = true;
            }
            //gender
            if (cmdeditmemGender.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmdeditmemGender, "Gender is not selected.");
                gender = false;
            }
            else
            {
                this.errorProvider1.SetError(cmdeditmemGender, (string)null);
                gender = true;
            }
            // service type
            if (cmbeditmemserve.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmbeditmemserve, "Payment Plan is not selected.");
                pp = false;
            }
            else
            {
                this.errorProvider1.SetError(cmbeditmemserve, (string)null);
                pp = true;
            }

            //dob
            if (datetimeeditmem.Value >= DateTime.Today)
            {
                this.errorProvider1.SetError(datetimeeditmem, "DOB is invalid.");
                dob = false;
            }
            else
            {
                this.errorProvider1.SetError(datetimeeditmem, (string)null);
                dob = true;
            }


            //**** main returning part
            bool condition = phone == true && name == true && nic == true && gender == true && address == true && pp == true;

            if (condition)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 9
0
        private bool validateUpdate_AddServices()
        {
            Buisness_Logic.validation val1 = new Buisness_Logic.validation();
            bool sname, cordinator, day, fee, stime, etime;



            //Service name
            if (!val1.IsWord(txtOS1_name.Text) && string.IsNullOrWhiteSpace(txtOS1_name.Text))
            {
                this.errorProvider1.SetError(txtOS1_name, "Service name is invalid.");
                sname = false;
            }
            else
            {
                this.errorProvider1.SetError(txtOS1_name, (string)null);
                sname = true;
            }

            // rate
            if (!val1.isPrice(txtOS1_Rate.Text) && string.IsNullOrWhiteSpace(txtOS1_Rate.Text))
            {
                this.errorProvider1.SetError(txtOS1_Rate, "Service charge is invalid.");
                fee = false;
            }
            else
            {
                this.errorProvider1.SetError(txtOS1_Rate, (string)null);
                fee = true;
            }

            if (radio_mc.Checked == true)
            {
                //Cordinator name
                if (!val1.IsName(txt_cordinator.Text) && string.IsNullOrWhiteSpace(txt_cordinator.Text))
                {
                    this.errorProvider1.SetError(txt_cordinator, "Cordinator name is invalid.");
                    cordinator = false;
                }
                else
                {
                    this.errorProvider1.SetError(txt_cordinator, (string)null);
                    cordinator = true;
                }


                //Day
                if (cmbOS1_day.SelectedIndex.Equals(-1))
                {
                    this.errorProvider1.SetError(cmbOS1_day, "Day is not selected.");
                    day = false;
                }
                else
                {
                    this.errorProvider1.SetError(cmbOS1_day, (string)null);
                    day = true;
                }



                //start time
                DateTime dt1;
                if (DateTime.TryParse(txtOS1_statingTime.Text, out dt1) && dt1 > DateTime.Now && string.IsNullOrWhiteSpace(txtOS1_statingTime.Text))
                {
                    this.errorProvider1.SetError(txtOS1_statingTime, "Start time is invalid.");
                    stime = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtOS1_statingTime, (string)null);
                    stime = true;
                }

                //end time
                DateTime dt2;
                if (DateTime.TryParse(txtOS1_EndingTime.Text, out dt2) && dt2 > DateTime.Now && string.IsNullOrWhiteSpace(txtOS1_EndingTime.Text))
                {
                    this.errorProvider1.SetError(txtOS1_EndingTime, "End time is invalid.");
                    etime = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtOS1_EndingTime, (string)null);
                    etime = true;
                }
                if (cordinator == true && day == true && stime == true && etime == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            else
            {
                if (sname == true && fee == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Esempio n. 10
0
        private bool validateAddMember()
        {
            Buisness_Logic.validation val1 = new Buisness_Logic.validation();
            bool phone, email, address, name, nic,gender,pp,dob,height,weight;

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

            //Email

             if  (!val1.IsEmail2(txtM_email.Text)){

                this.errorProvider1.SetError(txtM_email, "Email is invalid.");
                email = false;

            }
            else
            {
                this.errorProvider1.SetError(txtM_email, (string)null);
                email = true;

            }

             //Name
            if (!val1.IsName(txtM_name.Text) && string.IsNullOrWhiteSpace(txtM_name.Text))
            {

                this.errorProvider1.SetError(txtM_name, "Name is invalid.");
                name = false;

            }
            else
            {
                this.errorProvider1.SetError(txtM_name, (string)null);
                name = true;

            }
            //NIC
            if (!val1.IsNIC(txtM_nic.Text) )
            {
                this.errorProvider1.SetError(txtM_nic, "NIC is invalid.");
                nic = false;
            }
            else
            {
                this.errorProvider1.SetError(txtM_nic, (string)null);
                nic = true;
            }
            //address
            if (!val1.IsAddress(txtM_address.Text))
            {
                this.errorProvider1.SetError(txtM_address, "Address is invalid.");
                address = false;
            }
            else
            {
                this.errorProvider1.SetError(txtM_address, (string)null);
                address = true;
            }
            //gender
            if (cmbM_gender.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmbM_gender, "Gender is not selected.");
                gender = false;
            }
            else
            {
                this.errorProvider1.SetError(cmbM_gender, (string)null);
                gender = true;
            }
            //payment plan
            if (cmbM_paymentPlan.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmbM_paymentPlan, "Payment Plan is not selected.");
                pp = false;
            }
            else
            {
                this.errorProvider1.SetError(cmbM_paymentPlan, (string)null);
                pp = true;
            }

            //dob
            if (dateTimePickerMem.Value>= DateTime.Today)
            {
                this.errorProvider1.SetError(dateTimePickerMem, "DOB is invalid.");
                dob = false;
            }
            else
            {
                this.errorProvider1.SetError(dateTimePickerMem, (string)null);
                dob = true;
            }

            //height
            if (!val1.IsHeight(txtM_height.Text))
            {

                this.errorProvider1.SetError(txtM_height, "Height is invalid.");
                height = false;

            }
            else
            {
                this.errorProvider1.SetError(txtM_height, (string)null);
                height = true;

            }

            //weight
            if (!val1.IsWeight(txtM_weight.Text))
            {

                this.errorProvider1.SetError(txtM_weight, "Weight is invalid.");
                weight = false;

            }
            else
            {
                this.errorProvider1.SetError(txtM_weight, (string)null);
                weight = true;

            }

            //**** main returning part
            bool condition = phone == true && email == true && name == true && nic == true && gender == true && height == true && weight == true && address == true && pp == true;
            if (condition) return true;
            else return false;


        }
Esempio n. 11
0
        private bool validate_search()
        {


            Buisness_Logic.validation val1 = new Buisness_Logic.validation();
            bool  name, nic,memid;

            if (string.IsNullOrWhiteSpace(txtM3_memID.Text) && string.IsNullOrWhiteSpace(txtM3_nic.Text) && string.IsNullOrWhiteSpace(txtM3_name.Text))
            {
                MessageBox.Show("Please enter memberID or NIC or name to search member.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return false;
            }
            else
            {

                // Member ID
                if (!txtM3_memID.Text.All(char.IsDigit) && !string.IsNullOrWhiteSpace(txtM3_memID.Text))
                {
                    this.errorProvider1.SetError(txtM3_memID, "MemeberID is invalid.");
                    memid = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtM3_memID, (string)null);
                    memid = true;
                }

                //Name
                if (!val1.IsName(txtM3_name.Text) && !string.IsNullOrWhiteSpace(txtM3_name.Text))
                {

                    this.errorProvider1.SetError(txtM3_name, "Name is invalid.");
                    name = false;

                }
                else
                {
                    this.errorProvider1.SetError(txtM3_name, (string)null);
                    name = true;

                }
                //NIC
                if (!val1.IsNIC(txtM3_nic.Text) && !string.IsNullOrWhiteSpace(txtM3_nic.Text))
                {
                    this.errorProvider1.SetError(txtM3_nic, "NIC is invalid.");
                    nic = false;
                }
                else
                {
                    this.errorProvider1.SetError(txtM3_nic, (string)null);
                    nic = true;
                }




                //**** main returning part
                if (memid == true || name == true || nic == true) return true;
                else return false;
            }
            

            



        }
Esempio n. 12
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. 13
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. 14
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);
            }
        }
Esempio n. 15
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);
            }
        }
Esempio n. 16
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);
            }
        }
Esempio n. 17
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. 18
0
        private bool validateUpdateMember()
        {
            Buisness_Logic.validation val1 = new Buisness_Logic.validation();
            bool phone, email, address, name, nic, gender, pp, dob, height, weight;

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

            //Email

            if (!val1.IsEmail2(txtmsemail.Text))
            {

                this.errorProvider1.SetError(txtmsemail, "Email is invalid.");
                email = false;

            }
            else
            {
                this.errorProvider1.SetError(txtmsemail, (string)null);
                email = true;

            }

            //Name
            if (!val1.IsName(txtM3_name.Text) && string.IsNullOrWhiteSpace(txtM3_name.Text))
            {

                this.errorProvider1.SetError(txtM3_name, "Name is invalid.");
                name = false;

            }
            else
            {
                this.errorProvider1.SetError(txtM3_name, (string)null);
                name = true;

            }
            //NIC
            if (!val1.IsNIC(txtM3_nic.Text))
            {
                this.errorProvider1.SetError(txtM3_nic, "NIC is invalid.");
                nic = false;
            }
            else
            {
                this.errorProvider1.SetError(txtM3_nic, (string)null);
                nic = true;
            }
            //address
            if (!val1.IsAddress(txtmsearch_address.Text))
            {
                this.errorProvider1.SetError(txtmsearch_address, "Address is invalid.");
                address = false;
            }
            else
            {
                this.errorProvider1.SetError(txtmsearch_address, (string)null);
                address = true;
            }
            //gender
            if (cmbM3_gender.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmbM3_gender, "Gender is not selected.");
                gender = false;
            }
            else
            {
                this.errorProvider1.SetError(cmbM3_gender, (string)null);
                gender = true;
            }
            //payment plan
            if (cmbM3_paymentpaln.SelectedIndex.Equals(-1))
            {
                this.errorProvider1.SetError(cmbM3_paymentpaln, "Payment Plan is not selected.");
                pp = false;
            }
            else
            {
                this.errorProvider1.SetError(cmbM3_paymentpaln, (string)null);
                pp = true;
            }

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

            //height
            if (!val1.IsHeight(txtM3_height.Text))
            {

                this.errorProvider1.SetError(txtM3_height, "Height is invalid.");
                height = false;

            }
            else
            {
                this.errorProvider1.SetError(txtM3_height, (string)null);
                height = true;

            }

            //weight
            if (!val1.IsWeight(txtM3_weight.Text))
            {

                this.errorProvider1.SetError(txtM3_weight, "Weight is invalid.");
                weight = false;

            }
            else
            {
                this.errorProvider1.SetError(txtM3_weight, (string)null);
                weight = true;

            }

            //**** main returning part
            if (phone == true && email == true && name == true && nic == true && gender == true && height == true && address && weight ==true) return true;
            else return false;

        }