/// <summary> /// Deletes company based on company id from database.... /// </summary> /// <param name="id"></param> /// <returns>Returns true if delted successfully else returns false...</returns> public bool Delete(int comp_Id) { using (eSuiteEntities db = new eSuiteEntities()) { try { db.Entry(db.SETUP_Company.Find(comp_Id)).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); return(true); } catch { return(false); } } }
/// <summary> /// Adds new company to the database.... /// </summary> /// <param name="company"></param> /// <returns>Returns new company id if saved successfully else returns 0</returns> public int Add(SETUP_Company company) { using (eSuiteEntities db = new eSuiteEntities()) { try { db.Entry(company).State = System.Data.Entity.EntityState.Added; db.SaveChanges(); return(company.Comp_Id); } catch { return(0); } } }
/// <summary> /// Updates modified values of company to the database.... /// </summary> /// <param name="company"></param> /// <returns>Returns true if updated successfully else returns false.</returns> public bool Update(SETUP_Company company) { using (eSuiteEntities db = new eSuiteEntities()) { try { db.Entry(company).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } } }
/// <summary> /// Adds new department to the database.... /// </summary> /// <param name="department"></param> /// <returns>Returns new department id if saved successfully else returns 0</returns> public int Add(SETUP_Department department) { using (eSuiteEntities db = new eSuiteEntities()) { try { db.Entry(department).State = System.Data.Entity.EntityState.Added; db.SaveChanges(); return(department.Dep_Id); } catch { return(0); } } }