private void bNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { UserForms.Customer frm = new UserForms.Customer(); if (frm.ShowDialog() == DialogResult.Yes) { if (cus.CreateCustomer( frm.CustomerName, frm.Address, frm.PhoneNo, frm.Email, UserClass.Utils.ConvertImage(frm.ImageLocation)) == null) { XtraMessageBox.Show("New Customer created!"); } else { XtraMessageBox.Show(cus.CreateCustomer( frm.CustomerName, frm.Address, frm.PhoneNo, frm.Email, UserClass.Utils.ConvertImage(frm.ImageLocation))); } } }
private void bEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int id = (int)grv.GetFocusedRowCellValue(colID); string cnm = grv.GetFocusedRowCellValue(colName).ToString(); string adr = grv.GetFocusedRowCellValue(colAddress).ToString(); string phn = grv.GetFocusedRowCellValue(colPhone).ToString(); string eml = grv.GetFocusedRowCellValue(colEmail).ToString(); byte[] pho = (byte[])grv.GetFocusedRowCellValue(colPHO); UserForms.Customer frm = new UserForms.Customer(true); frm.CustomerName = cnm; frm.Address = adr; frm.PhoneNo = phn; frm.Email = eml; frm.CustomerPhoto = UserClass.Utils.ConvertImage(pho); if (frm.ShowDialog() == DialogResult.OK) { if (frm.ImageLocation != null) { cus.UpdateCustomer(frm.CustomerName, frm.Address, frm.PhoneNo, frm.Email, UserClass.Utils.ConvertImage(frm.ImageLocation), id); } else { cus.UpdateCustomerWoPhoto(frm.CustomerName, frm.Address, frm.PhoneNo, frm.Email, id); } } grd.DataSource = cus.GetAllCustomers(); }
private void bNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { UserForms.Customer frm = new UserForms.Customer(); if(frm.ShowDialog() == DialogResult.Yes) { if(cus.CreateCustomer( frm.CustomerName, frm.Address, frm.PhoneNo, frm.Email, UserClass.Utils.ConvertImage(frm.ImageLocation)) == null) { XtraMessageBox.Show("New Customer created!"); } else { XtraMessageBox.Show(cus.CreateCustomer( frm.CustomerName, frm.Address, frm.PhoneNo, frm.Email, UserClass.Utils.ConvertImage(frm.ImageLocation))); } } }
private void bEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int id = (int)grv.GetFocusedRowCellValue(colID); string cnm = grv.GetFocusedRowCellValue(colName).ToString(); string adr = grv.GetFocusedRowCellValue(colAddress).ToString(); string phn = grv.GetFocusedRowCellValue(colPhone).ToString(); string eml = grv.GetFocusedRowCellValue(colEmail).ToString(); byte[] pho = (byte[])grv.GetFocusedRowCellValue(colPHO); UserForms.Customer frm = new UserForms.Customer(true); frm.CustomerName = cnm; frm.Address = adr; frm.PhoneNo = phn; frm.Email = eml; frm.CustomerPhoto = UserClass.Utils.ConvertImage(pho); if(frm.ShowDialog() == DialogResult.OK) { if(frm.ImageLocation != null) cus.UpdateCustomer(frm.CustomerName, frm.Address, frm.PhoneNo, frm.Email, UserClass.Utils.ConvertImage(frm.ImageLocation), id); else cus.UpdateCustomerWoPhoto(frm.CustomerName, frm.Address, frm.PhoneNo, frm.Email, id); } grd.DataSource = cus.GetAllCustomers(); }