Ejemplo n.º 1
0
        public static StudentHouse Select(int StudentHouseId)
        {
            StudentHouse studentHouse = new StudentHouse();
               studentHouse.StudentHouseId = StudentHouseId;
               if (!new StudentHouseDAO().Select(studentHouse))
               {
               studentHouse = null;
               }

               return studentHouse;
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 3
0
        public static StudentHouse Select(int StudentHouseId)
        {
            StudentHouse studentHouse = new StudentHouse();

            studentHouse.StudentHouseId = StudentHouseId;
            if (!new StudentHouseDAO().Select(studentHouse))
            {
                studentHouse = null;
            }

            return(studentHouse);
        }
Ejemplo n.º 4
0
        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()));
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
        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;
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
 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();
        }
Ejemplo n.º 13
0
        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;
        }