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()); }
private void btnSave_Click(object sender, EventArgs e) { DAL.clsEmployee em = new DAL.clsEmployee(); int er = 0; er += txtName.txtValidate(); er += txtPhone.txtValidate(); er += txtEmail.txtValidate(); er += txtType.txtValidate(); er += txtPassword.txtValidate(); er += pbImage.txtValidate(); if (er == 0) { em.Name = txtName.txtTextValue; em.Phone = txtPhone.txtTextValue; em.Email = txtEmail.txtTextValue; em.Type = txtType.txtTextValue; em.Password = txtPassword.txtTextValue; em.Image = FileImage.ImageToByte(pbImage.BGImage); if (em.Insert()) { MessageBox.Show("Employee Information is Saved !!"); txtName.txtTextValue = ""; txtPhone.txtTextValue = ""; txtEmail.txtTextValue = ""; txtType.txtTextValue = ""; txtPassword.txtTextValue = ""; pbImage.BGImage = null; txtName.Focus(); } else { MessageBox.Show(em.Error); } } }
private void btnSearch_Click(object sender, EventArgs e) { DAL.clsEmployee em = new DAL.clsEmployee(); dgvData.DataSource = em.Select().Tables[0]; }