/// <summary>
        /// Use this utility to get a Customer's username and password via a Custom Report
        /// </summary>
        /// <param name="customerID"></param>
        /// <returns>CustomerCredential containing UserName and Password</returns>
        public static CustomerCredential GetCustomerCredentials(int customerID)
        {
            var model = new CustomerCredential();

            try
            {
                var request = new GetCustomReportRequest {
                    ReportID = 10
                };
                var parameters = new List <ParameterRequest>()
                {
                    new ParameterRequest {
                        ParameterName = "CustomerID", Value = customerID
                    }
                };

                request.Parameters = parameters.ToArray();

                var response = Exigo.WebService().GetCustomReport(request);
                var data     = response.ReportData.Tables[0].Rows[0];

                model.CustomerID = customerID;
                model.UserName   = data["UserName"].ToString();
                model.Password   = data["Password"].ToString();
            }
            catch { }

            return(model);
        }
Beispiel #2
0
        public static string GetCustomerPassword(int customerID)
        {
            try
            {
                if (GlobalSettings.Parties.CustomReportID_GetCustomerPassword > 0)
                {
                    //Create Request
                    GetCustomReportRequest request = new GetCustomReportRequest {
                        ReportID = GlobalSettings.Parties.CustomReportID_GetCustomerPassword
                    };

                    //Add Parameters
                    List <ParameterRequest> parameters = new List <ParameterRequest>();

                    parameters.Add(new ParameterRequest
                    {
                        ParameterName = "PassCheck",
                        // Unique passkey to ensure only we are calling this report and it is not accessed from others with API credentials
                        Value = "!00000000000000"
                    });

                    parameters.Add(new ParameterRequest
                    {
                        ParameterName = "CID",
                        Value         = customerID
                    });

                    //Now attach the list to the request
                    request.Parameters = parameters.ToArray();

                    //Send Request to Server and Get Response
                    GetCustomReportResponse response = ExigoDAL.WebService().GetCustomReport(request);

                    string password = response.ReportData.Tables[0].Rows[0].ItemArray[0].ToString();
                    //Now examine the results:
                    return(password);
                }
                else
                {
                    return("");
                }
            }
            catch
            {
                return("");
            }
        }
 /// <remarks/>
 public void GetCustomReportAsync(GetCustomReportRequest GetCustomReportRequest, object userState) {
     if ((this.GetCustomReportOperationCompleted == null)) {
         this.GetCustomReportOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCustomReportOperationCompleted);
     }
     this.InvokeAsync("GetCustomReport", new object[] {
                 GetCustomReportRequest}, this.GetCustomReportOperationCompleted, userState);
 }
 /// <remarks/>
 public void GetCustomReportAsync(GetCustomReportRequest GetCustomReportRequest) {
     this.GetCustomReportAsync(GetCustomReportRequest, null);
 }