Пример #1
0
        public void Delete(Courses entity)
        {
            using (SqlConnection conn = new SqlConnection(DB_Helper.GetConnection()))
            {
                conn.Open();

                SqlCommand com = new SqlCommand();
                com.CommandText = "proc_Courses_Delete";
                com.CommandType = CommandType.StoredProcedure;
                com.Connection  = conn;
                com.Parameters.AddWithValue("@ID", entity.ID);

                com.ExecuteNonQuery();
            }
        }
        public void Add(Instructor entity)
        {
            using (SqlConnection conn = new SqlConnection(DB_Helper.GetConnection()))
            {
                conn.Open();

                SqlCommand com = new SqlCommand();
                com.CommandText = "proc_Instructor_Add";
                com.CommandType = CommandType.StoredProcedure;
                com.Connection  = conn;
                com.Parameters.AddWithValue("@ID", entity.ID);
                com.Parameters.AddWithValue("@HireDate", entity.HireDate);

                com.ExecuteNonQuery();
            }
        }
Пример #3
0
        public List <People> PrintAll()
        {
            using (SqlConnection conn = new SqlConnection(DB_Helper.GetConnection()))
            {
                conn.Open();

                SqlCommand com = new SqlCommand();
                com.CommandText = "proc_People_PrintAll";
                com.CommandType = CommandType.StoredProcedure;
                com.Connection  = conn;

                SqlDataReader reader = com.ExecuteReader();
                List <People> list   = new List <People>();

                while (reader.Read())
                {
                    People people = new People();
                    people.ID                    = Convert.ToInt32(reader["ID"]);
                    people.LastName              = reader["LastName"].ToString();
                    people.FirstName             = reader["FirstName"].ToString();
                    people.MiddleName            = reader["MiddleName"].ToString();
                    people.Age                   = Convert.ToInt32(reader["Age"]);
                    people.Email                 = reader["Email"].ToString();
                    people.Phone                 = reader["Phone"].ToString();
                    people.AddressLine1          = reader["AddressLine1"].ToString();
                    people.AddressLine2          = reader["AddressLine2"].ToString();
                    people.UnitOrApartmentNumber = Convert.ToInt32(reader["UnitOrApartmentNumber"]);
                    people.City                  = reader["City"].ToString();
                    people.State                 = reader["State"].ToString();
                    people.ZipCode               = reader["ZipCode"].ToString();
                    people.CreatedDate           = Convert.ToDateTime(reader["CreatedDate"]);
                    people.CreatedBy             = reader["CreatedBy"].ToString();
                    people.UpdatedDate           = Convert.ToDateTime(reader["UpdatedDate"]);
                    people.UpdatedBy             = reader["UpdatedBy"].ToString();
                    people.Password              = reader["Password"].ToString();
                    people.Salt                  = reader["Salt"].ToString();
                    people.IsLocked              = Convert.ToBoolean(reader["IsLocked"]);
                    people.LastLockedDateTime    = Convert.ToDateTime(reader["LastLockedDateTime"]);
                    people.FailedAttempts        = Convert.ToInt32(reader["FailedAttempts"]);
                    list.Add(people);
                }
                return(list);
            }
        }
Пример #4
0
        public void Add(Courses entity)
        {
            using (SqlConnection conn = new SqlConnection(DB_Helper.GetConnection()))
            {
                conn.Open();

                SqlCommand com = new SqlCommand();
                com.CommandText = "proc_Courses_Add";
                com.CommandType = CommandType.StoredProcedure;
                com.Connection  = conn;

                com.Parameters.AddWithValue("@Title", entity.Title);
                com.Parameters.AddWithValue("@Credits", entity.Credits);
                com.Parameters.AddWithValue("@DepartmentID", entity.DepartmentID);
                com.Parameters.AddWithValue("@CreatedDate", entity.CreatedDate);
                com.Parameters.AddWithValue("@CreatedBy", entity.CreatedBy);
                com.Parameters.AddWithValue("@UpdatedDate", entity.UpdatedDate);
                com.Parameters.AddWithValue("@UpdatedBy", entity.UpdatedBy);

                com.ExecuteNonQuery();
            }
        }
        public Instructor PrintOne(int id)
        {
            using (SqlConnection conn = new SqlConnection(DB_Helper.GetConnection()))
            {
                conn.Open();

                SqlCommand com = new SqlCommand();
                com.CommandText = "proc_Instructor_PrintOne";
                com.CommandType = CommandType.StoredProcedure;
                com.Connection  = conn;

                com.Parameters.AddWithValue("ID", id);
                SqlDataReader reader     = com.ExecuteReader();
                Instructor    instructor = new Instructor();

                while (reader.Read())
                {
                    instructor.ID       = Convert.ToInt32(reader["ID"]);
                    instructor.HireDate = Convert.ToDateTime(reader["HireDate"]);
                }
                return(instructor);
            }
        }
Пример #6
0
        public void Update(People entity)
        {
            using (SqlConnection conn = new SqlConnection(DB_Helper.GetConnection()))
            {
                conn.Open();

                SqlCommand com = new SqlCommand();
                com.CommandText = "proc_People_Update";
                com.CommandType = CommandType.StoredProcedure;
                com.Connection  = conn;

                com.Parameters.AddWithValue("@ID", entity.ID);
                com.Parameters.AddWithValue("@LastName", entity.LastName);
                com.Parameters.AddWithValue("@FirstName", entity.FirstName);
                com.Parameters.AddWithValue("@MiddleName", entity.MiddleName);
                com.Parameters.AddWithValue("@Age", entity.Age);
                com.Parameters.AddWithValue("@Email", entity.Email);
                com.Parameters.AddWithValue("@Phone", entity.Phone);
                com.Parameters.AddWithValue("@AddressLine1", entity.AddressLine1);
                com.Parameters.AddWithValue("@AddressLine2", entity.AddressLine2);
                com.Parameters.AddWithValue("@UnitOrApartmentNumber", entity.UnitOrApartmentNumber);
                com.Parameters.AddWithValue("@City", entity.City);
                com.Parameters.AddWithValue("@State", entity.State);
                com.Parameters.AddWithValue("@ZipCode", entity.ZipCode);
                com.Parameters.AddWithValue("@CreatedDate", entity.CreatedDate);
                com.Parameters.AddWithValue("@CreatedBy", entity.CreatedBy);
                com.Parameters.AddWithValue("@UpdatedDate", entity.UpdatedDate);
                com.Parameters.AddWithValue("@UpdatedBy", entity.UpdatedBy);
                com.Parameters.AddWithValue("@Password", entity.Password);
                com.Parameters.AddWithValue("@Salt", entity.Salt);
                com.Parameters.AddWithValue("@IsLocked", entity.IsLocked);
                com.Parameters.AddWithValue("@LastLockedDateTime", entity.LastLockedDateTime);
                com.Parameters.AddWithValue("@FailedAttempts", entity.FailedAttempts);

                com.ExecuteNonQuery();
            }
        }
        public List <Instructor> PrintAll()
        {
            using (SqlConnection conn = new SqlConnection(DB_Helper.GetConnection()))
            {
                conn.Open();

                SqlCommand com = new SqlCommand();
                com.CommandText = "proc_Instructor_PrintAll";
                com.CommandType = CommandType.StoredProcedure;
                com.Connection  = conn;

                SqlDataReader     reader = com.ExecuteReader();
                List <Instructor> list   = new List <Instructor>();

                while (reader.Read())
                {
                    Instructor instructor = new Instructor();
                    instructor.ID       = Convert.ToInt32(reader["ID"]);
                    instructor.HireDate = Convert.ToDateTime(reader["HireDate"]);
                    list.Add(instructor);
                }
                return(list);
            }
        }
Пример #8
0
        public void Add(Departments entity)
        {
            using (SqlConnection conn = new SqlConnection(DB_Helper.GetConnection()))
            {
                conn.Open();

                SqlCommand com = new SqlCommand();
                com.CommandText = "proc_Departments_Add";
                com.CommandType = CommandType.StoredProcedure;
                com.Connection  = conn;

                com.Parameters.AddWithValue("@Name", entity.Name);
                com.Parameters.AddWithValue("@Budget", entity.Budget);
                com.Parameters.AddWithValue("@StartDate", entity.StartDate);
                com.Parameters.AddWithValue("@InstructorID", entity.InstructorID);
                com.Parameters.AddWithValue("@RowVersion", entity.RowVersion);
                com.Parameters.AddWithValue("@CreatedDate", entity.CreatedDate);
                com.Parameters.AddWithValue("@CreatedBy", entity.CreatedBy);
                com.Parameters.AddWithValue("@UpdatedDate", entity.UpdatedDate);
                com.Parameters.AddWithValue("@UpdatedBy", entity.UpdatedBy);

                com.ExecuteNonQuery();
            }
        }