public Models.Meeting.MeetingScheduleModel GetMeetingScheduleByID(int MeetingScheduleID)
        {
            BusinessLogic.Meeting.MeetingScheduleManager MeetingScheduleManager = new BusinessLogic.Meeting.MeetingScheduleManager();
            BusinessEntity.Meeting.MeetingScheduleEntity MeetingSchedule        = MeetingScheduleManager.GetMeetingScheduleByID(MeetingScheduleID);

            return(new Models.Meeting.MeetingScheduleModel(MeetingSchedule));
        }
        public BusinessEntity.Result DeleteMeetingSchedule(BusinessEntity.Meeting.MeetingScheduleEntity MeetingSchedule)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblMeetingSchedules.Find(MeetingSchedule.ID);
                if (original != null)
                {
                    e.tblMeetingSchedules.Remove(e.tblMeetingSchedules.Where(x => x.ID == MeetingSchedule.ID).First());
                    e.SaveChanges();

                    result.Message = "Deleted Successfully.";
                    result.Status  = true;
                    return(result);
                }
                else
                {
                    result.Message = "Failed to delete";
                    result.Status  = false;
                    return(result);
                }
            }
            catch (Exception)
            {
                result.Message = "Failed to delete";
                result.Status  = false;
                return(result);
            }
        }
        public BusinessEntity.Result UpdateMeetingSchedule(BusinessEntity.Meeting.MeetingScheduleEntity MeetingSchedule)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblMeetingSchedules.Find(MeetingSchedule.ID);
                if (original != null)
                {
                    e.Entry(original).CurrentValues.SetValues(MeetingSchedule);
                    e.SaveChanges();

                    result.Message = "Updated Successfully.";
                    result.Status  = true;
                    return(result);
                }
                else
                {
                    result.Message = "Failed to update";
                    result.Status  = false;
                    return(result);
                }
            }
            catch (Exception)
            {
                result.Message = "Failed to update";
                result.Status  = false;
                return(result);
            }
        }
        public MeetingScheduleModel(BusinessEntity.Meeting.MeetingScheduleEntity meetingSchedule)
        {
            this.ID            = meetingSchedule.ID;
            this.Title         = meetingSchedule.Title;
            this.Description   = meetingSchedule.Description;
            this.StartDate     = meetingSchedule.StartDate;
            this.StartTime     = meetingSchedule.StartTime;
            this.EndDate       = meetingSchedule.EndDate;
            this.EndTime       = meetingSchedule.EndTime;
            this.GeneralAgenda = meetingSchedule.GeneralAgenda;
            this.Organizer     = meetingSchedule.Organizer;

            this.MeetingType = new MeetingTypeModel(meetingSchedule.MeetingType);

            this.CreatedBy   = meetingSchedule.CreatedBy;
            this.CreatedDate = meetingSchedule.CreatedDate;
            this.UpdatedBy   = meetingSchedule.UpdatedBy;
            this.UpdatedDate = meetingSchedule.UpdatedDate;
        }
        public BusinessEntity.Result SaveMeetingSchedule(BusinessEntity.Meeting.MeetingScheduleEntity MeetingSchedule)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                e.tblMeetingSchedules.Add(MeetingSchedule.MapToModel <DataAccessLogic.tblMeetingSchedule>());
                e.SaveChanges();

                result.Message = "Saved Successfully.";
                result.Status  = true;
                return(result);
            }
            catch (Exception)
            {
                result.Message = "Failed to save";
                result.Status  = false;
                return(result);
            }
        }
        public T MapToEntity <T>() where T : class
        {
            BusinessEntity.Meeting.MeetingScheduleEntity meetingSchedule = new BusinessEntity.Meeting.MeetingScheduleEntity();
            meetingSchedule.ID            = this.ID;
            meetingSchedule.Title         = this.Title;
            meetingSchedule.Description   = this.Description;
            meetingSchedule.StartDate     = this.StartDate;
            meetingSchedule.StartTime     = this.StartTime;
            meetingSchedule.EndDate       = this.EndDate;
            meetingSchedule.EndTime       = this.EndTime;
            meetingSchedule.GeneralAgenda = this.GeneralAgenda;
            meetingSchedule.Organizer     = this.Organizer;

            meetingSchedule.MeetingType = this.MeetingType.MapToEntity <BusinessEntity.Lookup.MeetingTypeEntity>();

            meetingSchedule.CreatedBy   = this.CreatedBy;
            meetingSchedule.CreatedDate = this.CreatedDate;
            meetingSchedule.UpdatedBy   = this.UpdatedBy;
            meetingSchedule.UpdatedDate = this.UpdatedDate;

            return(meetingSchedule as T);
        }