Exemplo n.º 1
0
 public DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable isExistTimeHed(DataSet.DsPSMS.ST_TIMETABLE_HEDRow dr)
 {
     if (dr == null)
     {
         return(null);
     }
     try
     {
         timedb.Open();
         DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable dt = timedb.isExitTimeHedData(dr);
         if (dt != null && (dt.Rows.Count > 0))
         {
             return(dt);
         }
         else
         {
             return(null);
         }
     }
     catch
     {
         return(null);
     }
     finally
     {
         timedb.Close();
     }
 }
Exemplo n.º 2
0
        public DataSet.DsPSMS.ST_TIMETABLE_HEDRow searchTimeHedBygradeclassid(int gradeId, int classId)
        {
            DataSet.DsPSMS.ST_TIMETABLE_HEDRow resultData = new DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable().NewST_TIMETABLE_HEDRow();
            try
            {
                timedb.Open();
                resultData = timedb.selectTimeHedBygradeclass(gradeId, classId);
                if (resultData != null)
                {
                    //msg = resultData.Rows.Count + " user found";
                }

                else
                {
                    resultData = null;
                    //msg = "user not found";
                }
            }
            catch
            {
                // msg = "error has occure when insert data";
                return(null);
            }
            finally
            {
                timedb.Close();
            }
            return(resultData);
        }
Exemplo n.º 3
0
        public DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable getAllTimetableHedData(out string msg)
        {
            DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable result = new DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable();
            try
            {
                timedb.Open();
                result = timedb.selectAllTimetableHed();
                if (result != null && result.Rows.Count > 0)
                {
                    msg = result.Rows.Count + " user found";
                }

                else
                {
                    result = null;
                    msg    = "user not found";
                }
            }
            catch
            {
                msg = "error has occure when insert data";
                return(null);
            }
            finally
            {
                timedb.Close();
            }
            return(result);
        }
        public DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable selectAllTimetableHed()
        {
            string         query = "SELECT * FROM ST_TIMETABLE_HED WHERE DEL_FLG=0 ";
            SqlCommand     cmd   = new SqlCommand(query, conn);
            SqlDataAdapter da    = new SqlDataAdapter(cmd);

            DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable dt = new DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable();
            da.Fill(dt);
            return(dt);
        }
        public DataSet.DsPSMS.ST_TIMETABLE_HEDRow selectTimeHedBygradeclass(int gradeId, int classId)
        {
            //conn.Open();
            string         query = "SELECT * FROM ST_TIMETABLE_HED WHERE GRADE_ID=" + gradeId + " AND ROOM_ID=" + classId;
            SqlCommand     cmd   = new SqlCommand(query, conn);
            SqlDataAdapter da    = new SqlDataAdapter(cmd);

            DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable dt = new DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable();
            da.Fill(dt);
            //return single row
            return(dt[0]);
        }
        public DataSet.DsPSMS.ST_TIMETABLE_HEDRow selectTimetableHedByid(int id)
        {
            //conn.Open();
            string         query = "SELECT * FROM ST_TIMETABLE_HED WHERE TIMETABLE_ID=" + id;
            SqlCommand     cmd   = new SqlCommand(query, conn);
            SqlDataAdapter da    = new SqlDataAdapter(cmd);

            DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable dt = new DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable();
            da.Fill(dt);
            //return single row
            return(dt[0]);
        }
        private bool checkAldyRecord(DataSet.DsPSMS.ST_TIMETABLE_HEDRow drr)
        {
            bool alreadyExist = false;

            for (int i = 0; i < gvRoomTeacher.Rows.Count; i++)
            {
                DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable result = timeService.isExistTimeHed(drr);
                if (result != null && result.Rows.Count > 0)
                {
                    alreadyExist = true;
                }
                else
                {
                    alreadyExist = false;
                }
            }
            return(alreadyExist);
        }
        public void DisplayRoomTeacher()
        {
            DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable resultDt = timeService.getAllTimetableHedData(out msg);

            if (resultDt != null)
            {
                foreach (DataSet.DsPSMS.ST_TIMETABLE_HEDRow row in resultDt.Rows)
                {
                    int    gradeId;
                    string gradevalue = null;

                    int    teacherId;
                    string teachervalue = null;

                    if (row.GRADE_ID != null)
                    {
                        gradeId = int.Parse(row.GRADE_ID);
                        DataSet.DsPSMS.ST_GRADE_MSTRow grade = timeService.getGradeByid(gradeId);
                        gradevalue   = grade.GRADE_NAME;
                        row.GRADE_ID = gradevalue;
                    }

                    if (row.ROOM_TEACHER_ID != null)
                    {
                        teacherId = int.Parse(row.ROOM_TEACHER_ID);
                        DataSet.DsPSMS.ST_TEACHER_DATARow teacher = timeService.getTeacherByid(teacherId);
                        teachervalue        = teacher.TEACHER_NAME;
                        row.ROOM_TEACHER_ID = teachervalue;
                    }

                    if (row.ROOM_ID != null)
                    {
                        int roomId = int.Parse(row.ROOM_ID);
                        DataSet.DsPSMS.ST_ROOM_MSTRow room = timeService.getClassByid(roomId);
                        string roomvalue = room.ROOM_NAME;
                        row.ROOM_ID = roomvalue;
                    }
                }
                gvRoomTeacher.DataSource = resultDt;
                gvRoomTeacher.DataBind();
            }
        }
        public DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable isExitTimeHedData(DataSet.DsPSMS.ST_TIMETABLE_HEDRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            string query = "SELECT * FROM ST_TIMETABLE_HED ";

            string where = "";
            if (dr.GRADE_ID != null)
            {
                where += " GRADE_ID = '" + dr.GRADE_ID + "'";
            }

            if (dr.ROOM_ID != null)
            {
                if (where.Length > 0)
                {
                    where += " AND ROOM_ID= '" + dr.ROOM_ID + "'";
                }
            }
            if (dr.ROOM_TEACHER_ID != null)
            {
                if (where.Length > 0)
                {
                    where += " AND ROOM_TEACHER_ID= '" + dr.ROOM_TEACHER_ID + "'";
                }
            }

            if (where.Length > 0)
            {
                query += " WHERE " + where;
            }

            SqlCommand     cmd = new SqlCommand(query, conn);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);

            DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable dt = new DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable();
            da.Fill(dt);
            return(dt);
        }
Exemplo n.º 10
0
 public DataSet.DsPSMS.ST_TIMETABLE_HEDRow getTimetableHedByid(int id)
 {
     DataSet.DsPSMS.ST_TIMETABLE_HEDRow resultData = new DataSet.DsPSMS.ST_TIMETABLE_HEDDataTable().NewST_TIMETABLE_HEDRow();
     resultData = timedb.selectTimetableHedByid(id);
     return(resultData);
 }