Пример #1
0
 public void UpdateStatus(DTO.LABURNUM.COM.CurriculumModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         new FrontEndApi.CurriculumApi().UpdateIsActive(model);
     }
 }
Пример #2
0
 public List <DTO.LABURNUM.COM.CurriculumModel> SearchAllCurriculums(DTO.LABURNUM.COM.CurriculumModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         return(new CurriculumHelper(new FrontEndApi.CurriculumApi().GetAllCurriculums()).Map());
     }
     else
     {
         return(null);
     }
 }
Пример #3
0
 public long Add(DTO.LABURNUM.COM.CurriculumModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         return(new FrontEndApi.CurriculumApi().Add(model));
     }
     else
     {
         return(-1);
     }
 }
Пример #4
0
 private long AddCurriculum(DTO.LABURNUM.COM.CurriculumModel model)
 {
     API.LABURNUM.COM.Curriculum curriculum = new Curriculum()
     {
         AcademicYearId    = model.AcademicYearId,
         MonthId           = model.MonthId,
         ClassId           = model.ClassId,
         AddedById         = model.AddedById,
         CurriculumDetails = GetCurriculumDetailApi(model.CurriculumDetails),
         CreatedOn         = new Component.Utility().GetISTDateTime(),
         IsActive          = true
     };
     this._laburnum.Curricula.Add(curriculum);
     this._laburnum.SaveChanges();
     return(curriculum.CurriculumId);
 }
Пример #5
0
        public void UpdateIsActive(DTO.LABURNUM.COM.CurriculumModel model)
        {
            model.CurriculumId.TryValidate();
            IQueryable <API.LABURNUM.COM.Curriculum> iQuery        = this._laburnum.Curricula.Where(x => x.CurriculumId == model.CurriculumId && x.IsActive == true);
            List <API.LABURNUM.COM.Curriculum>       dbCurriculums = iQuery.ToList();

            if (dbCurriculums.Count == 0)
            {
                throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND);
            }
            if (dbCurriculums.Count > 1)
            {
                throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND);
            }
            dbCurriculums[0].IsActive    = model.IsActive;
            dbCurriculums[0].UpdatedById = model.UpdatedById;
            dbCurriculums[0].LastUpdated = new Component.Utility().GetISTDateTime();
            this._laburnum.SaveChanges();
        }
Пример #6
0
 private DTO.LABURNUM.COM.CurriculumModel MapCore(API.LABURNUM.COM.Curriculum Curriculum)
 {
     DTO.LABURNUM.COM.CurriculumModel dtoClass = new DTO.LABURNUM.COM.CurriculumModel()
     {
         CurriculumId      = Curriculum.CurriculumId,
         AcademicYearId    = Curriculum.AcademicYearId,
         ClassId           = Curriculum.ClassId,
         AddedById         = Curriculum.AddedById,
         AddedByName       = Curriculum.Faculty.FacultyName,
         UpdatedByName     = Curriculum.UpdatedById != null ? Curriculum.Faculty1.FacultyName : "",
         MonthId           = Curriculum.MonthId,
         CurriculumDetails = new CurriculumDetailHelper(Curriculum.CurriculumDetails.Where(x => x.IsActive == true).ToList()).Map(),
         AcademicYearText  = Curriculum.AcademicYearTable.StartYear + "-" + Curriculum.AcademicYearTable.EndYear,
         MonthName         = Curriculum.MonthId != null ? Curriculum.Month.MonthName : "",
         ClassName         = Curriculum.Class.ClassName,
         CreatedOn         = Curriculum.CreatedOn,
         IsActive          = Curriculum.IsActive,
         LastUpdated       = Curriculum.LastUpdated,
     };
     return(dtoClass);
 }
Пример #7
0
 public long Add(DTO.LABURNUM.COM.CurriculumModel model)
 {
     return(AddValidation(model));
 }
Пример #8
0
 private long AddValidation(DTO.LABURNUM.COM.CurriculumModel model)
 {
     return(AddCurriculum(model));
 }
Пример #9
0
        public List <API.LABURNUM.COM.Curriculum> GetCurriculumByAdvanceSearch(DTO.LABURNUM.COM.CurriculumModel model)
        {
            IQueryable <API.LABURNUM.COM.Curriculum> iQuery = null;

            if (model.CurriculumId > 0)
            {
                iQuery = this._laburnum.Curricula.Where(x => x.CurriculumId == model.CurriculumId && 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.Curricula.Where(x => x.AcademicYearId == model.AcademicYearId && x.IsActive == true);
                }
            }
            //Search By ClassId.
            if (iQuery != null)
            {
                if (model.ClassId > 0)
                {
                    iQuery = iQuery.Where(x => x.ClassId == model.ClassId && x.IsActive == true);
                }
            }
            else
            {
                if (model.ClassId > 0)
                {
                    iQuery = this._laburnum.Curricula.Where(x => x.ClassId == model.ClassId && x.IsActive == true);
                }
            }

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

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

            //Search By UpdatedById.
            if (iQuery != null)
            {
                if (model.UpdatedById > 0)
                {
                    iQuery = iQuery.Where(x => x.UpdatedById == model.UpdatedById && x.IsActive == true);
                }
            }
            else
            {
                if (model.AddedById > 0)
                {
                    iQuery = this._laburnum.Curricula.Where(x => x.UpdatedById == model.UpdatedById && x.IsActive == true);
                }
            }

            List <API.LABURNUM.COM.Curriculum> dbCurriculums = iQuery.ToList();

            return(dbCurriculums);
        }