コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int er = 0;

            if (txtName.Text == "")
            {
                er++;
                ep.SetError(txtName, "Required");
            }
            //validation baki
            DAL.Product p = new DAL.Product();
            p.BrandId     = Convert.ToInt32(cmbBrand.SelectedValue);
            p.CategoryId  = Convert.ToInt32(cmbCategory.SelectedValue);
            p.Code        = txtCode.Text;
            p.Description = txtDescription.Text;
            p.Discount    = Convert.ToDouble(txtDiscount.Text);
            p.Name        = txtName.Text;
            p.Offers      = txtOffer.Text;
            p.Tag         = txtTag.Text;
            p.Type        = cmbType.Text;
            if (p.Insert())
            {
                MessageBox.Show("Data Saved");
                MyControls.Helper.clear(this);
                txtName.Focus();
            }
            else
            {
                MessageBox.Show(p.Error);
            }
        }
コード例 #2
0
 public void Insert(Common.ProductDatum dm)
 {
     dl.Insert(dm);
 }