private void btnSave_Click(object sender, EventArgs e) { DAL.clsProduct pd = new DAL.clsProduct(); int er = 0; er += txtName.txtValidate(); er += txtCode.txtValidate(); er += cmbGroupId.txtValidate(); er += cmbCompanyId.txtValidate(); er += cmbCategoryId.txtValidate(); er += cmbUnitId.txtValidate(); er += cmbUnitId.txtValidate(); er += cmbDiscountId.txtValidate(); er += cmbSaleStatusId.txtValidate(); er += txtListPrice.txtValidate(); er += txtVat.txtValidate(); if (er == 0) { pd.Name = txtName.txtTextValue; pd.Code = txtCode.txtTextValue; pd.GroupId = cmbGroupId.txtTextValueInt; pd.PowerId = cmbPowerId.txtTextValueInt; pd.CompanyId = cmbCompanyId.txtTextValueInt; pd.CategoryId = cmbCategoryId.txtTextValueInt; pd.UnitId = cmbUnitId.txtTextValueInt; pd.DiscountId = cmbDiscountId.txtTextValueInt; pd.SaleStatusId = cmbSaleStatusId.txtTextValueInt; pd.ListPrice = txtListPrice.txtDoubleValue; pd.Vat = txtVat.txtDoubleValue; pd.Remarks = txtRemarks.txtTextValue; if (pd.Insert()) { MessageBox.Show("New Product Inserted !!"); txtName.txtTextValue = ""; txtCode.txtTextValue = ""; cmbGroupId.txtTextValueInt = -1; cmbPowerId.txtTextValueInt = -1; cmbCompanyId.txtTextValueInt = -1; cmbCategoryId.txtTextValueInt = -1; cmbUnitId.txtTextValueInt = -1; cmbDiscountId.txtTextValueInt = -1; cmbSaleStatusId.txtTextValueInt = -1; txtListPrice.txtTextValue = ""; txtVat.txtTextValue = ""; txtRemarks.txtTextValue = ""; txtName.Focus(); } else { MessageBox.Show(pd.Error); } } }
private void frmPurchaseNew_Load(object sender, EventArgs e) { DAL.clsProduct pd2 = new DAL.clsProduct(); cmbProduct.setDataSource(pd2.Select()); cmbProduct.cmbCombo.SelectedValueChanged += cmbCombo_SelectedValueChanged; //cmbDiscount.txtTextValueInt = pd.DiscountId; //cmbRate.txtTextValueInt = Convert.ToInt32(pd.ListPrice); //cmbVat.txtTextValueInt = Convert.ToInt32(pd.Vat); //cmbCode.txtTextValueInt = Convert.ToInt32(pd.Code); //cmbProduct.setDataSource(pd.Select()); DAL.clsEmployee em = new DAL.clsEmployee(); em.Id = cmbEmployee.txtTextValueInt; cmbEmployee.setDataSource(em.Select()); }
void cmbCombo_SelectedValueChanged(object sender, EventArgs e) { DAL.clsProduct pd2 = new DAL.clsProduct(); pd2.DiscountId = cmbDiscount.txtTextValueInt; cmbDiscount.setDataSource(pd2.Select(), "discount"); pd2.ListPrice = cmbRate.txtTextValueInt; cmbRate.setDataSource(pd2.Select(), "listPrice"); pd2.Vat = cmbVat.txtTextValueInt; cmbVat.setDataSource(pd2.Select(), "vat"); pd2.Code = cmbCode.txtTextValueInt.ToString(); cmbCode.setDataSource(pd2.Select(), "code"); //pd2.Name = cmbProduct.txtTextValueInt.ToString(); //cmbProduct.setDataSource(pd2.Select()); }
private void btnSearch_Click(object sender, EventArgs e) { DAL.clsProduct p = new DAL.clsProduct(); dgvData.DataSource = p.Select().Tables[0]; }
private void frmRackNew_Load(object sender, EventArgs e) { DAL.clsProduct p = new DAL.clsProduct(); cmbProduct.setDataSource(p.Select()); }