public int Create(CategoryEN category) { try { SessionInitializeTransaction(); session.Save(category); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is P2GenNHibernate.Exceptions.ModelException) { throw ex; } throw new P2GenNHibernate.Exceptions.DataLayerException("Error in CategoryCAD.", ex); } finally { SessionClose(); } return(category.CategoryId); }
public CategoryEN ReadOIDDefault(int categoryId) { CategoryEN categoryEN = null; try { SessionInitializeTransaction(); categoryEN = (CategoryEN)session.Get(typeof(CategoryEN), categoryId); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is P2GenNHibernate.Exceptions.ModelException) { throw ex; } throw new P2GenNHibernate.Exceptions.DataLayerException("Error in CategoryCAD.", ex); } finally { SessionClose(); } return(categoryEN); }
public void Modify(CategoryEN category) { try { SessionInitializeTransaction(); CategoryEN categoryEN = (CategoryEN)session.Load(typeof(CategoryEN), category.CategoryId); categoryEN.Name = category.Name; categoryEN.Descripcion = category.Descripcion; session.Update(categoryEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is P2GenNHibernate.Exceptions.ModelException) { throw ex; } throw new P2GenNHibernate.Exceptions.DataLayerException("Error in CategoryCAD.", ex); } finally { SessionClose(); } }
public void Delete(int categoryId) { try { SessionInitializeTransaction(); CategoryEN categoryEN = (CategoryEN)session.Load(typeof(CategoryEN), categoryId); session.Delete(categoryEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is P2GenNHibernate.Exceptions.ModelException) { throw ex; } throw new P2GenNHibernate.Exceptions.DataLayerException("Error in CategoryCAD.", ex); } finally { SessionClose(); } }
public void Modify(int p_oid, string p_name, string p_descripcion) { CategoryEN categoryEN = null; //Initialized CategoryEN categoryEN = new CategoryEN(); categoryEN.CategoryId = p_oid; categoryEN.Name = p_name; categoryEN.Descripcion = p_descripcion; //Call to CategoryCAD _ICategoryCAD.Modify(categoryEN); }
public int Create(int p_categoryId, string p_name, string p_descripcion) { CategoryEN categoryEN = null; int oid; //Initialized CategoryEN categoryEN = new CategoryEN(); categoryEN.CategoryId = p_categoryId; categoryEN.Name = p_name; categoryEN.Descripcion = p_descripcion; //Call to CategoryCAD oid = _ICategoryCAD.Create(categoryEN); return(oid); }