コード例 #1
0
        public IHttpActionResult Get(string userID)
        {
            string token = Constants.SessionToken;
            //string token = string.Empty;
            //try
            //{
            //    IEnumerable<string> headerValues = this.Request.Headers.GetValues("token");
            //    token = headerValues.FirstOrDefault();
            //}
            //catch
            //{
            //    throw new HttpRequestException("Token not provided");
            //}

            XenonAdapter adapter    = new XenonAdapter();
            Hashtable    parameters = new Hashtable();

            parameters.Add("token", token);
            parameters.Add("partyID", "992");

            BaseResponse response = adapter.ExecuteCall("Worklist", "Amberpoint", parameters);

            Customer customerResponse = new Customer();

            if (response.ErrCode == "0")
            {
                //Deserialize json
                //customerResponse = JsonConvert.DeserializeObject<Customer>(response.Json);
                return(Json(customerResponse));
            }
            else
            {
                throw new HttpRequestException(response.ErrDesc);
            }
        }
コード例 #2
0
        public IHttpActionResult Alerts(string customerNo)
        {
            string token = string.Empty;

            try
            {
                IEnumerable <string> headerValues = this.Request.Headers.GetValues("token");
                token = headerValues.FirstOrDefault();
            }
            catch
            {
                throw new HttpRequestException("Token not provided");
            }

            XenonAdapter adapter    = new XenonAdapter();
            Hashtable    parameters = new Hashtable();

            parameters.Add("token", token);
            parameters.Add("customerNumber", customerNo);

            BaseResponse response = adapter.ExecuteCall("CustomerAlert", "BFX", parameters);

            List <Alert> alertList = new List <Alert>();

            if (response.ErrCode == "0")
            {
                //Deserialize json
                alertList = JsonConvert.DeserializeObject <List <Alert> >(response.Json);
                return(Json(alertList));
            }
            else
            {
                throw new HttpRequestException(response.ErrDesc);
            }
        }
コード例 #3
0
ファイル: LoginController.cs プロジェクト: fdagher/MyProjects
        public IHttpActionResult Get(string username, string userpassword, string system)
        {
            XenonAdapter adapter    = new XenonAdapter();
            Hashtable    parameters = new Hashtable();


            string userstore      = System.Configuration.ConfigurationManager.AppSettings[string.Format("{0}.UserCredentialStore", system)].ToString();
            string systemstore    = System.Configuration.ConfigurationManager.AppSettings[string.Format("{0}.SystemCredentialStore", system)].ToString();
            string systemname     = System.Configuration.ConfigurationManager.AppSettings[string.Format("{0}.SystemUserId", system)].ToString();
            string systempassword = System.Configuration.ConfigurationManager.AppSettings[string.Format("{0}.SystemPassword", system)].ToString();


            parameters.Add("username", username);
            parameters.Add("userpassword", userpassword);
            parameters.Add("userstore", userstore);


            parameters.Add("systemname", systemname);
            parameters.Add("systempassword", systempassword);
            parameters.Add("systemstore", systemstore);

            BaseResponse response = adapter.ExecuteCall("Login", "Amberpoint", parameters);

            if (response.ErrCode == "0")
            {
                //Deserialize json
                LoginResponse loginResponse = new LoginResponse();
                loginResponse.Token = response.Json;
                return(Json(loginResponse));
            }
            else
            {
                throw new HttpRequestException(response.ErrDesc);
            }
        }
コード例 #4
0
        public IHttpActionResult GetBasicInfo(string customerNo)
        {
            string token = Constants.SessionToken;
            //string token = string.Empty;
            //try
            //{
            //    IEnumerable<string> headerValues = this.Request.Headers.GetValues("token");
            //    token = headerValues.FirstOrDefault();
            //}
            //catch
            //{
            //    throw new HttpRequestException("Token not provided");
            //}

            XenonAdapter adapter    = new XenonAdapter();
            Hashtable    parameters = new Hashtable();

            parameters.Add("token", token);
            parameters.Add("customerNumber", customerNo);

            DateTime     startTime = DateTime.Now;
            BaseResponse response  = adapter.ExecuteCall("CustomerBasicInfo", "EAI", parameters);



            if (response.ErrCode == "0")
            {
                return(Json("OK"));
            }
            else
            {
                throw new HttpRequestException(response.ErrDesc);
            }
        }
コード例 #5
0
        public IHttpActionResult Get(string customerNo)
        {
            //string token = Constants.SessionToken;
            string token = string.Empty;

            try
            {
                IEnumerable <string> headerValues = this.Request.Headers.GetValues("token");
                token = headerValues.FirstOrDefault();
            }
            catch
            {
                throw new HttpRequestException("Token not provided");
            }

            List <Product>           productList = new List <Product>();
            CustomerPortfolioRequest request     = new CustomerPortfolioRequest();

            request.Token           = token;
            request.CustomerNumber  = customerNo;
            request.ProductListType = "All";
            request.InquiryMode     = "Simple";
            request.CustLinkMode    = "Direct";
            request.ProductStatus   = "Active";
            XenonAdapter adapter  = new XenonAdapter();
            BaseResponse response = adapter.GetCustomerProfile(request);

            if (response.ErrCode == "0")
            {
                //Deserialize json
                productList = JsonConvert.DeserializeObject <List <Product> >(response.Json);
            }

            return(Json(productList));
        }
コード例 #6
0
        public IHttpActionResult FinancialProfile(string customerNo)
        {
            // string token = Constants.SessionToken;
            string token = string.Empty;

            try
            {
                IEnumerable <string> headerValues = this.Request.Headers.GetValues("token");
                token = headerValues.FirstOrDefault();
            }
            catch
            {
                throw new HttpRequestException("Token not provided");
            }

            XenonAdapter adapter    = new XenonAdapter();
            Hashtable    parameters = new Hashtable();

            parameters.Add("token", token);
            parameters.Add("customerNumber", customerNo);

            BaseResponse response = adapter.ExecuteCall("FinancialProfile", "BFX", parameters);

            List <FinancialEntry> list = new List <FinancialEntry>();

            if (response.ErrCode == "0")
            {
                //Deserialize json
                list = JsonConvert.DeserializeObject <List <FinancialEntry> >(response.Json);

                decimal total = list.Sum(x => (decimal)x.Value);

                if (total != 0)
                {
                    foreach (FinancialEntry entry in list)
                    {
                        entry.Percent = ((decimal)entry.Value / total) * 100;
                    }
                }

                return(Json(list));
            }
            else
            {
                throw new HttpRequestException(response.ErrDesc);
            }
        }
コード例 #7
0
        public IHttpActionResult Get(string customerNo)
        {
            //string token = Constants.SessionToken;
            string token = string.Empty;

            try
            {
                IEnumerable <string> headerValues = this.Request.Headers.GetValues("token");
                token = headerValues.FirstOrDefault();
            }
            catch
            {
                throw new HttpRequestException("Token not provided");
            }

            XenonAdapter adapter    = new XenonAdapter();
            Hashtable    parameters = new Hashtable();

            parameters.Add("token", token);
            parameters.Add("customerNumber", customerNo);

            DateTime     startTime = DateTime.Now;
            BaseResponse response  = adapter.ExecuteCall("CustomerInquiry", "BFX", parameters);

            Customer customerResponse = new Customer();

            if (response.ErrCode == "0")
            {
                //Deserialize json
                customerResponse = JsonConvert.DeserializeObject <Customer>(response.Json);
                customerResponse.CustomerNumber = customerNo;

                double ms = DateTime.Now.Subtract(startTime).TotalMilliseconds;

                return(Json(customerResponse));
            }
            else
            {
                throw new HttpRequestException(response.ErrDesc);
            }
        }
コード例 #8
0
        public IHttpActionResult AccountDetails(string accountNo)
        {
            //string token = Constants.SessionToken;
            string token = string.Empty;

            try
            {
                IEnumerable <string> headerValues = this.Request.Headers.GetValues("token");
                token = headerValues.FirstOrDefault();
            }
            catch
            {
                throw new HttpRequestException("Token not provided");
            }

            XenonAdapter adapter    = new XenonAdapter();
            Hashtable    parameters = new Hashtable();

            parameters.Add("token", token);
            parameters.Add("accountNumber", accountNo);

            BaseResponse response = adapter.ExecuteCall("AccountInquiry", "BFX", parameters);

            Account account = new Account();

            if (response.ErrCode == "0")
            {
                //Deserialize json
                account           = JsonConvert.DeserializeObject <Account>(response.Json);
                account.AccountNo = accountNo;
                return(Json(account));
            }
            else
            {
                throw new HttpRequestException(response.ErrDesc);
            }
        }