private void BtnSubmit_Click(object sender, EventArgs e) { if (Ref_Validation.TextValidation(txtEditProduct.Text) == true && Ref_Validation.NumberValidation(txtEditUnitPrice.Text) == true && Ref_Validation.NumberValidation(txtEditQuantity.Text) == true && Ref_Validation.NumberValidation(txtEditCode.Text) == true ) { ReF_Helper = new Helper(); ReF_Shopping = new shopping(); Ref_ProductViewModel.Edit(Convert.ToInt32(lblEditID.Text) , txtEditProduct.Text, Convert.ToInt32(txtEditUnitPrice.Text), Convert.ToInt32(txtEditQuantity.Text), ReF_Helper.Price(txtEditUnitPrice.Text, txtEditQuantity.Text), Convert.ToInt32(txtEditCode.Text), ReF_Helper.ImageToByteArray(pctrBx.Image)); MessageBox.Show("succeeded"); this.Close(); MessageBox.Show("please enter Refresh Button !!!"); } else { MessageBox.Show("please check fields"); } }
private void TxtQuantity_TextChanged(object sender, EventArgs e) { if (Ref_Validation.NumberValidation(txtQuantity.Text) == false) { lblerrQuantity.Text = "please enter numbers"; lblerrQuantity.ForeColor = Color.Red; } else { lblerrQuantity.Text = "correct"; lblerrQuantity.ForeColor = Color.Green; } }
private void TxtProduct_TextChanged(object sender, EventArgs e) { if (Ref_Validation.TextValidation(txtProduct.Text) == false) { lblerrName.Text = "please enter character and numbers"; lblerrName.ForeColor = Color.Red; } else { lblerrName.Text = "correct"; lblerrName.ForeColor = Color.Green; } }
private void BtnSave_Click(object sender, EventArgs e) { if (Ref_Validation.TextValidation(txtProduct.Text) == true && Ref_Validation.NumberValidation(txtUnitPrice.Text) == true && Ref_Validation.NumberValidation(txtQuantity.Text) == true && Ref_Validation.NumberValidation(txtCode.Text) == true && pictureBox1.Image != null) { ReF_Helper = new Helper(); Ref_ProductViewModel.Save(txtProduct.Text, Convert.ToInt32(txtUnitPrice.Text) , Convert.ToInt32(txtQuantity.Text), ReF_Helper.Price(txtUnitPrice.Text, txtQuantity.Text), Convert.ToInt32(txtCode.Text), ReF_Helper.ImageToByteArray(pictureBox1.Image)); ClearAll(); MessageBox.Show("save"); dgvProduct.DataSource = Ref_ProductViewModel.FillGrid(); } else { MessageBox.Show("please check fields"); } }