public static StudentHouse Select(int StudentHouseId) { StudentHouse studentHouse = new StudentHouse(); studentHouse.StudentHouseId = StudentHouseId; if (!new StudentHouseDAO().Select(studentHouse)) { studentHouse = null; } return studentHouse; }
public bool IsHouseExist(StudentHouse studentHouse) { Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); DbCommand command = db.GetStoredProcCommand("usp_House_IsHouseExist"); db.AddInParameter(command, "HouseId", DbType.Guid, studentHouse.HouseId); db.AddOutParameter(command, "IsExist", DbType.Boolean, 1); db.ExecuteNonQuery(command); return Convert.ToBoolean(db.GetParameterValue(command, "IsExist").ToString()); }
public static StudentHouse Select(int StudentHouseId) { StudentHouse studentHouse = new StudentHouse(); studentHouse.StudentHouseId = StudentHouseId; if (!new StudentHouseDAO().Select(studentHouse)) { studentHouse = null; } return(studentHouse); }
public bool IsHouseExist(StudentHouse studentHouse) { Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); DbCommand command = db.GetStoredProcCommand("usp_House_IsHouseExist"); db.AddInParameter(command, "HouseId", DbType.Guid, studentHouse.HouseId); db.AddOutParameter(command, "IsExist", DbType.Boolean, 1); db.ExecuteNonQuery(command); return(Convert.ToBoolean(db.GetParameterValue(command, "IsExist").ToString())); }
public bool Delete(StudentHouse studentHouse, Database db, DbTransaction transaction) { DbCommand command = db.GetStoredProcCommand("usp_StudentHouseDelete"); db.AddInParameter(command, "StudentHouseId", DbType.Int16, studentHouse.StudentHouseId); db.AddInParameter(command, "UpdatedBy", DbType.Guid, studentHouse.UpdatedBy); if (transaction == null) { db.ExecuteNonQuery(command); } else { db.ExecuteNonQuery(command, transaction); } return true; }
public bool Delete(StudentHouse studentHouse, Database db, DbTransaction transaction) { DbCommand command = db.GetStoredProcCommand("usp_StudentHouseDelete"); db.AddInParameter(command, "StudentHouseId", DbType.Int16, studentHouse.StudentHouseId); db.AddInParameter(command, "UpdatedBy", DbType.Guid, studentHouse.UpdatedBy); if (transaction == null) { db.ExecuteNonQuery(command); } else { db.ExecuteNonQuery(command, transaction); } return(true); }
public bool Select(StudentHouse entity) { bool result = true; Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); DbCommand dbCommand = db.GetStoredProcCommand("usp_StudentHouseSelect"); db.AddInParameter(dbCommand, "StudentHouseId", DbType.Int16, entity.StudentHouseId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { if (entity == null) { entity = new StudentHouse(); } RHP.Utility.Generic.AssignDataReaderToEntity(dataReader, entity); } } return(result); }
public bool Select(StudentHouse entity) { bool result = true; Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); DbCommand dbCommand = db.GetStoredProcCommand("usp_StudentHouseSelect"); db.AddInParameter(dbCommand, "StudentHouseId", DbType.Int16, entity.StudentHouseId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { if (entity == null) { entity = new StudentHouse(); } RHP.Utility.Generic.AssignDataReaderToEntity(dataReader, entity); } } return result; }
public bool Insert(StudentHouse studentHouse, Database db, DbTransaction transaction) { DbCommand command = db.GetStoredProcCommand("usp_StudentHouseInsert"); db.AddInParameter(command, "HouseId", DbType.Guid, studentHouse.HouseId); db.AddInParameter(command, "UserId", DbType.Guid, studentHouse.UserId); db.AddInParameter(command, "IsDeleted", DbType.Boolean, studentHouse.IsDeleted); db.AddInParameter(command, "CreatedBy", DbType.Guid, studentHouse.CreatedBy); db.AddOutParameter(command, "CreatedDate", DbType.DateTime, 30); if (transaction == null) { db.ExecuteNonQuery(command); } else { db.ExecuteNonQuery(command, transaction); } studentHouse.CreatedDate = Convert.ToDateTime(db.GetParameterValue(command, "CreatedDate").ToString()); studentHouse.UpdatedDate = studentHouse.CreatedDate; return true; }
public bool Insert(StudentHouse studentHouse, Database db, DbTransaction transaction) { DbCommand command = db.GetStoredProcCommand("usp_StudentHouseInsert"); db.AddInParameter(command, "HouseId", DbType.Guid, studentHouse.HouseId); db.AddInParameter(command, "UserId", DbType.Guid, studentHouse.UserId); db.AddInParameter(command, "IsDeleted", DbType.Boolean, studentHouse.IsDeleted); db.AddInParameter(command, "CreatedBy", DbType.Guid, studentHouse.CreatedBy); db.AddOutParameter(command, "CreatedDate", DbType.DateTime, 30); if (transaction == null) { db.ExecuteNonQuery(command); } else { db.ExecuteNonQuery(command, transaction); } studentHouse.CreatedDate = Convert.ToDateTime(db.GetParameterValue(command, "CreatedDate").ToString()); studentHouse.UpdatedDate = studentHouse.CreatedDate; return(true); }
public bool Insert(StudentHouse studentHouse) { Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); return this.Insert(studentHouse, db, null); }
public void Save_Student_House(User user_) { StudentHouse studentHouse = new StudentHouse(); // save current house for student user_.HouseId = Guid.Parse(hdHouseId.Value); user_.UpdateHouse(); // log house details for futer use studentHouse.HouseId = Guid.Parse(hdHouseId.Value); studentHouse.UserId = user_.UserId.Value; studentHouse.CreatedBy = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); studentHouse.UpdatedBy = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); studentHouse.Save(); }
public bool Update(StudentHouse studentHouse) { Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); return(this.Update(studentHouse, db, null)); }
public bool Save_Student_House() { bool result = true; User user = new User(); StudentHouse studentHouse = new StudentHouse(); user.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); user.HouseId = Guid.Parse(hdHouseId.Value); user.UpdatedBy = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); user.CreatedBy = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); if (user.UpdateHouse()) { studentHouse.HouseId = user.HouseId.Value; studentHouse.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); studentHouse.CreatedBy = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); studentHouse.UpdatedBy = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()); result = studentHouse.Save(); } return result; }