Esempio n. 1
0
 public void UpdateStatus(DTO.LABURNUM.COM.EventModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         new FrontEndApi.EventApi().UpdateIsActive(model);
     }
 }
Esempio n. 2
0
 private long AddValidation(DTO.LABURNUM.COM.EventModel model)
 {
     model.EventTypeId.TryValidate();
     model.EventName.TryValidate();
     model.Classes.TryValidate();
     return(AddEventType(model));
 }
Esempio n. 3
0
 public dynamic SearchActiveEvents(DTO.LABURNUM.COM.EventModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         return(GetApiResponseModel("Successfully Performed.", true, new EventHelper(new FrontEndApi.EventApi().GetActiveEvents()).Map()));
     }
     else
     {
         return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null));
     }
 }
Esempio n. 4
0
 public List <DTO.LABURNUM.COM.EventModel> SearchEventByAdvanceSearch(DTO.LABURNUM.COM.EventModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         return(new EventHelper(new FrontEndApi.EventApi().GetEventByAdvanceSearch(model)).Map());
     }
     else
     {
         return(null);
     }
 }
Esempio n. 5
0
 public List <DTO.LABURNUM.COM.EventModel> SearchEventForSite(DTO.LABURNUM.COM.EventModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         model.AcademicYearId = new FrontEndApi.AcademicYearTableApi().GetAcademicYearByYear(new Component.Utility().GetISTDateTime().Year).AcademicYearTableId;
         return(new EventHelper(new FrontEndApi.EventApi().GetEventByAdvanceSearch(model)).Map());
     }
     else
     {
         return(null);
     }
 }
Esempio n. 6
0
 public long Add(DTO.LABURNUM.COM.EventModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         model.AcademicYearId = new FrontEndApi.AcademicYearTableApi().GetAcademicYearByYear(new Component.Utility().GetISTDateTime().Year).AcademicYearTableId;
         return(new FrontEndApi.EventApi().Add(model));
     }
     else
     {
         return(-1);
     }
 }
Esempio n. 7
0
 private long AddEventType(DTO.LABURNUM.COM.EventModel model)
 {
     API.LABURNUM.COM.Event apievent = new Event()
     {
         EventDate      = model.EventDate,
         EventName      = model.EventName,
         EventTypeId    = model.EventTypeId,
         Classes        = model.Classes,
         AcademicYearId = model.AcademicYearId,
         CreatedOn      = new Component.Utility().GetISTDateTime(),
         IsActive       = true
     };
     this._laburnum.Events.Add(apievent);
     this._laburnum.SaveChanges();
     return(apievent.EventId);
 }
Esempio n. 8
0
 private DTO.LABURNUM.COM.EventModel MapCore(API.LABURNUM.COM.Event apiEvent)
 {
     DTO.LABURNUM.COM.EventModel dtoClass = new DTO.LABURNUM.COM.EventModel()
     {
         EventId          = apiEvent.EventId,
         EventName        = apiEvent.EventName,
         EventTypeId      = apiEvent.EventTypeId,
         AcademicYearId   = apiEvent.AcademicYearId,
         Classes          = apiEvent.Classes,
         EventDate        = apiEvent.EventDate,
         EventTypeText    = apiEvent.EventType.Text,
         AcademicYearText = apiEvent.AcademicYearTable.StartYear + "-" + apiEvent.AcademicYearTable.EndYear,
         CreatedOn        = apiEvent.CreatedOn,
         IsActive         = apiEvent.IsActive,
         LastUpdated      = apiEvent.LastUpdated
     };
     return(dtoClass);
 }
Esempio n. 9
0
        public void UpdateIsActive(DTO.LABURNUM.COM.EventModel model)
        {
            model.EventId.TryValidate();
            IQueryable <API.LABURNUM.COM.Event> iQuery       = this._laburnum.Events.Where(x => x.EventId == model.EventId && x.IsActive == true);
            List <API.LABURNUM.COM.Event>       dbEventTypes = iQuery.ToList();

            if (dbEventTypes.Count == 0)
            {
                throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND);
            }
            if (dbEventTypes.Count > 1)
            {
                throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND);
            }
            dbEventTypes[0].IsActive    = model.IsActive;
            dbEventTypes[0].LastUpdated = new Component.Utility().GetISTDateTime();
            this._laburnum.SaveChanges();
        }
Esempio n. 10
0
 public long Add(DTO.LABURNUM.COM.EventModel model)
 {
     return(AddValidation(model));
 }
Esempio n. 11
0
        public List <API.LABURNUM.COM.Event> GetEventByAdvanceSearch(DTO.LABURNUM.COM.EventModel model)
        {
            IQueryable <API.LABURNUM.COM.Event> iQuery = null;

            if (model.EventId > 0)
            {
                iQuery = this._laburnum.Events.Where(x => x.EventId == model.EventId && x.IsActive == true);
            }
            //Search By AcademicYearId.
            if (iQuery != null)
            {
                if (model.AcademicYearId > 0)
                {
                    iQuery = iQuery.Where(x => x.AcademicYearId == model.AcademicYearId && x.IsActive == true);
                }
            }
            else
            {
                if (model.AcademicYearId > 0)
                {
                    iQuery = this._laburnum.Events.Where(x => x.AcademicYearId == model.AcademicYearId && x.IsActive == true);
                }
            }
            //Search By EventTypeId.
            if (iQuery != null)
            {
                if (model.EventTypeId > 0)
                {
                    iQuery = iQuery.Where(x => x.EventTypeId == model.EventTypeId && x.IsActive == true);
                }
            }
            else
            {
                if (model.EventTypeId > 0)
                {
                    iQuery = this._laburnum.Events.Where(x => x.EventTypeId == model.EventTypeId && x.IsActive == true);
                }
            }

            //Search By EventName.
            if (iQuery != null)
            {
                if (model.EventName != null)
                {
                    iQuery = iQuery.Where(x => x.EventName.Contains(model.EventName) && x.IsActive == true);
                }
            }
            else
            {
                if (model.EventName != null)
                {
                    iQuery = this._laburnum.Events.Where(x => x.EventName.Contains(model.EventName) && x.IsActive == true);
                }
            }

            //Search By Date Range.
            if (iQuery != null)
            {
                if (model.StartDate.Year != 0001)
                {
                    model.StartDate = new Component.Utility().GetDate(model.StartDate);
                }
                if (model.EndDate.Year != 0001)
                {
                    model.EndDate = new Component.Utility().GetDate(model.EndDate).AddDays(1).AddSeconds(-1);
                }
                if (model.EndDate.Year == 0001)
                {
                    model.EndDate = model.StartDate.AddDays(1).AddSeconds(-1);
                }

                if (model.StartDate.Year != 0001)
                {
                    iQuery = iQuery.Where(x => x.EventDate >= model.StartDate && x.EventDate <= model.EndDate && x.IsActive == true);
                }
            }
            else
            {
                if (model.StartDate.Year != 0001)
                {
                    model.StartDate = new Component.Utility().GetDate(model.StartDate);
                }
                if (model.EndDate.Year != 0001)
                {
                    model.EndDate = new Component.Utility().GetDate(model.EndDate).AddDays(1).AddSeconds(-1);
                }
                if (model.EndDate.Year == 0001)
                {
                    model.EndDate = model.StartDate.AddDays(1).AddSeconds(-1);
                }

                if (model.StartDate.Year != 0001)
                {
                    iQuery = this._laburnum.Events.Where(x => x.EventDate >= model.StartDate && x.EventDate <= model.EndDate && x.IsActive == true);
                }
            }

            List <API.LABURNUM.COM.Event> dbEvents = iQuery.ToList();

            return(dbEvents);
        }