public bool Delete(Department department) { Database db = DatabaseFactory.CreateDatabase(Constants.HBMCONNECTIONSTRING); DbCommand command = db.GetStoredProcCommand("usp_DepartmentDelete"); db.AddInParameter(command, "@DepartmentId", DbType.Int32, department.DepartmentId); db.ExecuteNonQuery(command); return true; }
public bool Insert(Department department) { Database db = DatabaseFactory.CreateDatabase(Constants.HBMCONNECTIONSTRING); DbCommand command = db.GetStoredProcCommand("usp_DepartmentInsert"); db.AddInParameter(command, "@CompanyId", DbType.Int32, department.CompanyId); db.AddInParameter(command, "@DepartmentName", DbType.String, department.DepartmentName); db.AddInParameter(command, "@CreatedBy", DbType.Int32, department.CreatedBy); db.AddInParameter(command, "@CreatedDate", DbType.DateTime, department.CreatedDate); db.ExecuteNonQuery(command); return true; }
public bool IsDuplicateTypeName(Department department) { bool result = false; Database db = DatabaseFactory.CreateDatabase(Constants.HBMCONNECTIONSTRING); DbCommand dbCommand = db.GetStoredProcCommand("usp_DepartmentIsDuplicateTypeName"); db.AddInParameter(dbCommand, "@CompanyId", DbType.Int32, department.CompanyId); db.AddInParameter(dbCommand, "@DepartmentId", DbType.Int32, department.DepartmentId); db.AddInParameter(dbCommand, "@DepartmentName", DbType.String, department.DepartmentName); db.AddOutParameter(dbCommand, "@IsExist", DbType.Boolean, 1); db.ExecuteNonQuery(dbCommand); result = Convert.ToBoolean(db.GetParameterValue(dbCommand, "@IsExist").ToString()); return result; }
public DataSet SelectAll(Department department) { Database db = DatabaseFactory.CreateDatabase(Constants.HBMCONNECTIONSTRING); DbCommand dbCommand = db.GetStoredProcCommand("usp_DepartmentSelectAll"); db.AddInParameter(dbCommand, "@CompanyId", DbType.Int32, department.CompanyId); return db.ExecuteDataSet(dbCommand); }