public Member[] GetMembers(string SchemeName) { Member_Service v_ser = new Member_Service(); v_ser.Url = "http://" + PensionSetup.ServerName + ":" + PensionSetup.ServerPort + "/" + PensionSetup.ServerInstance + "/WS/" + SchemeName + "/Page/Member"; v_ser.UseDefaultCredentials = false; v_ser.Credentials = new NetworkCredential(PensionSetup.SoapUsername, PensionSetup.SoapPassword); Member[] member = v_ser.ReadMultiple(null, null, 0); return(member); }
public static string GetMemberNumberAsync(string StaffNumber, string SponsorNumber) { string SchemeName = GetSchemeNameAsync(SponsorNumber); try { Member_Service vls = new Member_Service(); vls.Url = "http://" + ServerName + ":" + ServerPort + "/" + ServerInstance + "/WS/" + SchemeName + "/Page/Member"; vls.UseDefaultCredentials = false; vls.Credentials = new NetworkCredential(SoapUsername, SoapPassword); Member_Filter vlf = new Member_Filter(); Member_Filter vlf1 = new Member_Filter(); List <Member_Filter> lvlf = new List <Member_Filter>(); vlf.Field = Member_Fields.Payroll_Personal_Number; vlf.Criteria = StaffNumber; vlf1.Field = Member_Fields.Sponsor; vlf1.Criteria = SponsorNumber; lvlf.Add(vlf); lvlf.Add(vlf1); var Vendor = vls.ReadMultiple(lvlf.ToArray(), null, 0); if (Vendor.Any()) { return(Vendor.First().No); } return(null); } catch (Exception e) { //return null for exception, carry the error for handling return(null); } }