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); } }
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); } } }
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); } }
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); } }
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); } }
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); } }
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); } }