private void tileAddUser_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e) { if (isProductGrid) { using (frmEditProduct frm = new frmEditProduct(null)) { if (frm.ShowDialog() == DialogResult.OK) { productBindingSource.DataSource = db.Products.ToList(); } } } else if (isBrandGrid) { using (frmEditBrands frm = new frmEditBrands(null)) { if (frm.ShowDialog() == DialogResult.OK) { brandBindingSource.DataSource = db.Brands.ToList(); } } } else if (isCategoriesGrid) { using (frmEditCategory frm = new frmEditCategory(null)) { if (frm.ShowDialog() == DialogResult.OK) { categoryBindingSource.DataSource = db.categories.ToList(); } } } }
private void gridCategories_DoubleClick(object sender, EventArgs e) { if (categoryBindingSource.Current == null) { return; } using (frmEditCategory frm = new frmEditCategory(categoryBindingSource.Current as category)) { if (frm.ShowDialog() == DialogResult.OK) { categoryBindingSource.DataSource = db.categories.ToList(); } } }
private void tileEdit_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e) { if (isProductGrid) { if (productBindingSource.Current == null) { return; } using (frmEditProduct frm = new frmEditProduct(productBindingSource.Current as Product)) { if (frm.ShowDialog() == DialogResult.OK) { productBindingSource.DataSource = db.Products.ToList(); } } } else if (isBrandGrid) { if (brandBindingSource.Current == null) { return; } using (frmEditBrands frm = new frmEditBrands(brandBindingSource.Current as Brand)) { if (frm.ShowDialog() == DialogResult.OK) { brandBindingSource.DataSource = db.Brands.ToList(); } } } else if (isCategoriesGrid) { if (categoryBindingSource.Current == null) { return; } using (frmEditCategory frm = new frmEditCategory(categoryBindingSource.Current as category)) { if (frm.ShowDialog() == DialogResult.OK) { categoryBindingSource.DataSource = db.categories.ToList(); } } } }
public bool Edit() { TreeTag treetag = m_Node.Tag as TreeTag; if (treetag == null) { return(false); } try { if (treetag.NodeTye == TreeTag.Types.Category) { Category cate; using (IUnitOfWork uow = new UnitOfWork()) { cate = uow.CategoryRepository.Find(treetag.CateId); uow.Commit(); } if (cate == null) { return(false); } frmEditCategory frmEdit = new frmEditCategory(cate); frmEdit.UpdateNode = updateNode; frmEdit.ShowDialog(); } if (treetag.NodeTye == TreeTag.Types.Serie) { Series serie; using (IUnitOfWork uow = new UnitOfWork()) { serie = uow.SeriesRepository.Find(treetag.SerieId); uow.Commit(); } if (serie == null) { return(false); } frmEditSerie frmEdit = new frmEditSerie(serie, treetag); frmEdit.UpdateNode = updateNode; frmEdit.ShowDialog(); } if (treetag.NodeTye == TreeTag.Types.Line) { ProductLine line; using (IUnitOfWork uow = new UnitOfWork()) { line = uow.ProductLineRepository.Find(treetag.LineId); uow.Commit(); } if (line == null) { return(false); } frmEditProductLine frmEdit = new frmEditProductLine(line, treetag); frmEdit.UpdateNode = updateNode; frmEdit.ShowDialog(); } return(true); } catch { return(false); } }