Exemplo n.º 1
0
        public static DayCarePL.ProgScheduleProperties CheckDuplicateProgClassRoom(Guid ClassRoomId, DateTime BeginTime, DateTime EndTime, Int32 DayIndex, Guid Id)
        {
            bool result = false;

            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clProgSchedule, "CheckDuplicateProgClassRoom", "Execute CheckDuplicateProgClassRoom Method", DayCarePL.Common.GUID_DEFAULT);
            clConnection.DoConnection();
            DayCarePL.ProgScheduleProperties objProgSchedule = null;
            DayCareDataContext db = new DayCareDataContext();

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clProgSchedule, "CheckDuplicateProgClassRoom", "Debug CheckDuplicateProgClassRoom Method", DayCarePL.Common.GUID_DEFAULT);

                var data = db.spGetCheckDuplicateProgClassRoomId(ClassRoomId, BeginTime, EndTime, DayIndex, Id);

                foreach (var c in data)
                {
                    result          = true;
                    objProgSchedule = new DayCarePL.ProgScheduleProperties();
                    objProgSchedule.SchoolProgramTitle = c.Program;
                    objProgSchedule.ProgClassRoomTitle = c.ClassRoomTitle;
                    objProgSchedule.BeginTime          = c.BeginTime;
                    objProgSchedule.EndTime            = c.EndTime;
                    objProgSchedule.Day = c.Day;

                    break;
                }
                return(objProgSchedule);
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clProgSchedule, "CheckDuplicateProgClassRoom", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(null);
            }
        }