Exemplo n.º 1
0
        public dynamic SearchSectionBySectionId(DTO.LABURNUM.COM.SectionModel model)
        {
            if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
            {
                if (model.SectionId <= 0)
                {
                    return(GetApiResponseModel("Section Id Cannnot Be Null.", true, null));
                }

                List <DTO.LABURNUM.COM.SectionModel> dbSections = new SectionHelper(new FrontEndApi.SectionApi().GetSectionByAdvanceSearch(model)).Map();
                if (dbSections.Count == 0)
                {
                    return(GetApiResponseModel("No Record Found For Given Section Id", true, null));
                }
                if (dbSections.Count > 1)
                {
                    return(GetApiResponseModel("More Than One Record Found Please Contact Administrator", true, null));
                }
                return(GetApiResponseModel("Successfully Performed.", true, dbSections[0]));
            }
            else
            {
                return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null));
            }
        }
Exemplo n.º 2
0
 public void UpdateStatus(DTO.LABURNUM.COM.SectionModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         new FrontEndApi.SectionApi().UpdateIsActive(model);
     }
 }
Exemplo n.º 3
0
 public DTO.LABURNUM.COM.SectionModel SearchSectionById(DTO.LABURNUM.COM.SectionModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         return(new SectionHelper(new FrontEndApi.SectionApi().GetSectionBySectionId(model.SectionId)).MapSingle());
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 4
0
 public List <DTO.LABURNUM.COM.SectionModel> SearchSectionByAdvanceSearch(DTO.LABURNUM.COM.SectionModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         return(new SectionHelper(new FrontEndApi.SectionApi().GetSectionByAdvanceSearch(model)).Map());
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 5
0
 public long Add(DTO.LABURNUM.COM.SectionModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         return(new FrontEndApi.SectionApi().Add(model));
     }
     else
     {
         return(-1);
     }
 }
Exemplo n.º 6
0
 private long AddSection(DTO.LABURNUM.COM.SectionModel model)
 {
     API.LABURNUM.COM.Section apiSection = new Section()
     {
         SectionName = model.SectionName,
         CreatedOn   = System.DateTime.Now,
         IsActive    = true
     };
     this._laburnum.Sections.Add(apiSection);
     this._laburnum.SaveChanges();
     return(apiSection.SectionId);
 }
Exemplo n.º 7
0
 public dynamic SearchAllSections(DTO.LABURNUM.COM.SectionModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         List <DTO.LABURNUM.COM.SectionModel> dbSections = new SectionHelper(new FrontEndApi.SectionApi().GetActiveSections()).Map();
         return(GetApiResponseModel("Successfully Performed.", true, dbSections));
     }
     else
     {
         return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null));
     }
 }
Exemplo n.º 8
0
 private long AddSection(DTO.LABURNUM.COM.SectionModel model)
 {
     API.LABURNUM.COM.Section apiSection = new Section()
     {
         ClassId     = model.ClassId,
         SectionName = model.SectionName,
         CreatedOn   = new Component.Utility().GetISTDateTime(),
         IsActive    = true
     };
     this._laburnum.Sections.Add(apiSection);
     this._laburnum.SaveChanges();
     return(apiSection.SectionId);
 }
Exemplo n.º 9
0
 private DTO.LABURNUM.COM.SectionModel MapCore(API.LABURNUM.COM.Section section)
 {
     DTO.LABURNUM.COM.SectionModel dtoSection = new DTO.LABURNUM.COM.SectionModel()
     {
         ClassId     = section.ClassId,
         SectionId   = section.SectionId,
         SectionName = section.SectionName,
         CreatedOn   = section.CreatedOn,
         IsActive    = section.IsActive,
         LastUpdated = section.LastUpdated
     };
     return(dtoSection);
 }
Exemplo n.º 10
0
 public List <DTO.LABURNUM.COM.SectionModel> GetSectionByClassId(long classid)
 {
     try
     {
         DTO.LABURNUM.COM.SectionModel model = new DTO.LABURNUM.COM.SectionModel()
         {
             ClassId = classid
         };
         return(GetSectionByAdvanceSearch(model));
     }
     catch (Exception)
     {
         throw new Exception("Error While Getting Section List");
     }
 }
Exemplo n.º 11
0
        public void UpdateIsActive(DTO.LABURNUM.COM.SectionModel model)
        {
            model.SectionId.TryValidate();
            IQueryable <API.LABURNUM.COM.Section> iQuery     = this._laburnum.Sections.Where(x => x.SectionId == model.SectionId && x.IsActive == true);
            List <API.LABURNUM.COM.Section>       dbSections = iQuery.ToList();

            if (dbSections.Count == 0)
            {
                throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND);
            }
            if (dbSections.Count > 1)
            {
                throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND);
            }
            dbSections[0].IsActive    = model.IsActive;
            dbSections[0].LastUpdated = System.DateTime.Now;
            this._laburnum.SaveChanges();
        }
Exemplo n.º 12
0
        public List <API.LABURNUM.COM.Section> GetSectionByAdvanceSearch(DTO.LABURNUM.COM.SectionModel model)
        {
            IQueryable <API.LABURNUM.COM.Section> iQuery = null;

            if (model.SectionId > 0)
            {
                iQuery = this._laburnum.Sections.Where(x => x.SectionId == model.SectionId && x.IsActive == true);
            }

            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.Sections.Where(x => x.ClassId == model.ClassId && x.IsActive == true);
                }
            }

            if (iQuery != null)
            {
                if (model.SectionName != null)
                {
                    iQuery = iQuery.Where(x => x.SectionName.Trim().ToLower().Equals(model.SectionName.Trim().ToLower()) && x.IsActive == true);
                }
            }
            else
            {
                if (model.SectionName != null)
                {
                    iQuery = this._laburnum.Sections.Where(x => x.SectionName.Trim().ToLower().Equals(model.SectionName.Trim().ToLower()) && x.IsActive == true);
                }
            }

            List <API.LABURNUM.COM.Section> dbSections = iQuery.ToList();

            return(dbSections);
        }
Exemplo n.º 13
0
        public dynamic SearchSectionByClassId(DTO.LABURNUM.COM.SectionModel model)
        {
            if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
            {
                if (model.ClassId <= 0)
                {
                    return(GetApiResponseModel("Class Id Cannnot Be Null.", true, null));
                }

                List <DTO.LABURNUM.COM.SectionModel> dbSections = new SectionHelper(new FrontEndApi.SectionApi().GetSectionByAdvanceSearch(model)).Map();
                if (dbSections.Count == 0)
                {
                    return(GetApiResponseModel("No Section Found For Given Class Id", true, dbSections));
                }
                return(GetApiResponseModel("Successfully Performed.", true, dbSections));
            }
            else
            {
                return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null));
            }
        }
Exemplo n.º 14
0
 public List <DTO.LABURNUM.COM.SectionModel> GetSectionByAdvanceSearch(DTO.LABURNUM.COM.SectionModel model)
 {
     try
     {
         model.ApiClientModel = new LABURNUM.COM.Component.Common().GetApiClientModel();
         HttpClient          client   = new LABURNUM.COM.Component.Common().GetHTTPClient("application/json");
         HttpResponseMessage response = client.PostAsJsonAsync("Section/SearchSectionByAdvanceSearch", model).Result;
         if (response.IsSuccessStatusCode)
         {
             var data = response.Content.ReadAsStringAsync().Result;
             return(JsonConvert.DeserializeObject <List <DTO.LABURNUM.COM.SectionModel> >(data));
         }
         else
         {
             return(null);
         }
     }
     catch (Exception)
     {
         throw new Exception("Error While Getting Section List");
     }
 }
Exemplo n.º 15
0
 public long Add(DTO.LABURNUM.COM.SectionModel model)
 {
     return(AddValidation(model));
 }
Exemplo n.º 16
0
 private long AddValidation(DTO.LABURNUM.COM.SectionModel model)
 {
     model.SectionName.TryValidate();
     return(AddSection(model));
 }