public JArray GetItemByID(ClientContext ctx, string listname, RESTOption restoption, string ID)
        {
            try
            {
                RetrieveAccessToken(ctx);

                var Url = ctx.Url + "/_api/web/lists/getByTitle('" + listname + "')/items(" + ID + ")";
                Url = URLBuilder(Url, restoption);

                HttpWebRequest request = HttpWebRequest.CreateHttp(Url);
                request.Accept = "application/json;odata=verbose";
                request.Headers.Add("Authorization", accessToken);
                Stream       webStream      = request.GetResponse().GetResponseStream();
                StreamReader responseReader = new StreamReader(webStream);
                string       response       = responseReader.ReadToEnd();
                JObject      jobj           = JObject.Parse(response);
                JArray       jarr           = (JArray)jobj["d"]["results"];


                return(jarr);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("An error occured while reading data. GUID: {0}", ex.ToString()));
            }
        }
        private string URLBuilder(string url, RESTOption restoption)
        {
            if (restoption.filter != null)
            {
                url += ((url.IndexOf('?') > -1) ? "&" : "?") + "$filter=" + restoption.filter;
            }


            if (restoption.select != null)
            {
                url += ((url.IndexOf('?') > -1) ? "&" : "?") + "$select=" + restoption.select;
            }


            if (restoption.expand != null)
            {
                url += ((url.IndexOf('?') > -1) ? "&" : "?") + "$expand=" + restoption.expand;
            }


            if (restoption.top != null)
            {
                url += ((url.IndexOf('?') > -1) ? "&" : "?") + "$top=" + restoption.top;
            }

            if (restoption.orderby != null)
            {
                url += ((url.IndexOf('?') > -1) ? "&" : "?") + "$orderby=" + restoption.orderby;
            }



            return(url);
        }
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,EmployementType,Description";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_EmployementType", rESTOption);
            return(jArray);
        }
Example #4
0
        private JArray RESTGet(ClientContext clientContext)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.select = "ID,TypeName";
            rESTOption.top    = "5000";

            jArray = restService.GetAllItemFromList(clientContext, "TIM_ProjectTypeMaster", rESTOption);
            return(jArray);
        }
Example #5
0
        private JArray RestGetAssets(ClientContext clientContext)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.select = "ID,Assets";

            jArray = restService.GetAllItemFromList(clientContext, "AM_Assets", rESTOption);

            return(jArray);
        }
Example #6
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,BusinessVertical,BusinessVerticalHead,Description";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_BusinessVertical", rESTOption);
            return(jArray);
        }
Example #7
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "*,libraryId/ID,libraryId/ClientName,File";
            rESTOption.expand = "File,libraryId";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_Client_Document", rESTOption);
            return(jArray);
        }
Example #8
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,AddressType,Address,Country/Id,Country/CountryName,EmpCode/Id,EmpCode/EmpCode,State/Id,State/StateName,City,Landmark,PostalCode,ResidingSince";
            rESTOption.expand = "EmpCode,Country,State";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_Address", rESTOption);
            return(jArray);
        }
Example #9
0
        private JArray RESTGet(ClientContext clientContext, string filter = "")
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,Page_Name,Page_Title,Page_Type,Page_Content,Widget_Configuration,Active";
            rESTOption.top    = "5000";

            jArray = restService.GetAllItemFromList(clientContext, "INT_PagesTx", rESTOption);
            return(jArray);
        }
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,VisaType,ValidUntil,Country/Id,Country/CountryName,EmpCode/Id,EmpCode/EmpCode";
            rESTOption.expand = "EmpCode,Country";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_VisaInformation", rESTOption);
            return(jArray);
        }
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,VendorName,VendorAddress,VendorContact,VendormailID,VendorCompany,City,GstNo,PanCardNo,Designation/Id,Designation/Designation,Country/Id,Country/CountryName,Remark,VendorState/Id,VendorState/StateName,MobileNo";
            rESTOption.expand = "Country,VendorState,Designation";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_VendorMasterDetails", rESTOption);
            return(jArray);
        }
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,MedicalConditionName,MedicalConditionFrom,CurrentlyActive,NeedSpecialAttention,Notes,EmpCode/Id,EmpCode/EmpCode";
            rESTOption.expand = "EmpCode";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_MedicalInformation", rESTOption);
            return(jArray);
        }
        private JArray RESTGet(ClientContext clientContext, string filter = "")
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,Holiday_Title,Holiday_Date,Active";
            rESTOption.top    = "5000";

            jArray = restService.GetAllItemFromList(clientContext, "INT_HolidayList", rESTOption);
            return(jArray);
        }
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,OrganizationName,Designation,FromDate,ToDate,Notes,ContactNumber,AnnualSalary,EmpCode/Id,EmpCode/EmpCode";
            rESTOption.expand = "EmpCode";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_WorkExperience", rESTOption);
            return(jArray);
        }
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,Person,Company,Email,Phone,Designation,Notes,Address,HowDoYouKnowPerson,EmpCode/Id,EmpCode/EmpCode";
            rESTOption.expand = "EmpCode";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_ReferenceDetails", rESTOption);
            return(jArray);
        }
Example #16
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,BankName,Branch,City,State/Id,State/StateName,AccountNumber,RoutingNumber,AccountType,Country/Id,Country/CountryName,EmpCode/Id,EmpCode/EmpCode";
            rESTOption.expand = "EmpCode,Country,State";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_BankingDetails", rESTOption);
            return(jArray);
        }
Example #17
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,PersonName,Relationship,PrimaryPhoneNumber,AlternatePhoneNumber,Address,EmpCode/Id,EmpCode/EmpCode";
            rESTOption.expand = "EmpCode";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_EmergencyContact", rESTOption);
            return(jArray);
        }
Example #18
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,Award,AwardedBy,AwardedOn,Description,EmpCode/Id,EmpCode/EmpCode";
            rESTOption.expand = "EmpCode";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_AwardsDetails", rESTOption);
            return(jArray);
        }
Example #19
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,CountryName";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_Country", rESTOption);

            return(jArray);
        }
Example #20
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,FirstName,MiddleName,LastName,EmpCode,Gender,MaritalStatus,DOB,JoiningDate,OnProbationTill,ProbationStatus,OfficeEmail,ContactNumber,EmpStatus,Designation/Id,Designation/Designation,Department/Id,Department/DepartmentName,Division/Id,Division/Division,Region/Id,Region/Region,Branch/Id,Branch/Branch,Company/Id,Company/CompanyName,Manager/Id,Manager/FirstName,Manager/EmpCode,User_Name/Id,User_Name/Title,Profile_Pic_Url,Facebook,Google,LinkedIn,Twitter,Instagram,Tiktok,DOB_Months,ManagerCode,JoiningDate_Month";
            rESTOption.expand = "Company,Designation,Department,Division,Region,Branch,User_Name,Manager";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_BasicInfo", rESTOption);
            return(jArray);
        }
Example #21
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,CompanyName,CompanyOwner,CompanyDescription,ContactPerson,ContactNumber,Website,EmailID,GSTNumber,PANNumber,City,State,Country/Id,Country/CountryName";
            rESTOption.expand = "Country";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_CompanyMaster", rESTOption);

            return(jArray);
        }
Example #22
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter  = filter;
            rESTOption.select  = "ID,PersonName,Relationship,BirthDate,Age,Gender,MediclaimCovered,BirthPlace,ContactNumber,EmpCode/Id,EmpCode/EmpCode";
            rESTOption.expand  = "EmpCode";
            rESTOption.top     = "5000";
            rESTOption.orderby = "ID desc";
            jArray             = restService.GetAllItemFromList(clientContext, "Emp_FamilyDetails", rESTOption);
            return(jArray);
        }
Example #23
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.select = "ID,AssetType,Assets/ID,Assets/Assets,Stock,MinStock";
            rESTOption.filter = filter;
            rESTOption.expand = "Assets";

            jArray = restService.GetAllItemFromList(clientContext, "AM_AssetsType", rESTOption);

            return(jArray);
        }
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,UniversityInstitute,Degree,MarksInPercentage,From,To,Subject";
            rESTOption.expand = "";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_EducationalDetails", rESTOption);

            return(jArray);
        }
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,Branch,HeadOfBranch,Address1,Address2,PostalCode,Description,State,City,Country/Id,Country/CountryName";
            rESTOption.expand = "Country";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_Branch", rESTOption);

            return(jArray);
        }
Example #26
0
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "*,EmpCodeId/ID,EmpCodeId/FirstName,File";
            rESTOption.expand = "File,EmpCodeId";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "EmpProfilePic", rESTOption);

            return(jArray);
        }
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,DepartmentName,HeadOfDepartment/Id,Description";
            rESTOption.expand = "HeadOfDepartment";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_Department", rESTOption);

            return(jArray);
        }
        private JArray RESTGet(ClientContext clientContext, string filter)
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,ClientName,ClientAddress,ClientContact,ClientMailID,ClientGSTNO,ClientPanCardNo,ClientCity,ClientRemark,ClientCountry/ID,ClientCountry/CountryName";
            rESTOption.expand = "ClientCountry";
            rESTOption.top    = "5000";
            jArray            = restService.GetAllItemFromList(clientContext, "Emp_ClientMasterDetails", rESTOption);

            return(jArray);
        }
        private JArray RESTGet(ClientContext clientContext, string filter = "")
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter = filter;
            rESTOption.select = "ID,Award_type,Active";
            rESTOption.top    = "5000";



            jArray = restService.GetAllItemFromList(clientContext, "INT_AwardTypeMaster", rESTOption);
            return(jArray);
        }
Example #30
0
        private JArray RESTGet(ClientContext clientContext, string filter = "")
        {
            RestService restService = new RestService();
            JArray      jArray      = new JArray();
            RESTOption  rESTOption  = new RESTOption();

            rESTOption.filter  = filter;
            rESTOption.select  = "ID,Setting_For,Before_Event,After_Event,Squence,Active,Fixed,Show_Card_Title,Background_Color,Font_Color,Card_Title,Show_Multiple";
            rESTOption.orderby = "Squence";
            rESTOption.top     = "5000";


            jArray = restService.GetAllItemFromList(clientContext, "INT_Setting", rESTOption);
            return(jArray);
        }