Example #1
0
        public int DeleteProgram(int id)
        {
            int i = 0;

            using (SqlCommand command = new SqlCommand())
            {
                i = ExecuteNonQuery(ProgramStringsSql.DeleteProgram(id));
            }

            return(i);
        }
Example #2
0
        public Program UpdateProgram(Program value)
        {
            DataTable dt      = new DataTable();
            Program   program = new Program();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(ProgramStringsSql.UpdateProgram(value));
            }

            foreach (DataRow ms in dt.Rows)
            {
                program = Program.ToObject(ms);
            }
            return(GetProgramById(value.programId));
        }
Example #3
0
        public List <Program> GetAllPrograms()
        {
            DataTable      dt          = new DataTable();
            List <Program> arrPrograms = new List <Program>();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(ProgramStringsSql.GetAllPrograms());
            }

            foreach (DataRow ms in dt.Rows)
            {
                arrPrograms.Add(Program.ToObject(ms));
            }

            return(arrPrograms);
        }
Example #4
0
        public Program GetProgramById(int id)
        {
            DataTable dt = new DataTable();

            if (id < 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            Program program = new Program();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(ProgramStringsSql.GetProgramById(id));
            }

            foreach (DataRow ms in dt.Rows)
            {
                program = Program.ToObject(ms);
            }

            return(program);
        }