コード例 #1
0
ファイル: MAPPController.cs プロジェクト: nishantchau/LAB
        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));
            }
        }
コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #6
0
ファイル: SectionApi.cs プロジェクト: nishantchau/school
 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);
 }
コード例 #7
0
ファイル: MAPPController.cs プロジェクト: nishantchau/LAB
 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));
     }
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #10
0
ファイル: Section.cs プロジェクト: nishantchau/school
 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");
     }
 }
コード例 #11
0
ファイル: SectionApi.cs プロジェクト: nishantchau/school
        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();
        }
コード例 #12
0
ファイル: SectionApi.cs プロジェクト: nishantchau/school
        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);
        }
コード例 #13
0
ファイル: MAPPController.cs プロジェクト: nishantchau/LAB
        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));
            }
        }
コード例 #14
0
ファイル: Section.cs プロジェクト: nishantchau/school
 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");
     }
 }
コード例 #15
0
ファイル: SectionApi.cs プロジェクト: nishantchau/school
 public long Add(DTO.LABURNUM.COM.SectionModel model)
 {
     return(AddValidation(model));
 }
コード例 #16
0
ファイル: SectionApi.cs プロジェクト: nishantchau/school
 private long AddValidation(DTO.LABURNUM.COM.SectionModel model)
 {
     model.SectionName.TryValidate();
     return(AddSection(model));
 }