コード例 #1
0
        private Client getClientPersonalInfo(int clientId)
        {
            Client clientObj = new Client();

            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + string.Format(GET_CLIENT_PERSONAL_API, clientId);

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <Client>(apiurl, null, "GET");

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    clientObj = jsonSerialization.DeserializeFromString <Client>(restResult.ToString());
                }
                else
                {
                    MessageBox.Show(restResult.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                return(clientObj);
            }
            catch (Exception ex)
            {
                Logger.LogDebug(ex);
                return(clientObj);
            }
        }
コード例 #2
0
        public IList <Festivals> GetAll()
        {
            IList <Festivals> familyMemberObj = new List <Festivals>();

            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + string.Format(GET_All_API);

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <IList <Festivals> >(apiurl, null, "GET");

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    familyMemberObj = jsonSerialization.DeserializeFromString <IList <Festivals> >(restResult.ToString());
                }
                return(familyMemberObj);
            }
            catch (Exception ex)
            {
                Logger.LogDebug(ex);
                return(null);
            }
        }
コード例 #3
0
        public object Execute <T>(string url, T objectType, string method)
        {
            _url        = url;
            _objectType = objectType;
            _method     = method;

            JSONSerialization jsonSerialization = new JSONSerialization();
            HttpWebRequest    request           = setWebRequest();

            string responseString = string.Empty;

            var response = (HttpWebResponse)request.GetResponse();

            if (response.StatusCode == HttpStatusCode.OK)
            {
                responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                if (_cookiesCollection.Count == 0)
                {
                    _cookiesCollection = response.Cookies;
                }
            }

            var result = jsonSerialization.DeserializeFromString <Common.Model.Result <object> >(responseString);

            if (result.IsSuccess)
            {
                return(result.Value);
            }
            else
            {
                throw result.ExceptionInfo;
            }
        }
コード例 #4
0
        private HttpWebRequest setWebRequest()
        {
            JSONSerialization jsonSerialization = new JSONSerialization();
            HttpWebRequest    request           = (HttpWebRequest)HttpWebRequest.Create(_url);

            string DATA = (_objectType == null) ? string.Empty : jsonSerialization.SerializeToString <object>(_objectType);
            var    data = Encoding.ASCII.GetBytes(DATA);

            request.Method        = _method;
            request.ContentType   = "application/json";
            request.ContentLength = data.Length;
            request.Referer       = _url.Substring(0, _url.IndexOf(API_DELIMETER));
            request.KeepAlive     = true;
            //request.Credentials = new NetworkCredential(txtUserName.Text, txtPass.Text);
            if (request.Method != "GET")
            {
                using (var stream = request.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }
            }
            if (request.CookieContainer == null)
            {
                request.CookieContainer = new CookieContainer();
            }

            request = setCookies(request, _cookiesCollection);

            return(request);
        }
コード例 #5
0
        private void btnPersonalDetailSave_Click(object sender, EventArgs e)
        {
            RiskProfiledReturnMaster riskProfileMaster = new RiskProfiledReturnMaster();

            riskProfileMaster = getRiskProfileData();
            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = string.Empty;
                if (riskProfileMaster.Id == 0)
                {
                    apiurl = Program.WebServiceUrl + "/" + ADD_RISKPROFILE_RETURN;
                }
                else
                {
                    apiurl = Program.WebServiceUrl + "/" + UPDATE_RISKPROFILE_RETURN;
                }

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <RiskProfiledReturnMaster>(apiurl, riskProfileMaster, "POST");
                _processWindow.Hide();
                MessageBox.Show("Record save successfully.", "Record Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to save record.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Logger.LogDebug(ex);
            }
        }
コード例 #6
0
        internal BankAccountDetail GetById(int id, int clientId)
        {
            BankAccountDetail BankAccountObj = new BankAccountDetail();

            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + string.Format(GET_ALL_BY_ID_API, id, clientId);

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <IList <BankAccountDetail> >(apiurl, null, "GET");

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    BankAccountObj = jsonSerialization.DeserializeFromString <BankAccountDetail>(restResult.ToString());
                }
                return(BankAccountObj);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
                return(null);
            }
        }
コード例 #7
0
        private ClientSpouse getSpousePersonalInfo(int clientId)
        {
            ClientSpouse clientSpouseObj = new ClientSpouse();

            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + string.Format(GET_SPOUSE_PERSONAL_API, clientId);

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <Client>(apiurl, null, "GET");

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    clientSpouseObj = jsonSerialization.DeserializeFromString <ClientSpouse>(restResult.ToString());
                }
                return(clientSpouseObj);
            }
            catch (Exception ex)
            {
                Logger.LogDebug(ex);
                return(null);
            }
        }
コード例 #8
0
        public CurrentStatusCalculation GetAllCurrestStatus(int plannerId)
        {
            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + string.Format(GET_ALL_CURRENT_STATUS_API, plannerId);

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <IList <CurrentStatusCalculation> >(apiurl, null, "GET");

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    csCal = jsonSerialization.DeserializeFromString <CurrentStatusCalculation>(restResult.ToString());
                }
                return(csCal);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
                return(null);
            }
        }
コード例 #9
0
        internal IList <ClientCRMGroup> Get(int clientId)
        {
            IList <ClientCRMGroup> ClientCRMGroupObj = new List <ClientCRMGroup>();

            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + string.Format(GETALL_CLIENTFESTIVAL_API, clientId);

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <IList <ClientCRMGroup> >(apiurl, null, "GET");

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    ClientCRMGroupObj = jsonSerialization.DeserializeFromString <IList <ClientCRMGroup> >(restResult.ToString());
                }
                return(ClientCRMGroupObj);
            }
            catch (Exception ex)
            {
                Logger.LogDebug(ex);
                return(null);
            }
        }
コード例 #10
0
        private void Main_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + AUDITLOGCONTROLLER;

                Activities activity = new Activities();
                activity.ActivityTypeValue = ActivityType.Logout;
                activity.EntryType         = EntryStatus.Success;
                activity.SourceType        = Source.Server;
                activity.HostName          = Environment.MachineName;
                activity.UserName          = Program.CurrentUser.UserName;

                string DATA = jsonSerialization.SerializeToString <Activities>(activity);

                WebClient client = new WebClient();
                client.Headers["Content-type"] = "application/json";
                client.Encoding = Encoding.UTF8;
                string json = client.UploadString(apiurl, DATA);

                if (json != null)
                {
                    var resultObject = jsonSerialization.DeserializeFromString <Result>(json);
                }
            }
            catch (Exception ex)
            {
                Logger.LogDebug(ex.ToString());
            }
        }
コード例 #11
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                string loginUrl = Program.WebServiceUrl + "/" + AUTHENTICATIONAPI;
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();

                User            user            = getUserObjectFromUI();
                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <User>(loginUrl, user, "POST");

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    actionOnValidAuthentication(restResult.ToString());
                }
                else
                {
                    MessageBox.Show(restResult.ToString(), "Login fail", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Invalid user or credential.", "Login fail", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Logger.LogDebug(ex);
            }

            //string DATA =  jsonSerialization.SerializeToString<User>(user);



            //WebClient client = new WebClient();
            //client.Headers["Content-type"] = "application/json";
            //client.Encoding = Encoding.UTF8;
            //string json = client.UploadString(loginUrl,"POST", DATA);
            //if (json != null)
            //{
            //    Result<User> resultObject = jsonSerialization.DeserializeFromString<Result<User>>(json);
            //    if (resultObject.IsSuccess && resultObject.Value != null)
            //    {
            //        Program.CurrentUser = resultObject.Value;
            //        Main frmclientMain = new Main();
            //        this.Visible = false;
            //        frmclientMain.ShowDialog();
            //        this.Close();
            //    }
            //    else
            //        MessageBox.Show("Invalid user or credential.", "Login fail", MessageBoxButtons.OK, MessageBoxIcon.Information);

            //}
        }
コード例 #12
0
        private void loadProspectCustomerData()
        {
            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + PROSPECT_CLIENTS_GETALL;

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <List <ProspectClient> >(apiurl, null, "GET");

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    var prospClientCollection = jsonSerialization.DeserializeFromString <List <ProspectClient> >(restResult.ToString());
                    _dtProspClients = ListtoDataTable.ToDataTable(prospClientCollection);
                    fillTreeviewData(_dtProspClients);
                }
                else
                {
                    MessageBox.Show(restResult.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                Logger.LogDebug(ex);
            }


            //HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(apiurl);
            //request.Method = "GET";
            //String prospClientResultJosn = String.Empty;
            //using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            //{
            //    Stream dataStream = response.GetResponseStream();

            //    StreamReader reader = new StreamReader(dataStream);
            //    prospClientResultJosn = reader.ReadToEnd();
            //    reader.Close();
            //    dataStream.Close();
            //}
            //var prospClientCollection = jsonSerialization.DeserializeFromString<Result<List<ProspectClient>>>(prospClientResultJosn);

            //if (prospClientCollection.Value != null)
            //{
            //    _dtProspClients = ListtoDataTable.ToDataTable(prospClientCollection.Value);
            //    //dataGridProspClients.DataSource = _dtProspClients;
            //    fillTreeviewData(_dtProspClients);
            //    //gridDisplaySetting();
            //}
        }
コード例 #13
0
        internal DataTable GetMFTransactionsInfo(int plannerId)
        {
            IList <MFTransactions> MFTransactionsObj = new List <MFTransactions>();

            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + string.Format(GET_ALL, plannerId);

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <IList <MFTransactions> >(apiurl, null, "GET");

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    MFTransactionsObj = jsonSerialization.DeserializeFromString <IList <MFTransactions> >(restResult.ToString());
                }
                if (MFTransactionsObj != null)
                {
                    if (MFTransactionsObj.Count > 0)
                    {
                        dtMFTrans = ListtoDataTable.ToDataTable(MFTransactionsObj.ToList());
                    }
                    else
                    {
                        return(defaultTableStructure());
                    }
                }
                return(dtMFTrans);
            }
            catch (System.Net.WebException webException)
            {
                if (webException.Message.Equals("The remote server returned an error: (401) Unauthorized."))
                {
                    MessageBox.Show("You session has been expired. Please Login again.", "Session Expired", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                return(null);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
                return(null);
            }
        }
コード例 #14
0
 private void removeRecord(TreeNode selectedNode)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         RiskProfiledReturnMaster riskProfileMaster = convertSelectedRowDataToRiskProfileMastser();
         string          apiurl          = Program.WebServiceUrl + "/" + DELETE_RISKPROFILE;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <RiskProfiledReturnMaster>(apiurl, riskProfileMaster, "POST");
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
     }
 }
コード例 #15
0
        private void loadRiskProfileData()
        {
            FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
            string apiurl = Program.WebServiceUrl + "/" + RISKPROFILE_GETALL;

            RestAPIExecutor restApiExecutor = new RestAPIExecutor();

            var restResult = restApiExecutor.Execute <List <RiskProfiledReturnMaster> >(apiurl, null, "GET");

            if (jsonSerialization.IsValidJson(restResult.ToString()))
            {
                _riskProfileMasters = jsonSerialization.DeserializeFromString <List <RiskProfiledReturnMaster> >(restResult.ToString());
            }
            else
            {
                MessageBox.Show(restResult.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #16
0
        public IList <FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal> GetCurrentStatusToGoal(int optionID)
        {
            IList <FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal> currentStatusToGoals =
                new List <FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal>();

            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + string.Format(GET_CURRENT_STATUS_TO_GOAL_BYID, optionID);

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <IList <Shares> >(apiurl, null, "GET");

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    currentStatusToGoals = jsonSerialization.DeserializeFromString <IList <FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal> >(restResult.ToString());
                }
                if (currentStatusToGoals != null)
                {
                    return(currentStatusToGoals);
                }
                else
                {
                    return(null);
                }
            }
            catch (System.Net.WebException webException)
            {
                if (webException.Message.Equals("The remote server returned an error: (401) Unauthorized."))
                {
                    MessageBox.Show("You session has been expired. Please Login again.", "Session Expired", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                return(null);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
                return(null);
            }
        }
コード例 #17
0
        private bool updateClientPersonalInfo(Client client)
        {
            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + UPDATE_CLIENTPERSONAL_INFO_API;

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <Client>(apiurl, client, "POST");

                return(true);
            }
            catch (Exception ex)
            {
                Logger.LogDebug(ex);
                return(false);
            }
        }
コード例 #18
0
        public bool Update(ClientContact clientContact)
        {
            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + UPDATE_CONTACT_API;

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <ClientContact>(apiurl, clientContact, "POST");

                return(true);
            }
            catch (Exception ex)
            {
                Logger.LogDebug(ex);
                return(false);
            }
        }
コード例 #19
0
 internal bool Add(MutualFund mutualFund)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         string          apiurl          = Program.WebServiceUrl + "/" + ADD_MUTUALFUND_API;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <MutualFund>(apiurl, mutualFund, "POST");
         return(true);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         return(false);
     }
 }
コード例 #20
0
 private bool uploadfile(Document doc)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         string          apiurl          = Program.WebServiceUrl + "/" + ADD_BankAccount_API;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <Document>(apiurl, doc, "POST");
         return(true);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         return(false);
     }
 }
コード例 #21
0
 public bool Delete(PlanOption planOption)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         string          apiurl          = Program.WebServiceUrl + "/" + DELETE_PLANOPTION_API;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <PlanOption>(apiurl, planOption, "POST");
         return(true);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         return(false);
     }
 }
コード例 #22
0
 public bool Add(NonFinancialAsset nonFinancialAsset)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         string          apiurl          = Program.WebServiceUrl + "/" + ADD_NON_FINANCIAL_API;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <NonFinancialAsset>(apiurl, nonFinancialAsset, "POST");
         return(true);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         return(false);
     }
 }
コード例 #23
0
 public void Delete(NonFinancialAsset nonFinancialAsset)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         string          apiurl          = Program.WebServiceUrl + "/" + DELETE_NON_FINANCIAL_API;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <NonFinancialAsset>(apiurl, nonFinancialAsset, "POST");
         MessageBox.Show("Record deleted successfully.", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         MessageBox.Show("Unable to delete record.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
コード例 #24
0
 internal bool Delete(RecommendedSchemes recommendedSchemes)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         string          apiurl          = Program.WebServiceUrl + "/" + DELETE_RECOMMENDEDSCHEME;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <RecommendedSchemes>(apiurl, recommendedSchemes, "POST");
         return(true);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         return(false);
     }
 }
コード例 #25
0
 internal bool Delete(InvestmentSegment invSegment)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         string          apiurl          = Program.WebServiceUrl + "/" + DELETE_InvestmentSegment_API;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <InvestmentSegment>(apiurl, invSegment, "POST");
         return(true);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         return(false);
     }
 }
コード例 #26
0
 public bool DeleteCurrentStatusToGoal(FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal currStatusToGoal)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         string          apiurl          = Program.WebServiceUrl + "/" + DELETE_CURRENT_STATUS_TO_GOAL_API;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal>(apiurl, currStatusToGoal, "POST");
         return(true);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         return(false);
     }
 }
コード例 #27
0
 internal bool Add(LifeInsurance lifeInsurance)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         string          apiurl          = Program.WebServiceUrl + "/" + ADD_LIFEINSURANCE_API;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <LifeInsurance>(apiurl, lifeInsurance, "POST");
         return(true);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         return(false);
     }
 }
コード例 #28
0
 internal bool Update(Shares Shares)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         string          apiurl          = Program.WebServiceUrl + "/" + UPDATE_SHARES_API;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <Shares>(apiurl, Shares, "POST");
         return(true);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         return(false);
     }
 }
コード例 #29
0
        public bool Update(Employment employment)
        {
            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + UPDATE_EMPLOYMENT_API;

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <Employment>(apiurl, employment, "POST");

                return(true);
            }
            catch (Exception ex)
            {
                Logger.LogDebug(ex);
                return(false);
            }
        }
コード例 #30
0
        public void FillInvestmentBifurcationData(int riskProfileId, string investmentType, DataGridView dataGrid)
        {
            if (_dtInvestmentSegment != null)
            {
                _dtInvestmentSegment.Clear();
            }
            IList <InvestmentSegment> InvestmentSegmentObj = new List <InvestmentSegment>();

            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + string.Format(GET_ALL, riskProfileId);

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

                var restResult = restApiExecutor.Execute <IList <InvestmentSegment> >(apiurl, null, "GET");

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    InvestmentSegmentObj = jsonSerialization.DeserializeFromString <IList <InvestmentSegment> >(restResult.ToString());
                }
                if (InvestmentSegmentObj != null)
                {
                    _dtInvestmentSegment = ListtoDataTable.ToDataTable(InvestmentSegmentObj.ToList());
                }
                fillGrid(investmentType, dataGrid);
            }
            catch (System.Net.WebException webException)
            {
                if (webException.Message.Equals("The remote server returned an error: (401) Unauthorized."))
                {
                    MessageBox.Show("You session has been expired. Please Login again.", "Session Expired", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
            }
        }