private bool Validation() { bool result = true; if (string.IsNullOrEmpty(txtQty.Text)) { result = false; errorProvider1.SetError(txtQty, "Order Qty Required"); } materialDAL dalMat = new materialDAL(); if (dalMat.checkIfZeroCost(txtItemCode.Text)) { if (!cbZeroCost.Checked) { errorProvider2.SetError(cbZeroCost, txtItemCode.Text + " is a zero cost item"); DialogResult dialogResult = MessageBox.Show(txtItemCode.Text + " is a zero cost item, are you sure you want to make this a PURCHASE order?\n(You can change it by check/uncheck the ZERO COST section)", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult != DialogResult.Yes) { result = false; } } } else { if (cbZeroCost.Checked) { errorProvider2.SetError(cbZeroCost, txtItemCode.Text + " NOT a zero cost item"); DialogResult dialogResult = MessageBox.Show(txtItemCode.Text + " NOT a zero cost item, are you sure you want to make this a ZERO COST order?\n(You can change it by check/uncheck the ZERO COST section)", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult != DialogResult.Yes) { result = false; } } } return(result); }
private void InitialData(itemBLL u) { if (!string.IsNullOrEmpty(u.item_code)) { cmbCat.Text = u.item_cat; txtItemCode.Text = u.item_code; txtItemName.Text = u.item_name; cmbMaterialType.Text = u.item_material; cmbMasterBatch.Text = u.item_mb; txtMBRate.Text = u.item_mb_rate.ToString(); txtColor.Text = u.item_color; txtQuoTon.Text = u.item_quo_ton.ToString(); txtBestTon.Text = u.item_best_ton.ToString(); txtProTon.Text = u.item_pro_ton.ToString(); txtQuoCT.Text = u.item_quo_ct.ToString(); txtProCTFrom.Text = u.item_pro_ct_from.ToString(); txtProCTTo.Text = u.item_pro_ct_to.ToString(); txtCapacity.Text = u.item_capacity.ToString(); txtQuoPWPcs.Text = u.item_quo_pw_pcs.ToString(); txtQuoRWPcs.Text = u.item_quo_rw_pcs.ToString(); txtProPWPcs.Text = u.item_pro_pw_pcs.ToString(); txtProRWPcs.Text = u.item_pro_rw_pcs.ToString(); txtProPWShot.Text = u.item_pro_pw_shot.ToString(); txtProRWShot.Text = u.item_pro_rw_shot.ToString(); txtProCooling.Text = u.item_pro_cooling.ToString(); txtWastageAllowed.Text = u.item_wastage_allowed.ToString(); if (u.item_assembly.ToString() != null) { if (u.item_assembly == 1) { cbAssembly.Checked = true; } else { cbAssembly.Checked = false; } } else { cbAssembly.Checked = false; } if (u.item_production.ToString() != null) { if (u.item_production == 1) { cbProduction.Checked = true; } else { cbProduction.Checked = false; } } else { cbProduction.Checked = false; } if (!dalItem.getCatName(u.item_code).Equals("Part")) { if (dalMaterial.checkIfZeroCost(u.item_code)) { cbZeroCost.Checked = true; } else { cbZeroCost.Checked = false; } } } else { cmbCat.Text = u.item_cat; InitialData(); } }
private bool Validation() { bool result = true; if (string.IsNullOrEmpty(cmbItemCat.Text)) { result = false; errorProvider1.SetError(cmbItemCat, "Item Category Required"); } if (string.IsNullOrEmpty(cmbItemName.Text)) { result = false; errorProvider2.SetError(cmbItemName, "Item Name Required"); } if (string.IsNullOrEmpty(cmbItemCode.Text)) { result = false; errorProvider3.SetError(cmbItemCode, "Item Code Required"); } if (string.IsNullOrEmpty(txtQty.Text)) { result = false; errorProvider4.SetError(txtQty, "Item order qty Required"); } if (string.IsNullOrEmpty(cmbQtyUnit.Text)) { result = false; errorProvider5.SetError(cmbQtyUnit, "Item order unit Required"); } if (string.IsNullOrEmpty(dtpRequiredDate.Text)) { result = false; errorProvider6.SetError(dtpRequiredDate, "Item forecast date Required"); } materialDAL dalMat = new materialDAL(); if (dalMat.checkIfZeroCost(cmbItemCode.Text)) { if (!cbZeroCost.Checked) { errorProvider7.SetError(cbZeroCost, cmbItemCode.Text + " is a zero cost item"); DialogResult dialogResult = MessageBox.Show(cmbItemCode.Text + " is a zero cost item, are you sure you want to make this a PURCHASE order?\n(You can change it by check/uncheck the ZERO COST section)", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult != DialogResult.Yes) { result = false; } } } else { if (cbZeroCost.Checked) { errorProvider7.SetError(cbZeroCost, cmbItemCode.Text + " NOT a zero cost item"); DialogResult dialogResult = MessageBox.Show(cmbItemCode.Text + " NOT a zero cost item, are you sure you want to make this a ZERO COST order?\n(You can change it by check/uncheck the ZERO COST section)", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult != DialogResult.Yes) { result = false; } } } return(result); }