Ejemplo n.º 1
0
 private void GetQuoteById()
 {
     Business.Sales.Quote Obj   = new Business.Sales.Quote();
     Entity.Sales.Quote   Quote = Obj.GetQuoteById(QuoteId);
     if (Quote.Id != 0)
     {
         txtActualCloseDate.Text      = Quote.ActualCloseDate == null ? string.Empty : Quote.ActualCloseDate.GetValueOrDefault().ToString("dd MMM yyyy");
         txtDateShipped.Text          = Quote.DateShipped == null ? string.Empty : Quote.DateShipped.GetValueOrDefault().ToString("dd MMM yyyy");
         txtValidTillDate.Text        = Quote.ValidTillDate == null ? string.Empty : Quote.ValidTillDate.GetValueOrDefault().ToString("dd MMM yyyy");
         txtOriginalPODate.Text       = Quote.OriginalPODate == null ? string.Empty : Quote.OriginalPODate.GetValueOrDefault().ToString("dd MMM yyyy");
         txtQuoteNumber.Text          = Quote.QuoteNumber;
         txtPurchaseOrderNo.Text      = Quote.PurchaseOrderNo;
         txtShippingProvider.Text     = Quote.ShippingProvider;
         txtCurrencyCode.Text         = Quote.CurrencyCode;
         txtCurrencyName.Text         = Quote.CurrencyName;
         txtTaxRate.Text              = Quote.TaxRate == null ? string.Empty : Quote.TaxRate.ToString();
         ddlOpportunity.SelectedValue = Quote.OpportunityId == null ? "0" : Quote.OpportunityId.ToString();
         ddlPaymentTerm.SelectedValue = Quote.PaymentTermId == null ? "0" : Quote.PaymentTermId.ToString();
         ddlQuoteStage.SelectedValue  = Quote.QuoteStageId == null ? "0" : Quote.QuoteStageId.ToString();
         JavaScriptSerializer ser = new JavaScriptSerializer();
         List <Entity.Sales.QuoteLineItem> lst = ser.Deserialize <List <Entity.Sales.QuoteLineItem> >(Quote.QuoteLineItem);
         ListtoDataTable lsttodt = new ListtoDataTable();
         _ItemsList = lsttodt.ToDataTable(lst);
         LoadItemList();
     }
 }
Ejemplo n.º 2
0
        private void frmUseList_Load(object sender, EventArgs e)
        {
            FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
            string apiurl = Program.WebServiceUrl + "/" + USERAPI;

            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(apiurl);

            request.Method = "GET";
            String userResultJson = String.Empty;

            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {
                Stream dataStream = response.GetResponseStream();

                StreamReader reader = new StreamReader(dataStream);
                userResultJson = reader.ReadToEnd();
                reader.Close();
                dataStream.Close();
            }
            var userCollection = jsonSerialization.DeserializeFromString <Result <List <User> > >(userResultJson);

            if (userCollection.Value != null)
            {
                _dtUser = ListtoDataTable.ToDataTable(userCollection.Value);
                dtGridUser.DataSource = _dtUser;
                gridDisplaySetting();
            }
        }
        private void loadEmailSchedulerData()
        {
            FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
            string apiurl = Program.WebServiceUrl + "/" + GET_EMAILSCHEDULER_API;

            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(apiurl);

            request.Method = "GET";
            String emailSchedulerResultJosn = String.Empty;

            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {
                Stream dataStream = response.GetResponseStream();

                StreamReader reader = new StreamReader(dataStream);
                emailSchedulerResultJosn = reader.ReadToEnd();
                reader.Close();
                dataStream.Close();
            }
            var emailSchedulerCollection = jsonSerialization.DeserializeFromString <Result <List <EmailScheduler> > >(emailSchedulerResultJosn);

            if (emailSchedulerCollection.Value != null)
            {
                _dtEmailScheduler = ListtoDataTable.ToDataTable(emailSchedulerCollection.Value);
                dataGridEmailScheduler.DataSource = _dtEmailScheduler;
                gridDisplaySetting();
            }
        }
        private void fillCurrentStatusToGoalData()
        {
            cmbCurrentStsatusToGoal.Items.Clear();

            foreach (var goal in _goals)
            {
                cmbCurrentStsatusToGoal.Items.Add(goal.Name);
            }

            _currentStatusToGoal = new CurrentStatusInfo().GetCurrentStatusToGoal(int.Parse(cmbPlanOption.Tag.ToString()));
            if (_currentStatusToGoal != null)
            {
                _dtCurrentStatustoGoals = ListtoDataTable.ToDataTable(_currentStatusToGoal.ToList());
                dtGridCurrentStatusToGoal.DataSource              = _dtCurrentStatustoGoals;
                dtGridCurrentStatusToGoal.Columns[0].Visible      = false;
                dtGridCurrentStatusToGoal.Columns[1].Visible      = false;
                dtGridCurrentStatusToGoal.Columns[2].Visible      = false;
                dtGridCurrentStatusToGoal.Columns[3].Visible      = false;
                dtGridCurrentStatusToGoal.Columns[6].Visible      = false;
                dtGridCurrentStatusToGoal.Columns[7].Visible      = false;
                dtGridCurrentStatusToGoal.Columns[8].Visible      = false;
                dtGridCurrentStatusToGoal.Columns[9].Visible      = false;
                dtGridCurrentStatusToGoal.Columns[10].Visible     = false;
                dtGridCurrentStatusToGoal.Columns[11].Visible     = false;
                dtGridCurrentStatusToGoal.Columns[5].DisplayIndex = 0;
                dtGridCurrentStatusToGoal.Columns[5].HeaderText   = "Goal";
                dtGridCurrentStatusToGoal.Columns[4].DisplayIndex = 1;
                dtGridCurrentStatusToGoal.Columns[4].HeaderText   = "Fund Allocation";
            }
        }
Ejemplo n.º 5
0
        private void loadPlanData()
        {
            FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
            string apiurl = Program.WebServiceUrl + "/" + string.Format(GET_PLAN_BY_CLIENTID_API, ClientId);

            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(apiurl);

            request.Method = "GET";
            String planerResultJson = String.Empty;

            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {
                Stream dataStream = response.GetResponseStream();

                StreamReader reader = new StreamReader(dataStream);
                planerResultJson = reader.ReadToEnd();
                reader.Close();
                dataStream.Close();
            }
            var plannerCollection = jsonSerialization.DeserializeFromString <Result <List <Planner> > >(planerResultJson);

            if (plannerCollection.Value != null)
            {
                _dtPlanner = ListtoDataTable.ToDataTable(plannerCollection.Value);
            }
        }
        public void LoadData(DataGridView dtGridView)
        {
            IList <Festivals> festivals = _festivalsInfo.GetAll();

            _dtFestivals = ListtoDataTable.ToDataTable(festivals.ToList());
            loadDataOnGrid(dtGridView, _dtFestivals);
        }
        public void LoadData(DataGridView dtGridView)
        {
            IList <CRMGroup> CRMGroup = _CRMGroupInfo.GetAll();

            _dtCRMGroup = ListtoDataTable.ToDataTable(CRMGroup.ToList());
            loadDataOnGrid(dtGridView, _dtCRMGroup);
        }
        private void AuditTrail_Load(object sender, EventArgs e)
        {
            FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
            string apiurl = Program.WebServiceUrl + "/" + string.Format(AUDITLOGCONTROLLER_BY_USER, Program.CurrentUser.UserName);

            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(apiurl);

            request.Method = "GET";
            String auditTrailJson = String.Empty;

            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {
                Stream dataStream = response.GetResponseStream();

                StreamReader reader = new StreamReader(dataStream);
                auditTrailJson = reader.ReadToEnd();
                reader.Close();
                dataStream.Close();
            }
            var auditTrailCollection = jsonSerialization.DeserializeFromString <Result <List <Activities> > >(auditTrailJson);

            if (auditTrailCollection.Value != null)
            {
                _dtAuditTrail = ListtoDataTable.ToDataTable(auditTrailCollection.Value);
                dtGridAuditTrail.DataSource = _dtAuditTrail;
                gridDisplaySetting();
            }
        }
        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();
            //}
        }
Ejemplo n.º 10
0
 public ActionResult UpdateRfId()
 {
     try
     {
         int LoginID = GetLogin();
         if (Request.Files.Count > 0 && LoginID > 0)
         {
             int            FileID   = 0;
             int            RowCount = 0;
             string         path     = Server.MapPath(ConfigurationManager.AppSettings["INVUpload"].ToString());
             CommonFunction com      = new CommonFunction();
             //Guid guFileName = Guid.NewGuid();
             string FileName      = Request.Files[0].FileName.ToString();
             string FilePath      = Server.MapPath(ConfigurationManager.AppSettings["INVUpload"]);
             string FileExtension = Path.GetExtension(Request.Files[0].FileName);
             string ip            = CommonFunction.GetIpAddress(Request);
             FileID = this.objSDC.InsertFileUploadLog(FileName + FileExtension, "RFID_" + FileName + FileExtension, LoginID.ToString(), ip, "12", "RFID_UPDATE");
             Request.Files[0].SaveAs(FilePath + FileID.ToString() + FileExtension);
             DataTable dt = com.GetDataFromExcel2(FilePath + FileID + FileExtension, true);
             if (dt == null)
             {
                 throw new Exception("DataTable is null");
             }
             DataTable pDt = ParseToString(dt);
             if (dt.Rows.Count > 0)
             {
                 List <RFIDTempTableMiewModel> lstofRfid     = this.objSvc.InventoryUploadRFID(pDt, LoginID, ip, FileID);
                 List <RFIDTempTableMiewModel> objValidLst   = lstofRfid.Where(x => (x.Status != null && x.Status.ToLower() == "valid")).ToList();
                 List <RFIDTempTableMiewModel> objInValidLst = lstofRfid.Where(x => (x.Status != null && x.Status.ToLower().Contains("invalid"))).ToList();
                 DataTable dtValid    = ListtoDataTable.ToDataTable <RFIDTempTableMiewModel>(objValidLst);
                 DataTable dtNotValid = ListtoDataTable.ToDataTable <RFIDTempTableMiewModel>(objInValidLst);
                 ExportToExcel.SaveExcel(path, FileID.ToString() + "_Valid", "Valid", dtValid);
                 ExportToExcel.SaveExcel(path, FileID.ToString() + "_InValid", "InValid", dtNotValid);
             }
             return(Json(new Response {
                 IsSuccess = true, Result = new { FileID = FileID, RowCount = RowCount }
             }));
         }
         return(Json(new Response {
             IsSuccess = false, Message = "File not uploaded"
         }));
     }
     catch (Exception ex)
     {
         ErrorLog.Log("RFIDController", "UpdateRfId", ex);
         return(Json(new Response {
             IsSuccess = false, Message = ex.Message
         }));
     }
 }
Ejemplo n.º 11
0
        public void CrearLista <T>(List <T> ListaDatos)
        {
            if (ListaDatos != null)
            {
                ListtoDataTable lsttodt = new ListtoDataTable();
                GetData = lsttodt.ToDataTable(ListaDatos);

                var bindingList = new BindingList <T>(ListaDatos);
                var source      = new BindingSource(bindingList, null);
                DGVlistaDatos.DataSource = source;
                DGVlistaDatos.Refresh();
                DGVlistaDatos.Update();
            }
        }
 public ActionResult PartialCancel(int OrderID, string LotNos, int FileNo = 0)
 {
     try
     {
         int LoginID = GetLogin();
         if (LoginID > 0)
         {
             OrderInfoViewModel objInfo = this.objMemoService.MemoInfo(OrderID);
             MemoDetail         obj     = this.objMemoService.CancelPartialMemo(OrderID, LotNos, LoginID);
             if (FileNo != 0)
             {
                 fileUploadLogModel objFile = this.objMemoService.GetFileByID(FileNo);
                 if (objFile != null)
                 {
                     String    path       = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["INVUpload"]);
                     DataTable dtValid    = ListtoDataTable.ToDataTable <InventoryUpload>(obj.Inv.Where(x => x.LotStatus == "Valid").ToList());
                     DataTable dtNotValid = ListtoDataTable.ToDataTable <InventoryUpload>(obj.Inv.Where(x => x.LotStatus == "InValid").ToList());
                     ExportToExcel.SaveExcel(path, FileNo.ToString() + "_Valid", "Valid", dtValid);
                     ExportToExcel.SaveExcel(path, FileNo.ToString() + "_InValid", "InValid", dtNotValid);
                     objFile.validInv   = obj.Inv.Where(x => x.LotStatus == "Valid").Count();
                     objFile.invalidInv = obj.Inv.Where(x => x.LotStatus == "InValid").Count();
                     this.objMemoService.UpdateFile(objFile);
                     if (obj.Counts.OrderId > 0)
                     {
                         this.objMemoService.UpdateFile(obj.Counts.OrderId, FileNo);
                     }
                 }
             }
             if (objInfo != null && obj.Counts != null && obj.Counts.OrderId > 0)
             {
                 this.objMemoService.SendMailMemo(obj.Counts.OrderId, GetEmailID(), GetFullName(), objInfo.UserDetail.loginID, "List of inventory Partial Canceled Memo from memo-", "", Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["EmailTemplate_CancelMemo"]), objInfo, LotNos);
                 bool log = this.objUDSvc.UserActivitylogs(LoginID, "Partial canceled memo", LotNos);
             }
             return(Json(new Response {
                 Code = 200, IsSuccess = true, Message = "", Result = obj.Counts.validCount
             }));
         }
         return(Json(new Response {
             IsSuccess = false, Message = string.Format(StringResource.Invalid, "Session")
         }));
     }
     catch (Exception ex)
     {
         ErrorLog.Log("MemoController", "PartialCancel", ex);
         return(Json(new Response {
             IsSuccess = false, Message = ex.Message
         }));
     }
 }
Ejemplo n.º 13
0
        internal double GetProfileValue()
        {
            IList <FinancialPlanner.Common.Model.PlanOptions.CurrentStatusToGoal> currentStatusToGoals
                = new CurrentStatusInfo().GetCurrentStatusToGoal(_optionId);

            _dtcurrentStatusToGoal = ListtoDataTable.ToDataTable(currentStatusToGoals.ToList());

            DataRow[] dr = _dtcurrentStatusToGoal.Select(string.Format("GoalName = '{0}'", _goal.Name));
            if (dr != null && dr.Count() > 0)
            {
                return((string.IsNullOrEmpty(dr[0]["FundAllocation"].ToString())) ?
                       0  : double.Parse(dr[0]["FundAllocation"].ToString()));
            }
            return(0);
        }
 public ActionResult Book(string LotNos, int CustomerID, int isConfirmed, int isSellDirect, string Remark, int FileNo = 0)
 {
     try
     {
         int LoginID = GetLogin();
         if (LoginID > 0)
         {
             MemoDetail obj = this.objMemoService.CreateMemo(LotNos, LoginID, CustomerID, isConfirmed, isSellDirect, Remark);
             if (FileNo != 0)
             {
                 fileUploadLogModel objFile = this.objMemoService.GetFileByID(FileNo);
                 if (objFile != null)
                 {
                     String    path       = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["INVUpload"]);
                     DataTable dtValid    = ListtoDataTable.ToDataTable <InventoryUpload>(obj.Inv.Where(x => x.LotStatus == "Valid").ToList());
                     DataTable dtNotValid = ListtoDataTable.ToDataTable <InventoryUpload>(obj.Inv.Where(x => x.LotStatus == "InValid").ToList());
                     ExportToExcel.SaveExcel(path, FileNo.ToString() + "_Valid", "Valid", dtValid);
                     ExportToExcel.SaveExcel(path, FileNo.ToString() + "_InValid", "InValid", dtNotValid);
                     objFile.validInv   = obj.Inv.Where(x => x.LotStatus == "Valid").Count();
                     objFile.invalidInv = obj.Inv.Where(x => x.LotStatus == "InValid").Count();
                     this.objMemoService.UpdateFile(objFile);
                     if (obj.Counts.OrderId > 0)
                     {
                         this.objMemoService.UpdateFile(obj.Counts.OrderId, FileNo);
                     }
                 }
             }
             if (obj != null && obj.Counts.OrderId != 0)
             {
                 this.objMemoService.SendMailMemo(obj.Counts.OrderId, GetEmailID(), GetFullName(), CustomerID, "List of inventory put on memo to", "", Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["EmailTemplate_PutOnMemo"]));
                 bool log = this.objUDSvc.UserActivitylogs(LoginID, "Put on memo", LotNos);
             }
             return(Json(new Response {
                 Code = 200, IsSuccess = true, Message = "", Result = obj.Counts
             }));
         }
         return(Json(new Response {
             IsSuccess = false, Message = string.Format(StringResource.Invalid, "Session")
         }));
     }
     catch (Exception ex)
     {
         ErrorLog.Log("MemoController", "Book", ex);
         return(Json(new Response {
             IsSuccess = false, Message = ex.Message
         }));
     }
 }
Ejemplo n.º 15
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);
            }
        }
        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);
            }
        }
        private void loadCustomerData()
        {
            FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
            string apiurl = Program.WebServiceUrl + "/" + CLIENTS_GETALL;

            RestAPIExecutor restApiExecutor = new RestAPIExecutor();

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

            if (jsonSerialization.IsValidJson(restResult.ToString()))
            {
                var clientColleection = jsonSerialization.DeserializeFromString <List <Client> >(restResult.ToString());
                _dtClient = ListtoDataTable.ToDataTable(clientColleection);
                fillTreeviewData(_dtClient);
            }
            else
            {
                MessageBox.Show(restResult.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        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()))
            {
                var riskProfileColleection = jsonSerialization.DeserializeFromString <List <RiskProfiledReturnMaster> >(restResult.ToString());
                _dtRiskProfile = ListtoDataTable.ToDataTable(riskProfileColleection);
                fillTreeviewData(_dtRiskProfile);
            }
            else
            {
                MessageBox.Show(restResult.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        internal DataTable GetSchemes(int investmentsegmentId)
        {
            DataTable dtSchemes = new DataTable();
            IList <RecommendedSchemes> recommendedSchemesObj = new List <RecommendedSchemes>();

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

                RestAPIExecutor restApiExecutor = new RestAPIExecutor();

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

                if (jsonSerialization.IsValidJson(restResult.ToString()))
                {
                    recommendedSchemesObj = jsonSerialization.DeserializeFromString <IList <RecommendedSchemes> >(restResult.ToString());
                }
                if (recommendedSchemesObj != null)
                {
                    dtSchemes = ListtoDataTable.ToDataTable(recommendedSchemesObj.ToList());
                }
            }
            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);
            }
            return(dtSchemes);
        }
Ejemplo n.º 20
0
        public DataTable GetRiskProfileReturnById(int id)
        {
            FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
            string apiurl = Program.WebServiceUrl + "/" + string.Format(RISKPROFILERETURN_DETAIL_GETALL, id);

            RestAPIExecutor restApiExecutor = new RestAPIExecutor();

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

            if (jsonSerialization.IsValidJson(restResult.ToString()))
            {
                var riskProfileColleection = jsonSerialization.DeserializeFromString <List <RiskProfiledReturn> >(restResult.ToString());
                _dtRiskProfileReturn.Clear();
                _dtRiskProfileReturn = ListtoDataTable.ToDataTable(riskProfileColleection);
            }
            else
            {
                MessageBox.Show(restResult.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(_dtRiskProfileReturn);
        }
Ejemplo n.º 21
0
        private async void GetListModule(string projectID)
        {
            ListModule listModule = new ListModule();

            listModule.modules = new List <Module>();
            try
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri("https://tapi.lhu.edu.vn/");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tokenLogin);
                //GET Method
                JObject jObject = new JObject();
                jObject["projectID"] = projectID;
                StringContent       post     = new StringContent(JsonConvert.SerializeObject(jObject), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PostAsync("fp/admin_File/selectcode", post);

                if (response.IsSuccessStatusCode)
                {
                    var res = await response.Content.ReadAsStringAsync();

                    JObject data  = JObject.Parse(res.ToString());
                    JArray  items = (JArray)data["data"];
                    foreach (var item in items)
                    {
                        Module module = new Module();
                        module.fileID         = item["fileID"].ToString();
                        module.ProjectID      = item["ProjectID"].ToString();
                        module.ModuleID       = item["ModuleID"].ToString();
                        module.ProjectName    = item["ProjectName"].ToString();
                        module.ModuleName     = item["moduleName"].ToString();
                        module.FileName       = item["FileName"].ToString();
                        module.FileType       = item["FileType"].ToString();
                        module.UpdateTime     = item["UpdateTime"].ToString();
                        module.UpdateUser     = item["UpdateUser"].ToString();
                        module.UpdateComputer = item["UpdateComputer"].ToString();
                        if (module.ModuleID == "jsoneditor")
                        {
                            break;
                        }
                        listModule.modules.Add(module);
                    }
                    ListtoDataTable lsttodt = new ListtoDataTable();
                    DataTable       dt      = lsttodt.ToDataTable(listModule.modules);
                    dgvListModules.DataSource = dt;

                    int columnIndex = dgvListModules.ColumnCount;
                    DataGridViewButtonColumn btnEditColumn = new DataGridViewButtonColumn();
                    btnEditColumn.Name = "edit_column";
                    btnEditColumn.Text = "Edit";
                    btnEditColumn.UseColumnTextForButtonValue = true;
                    btnEditColumn.FlatStyle = FlatStyle.Popup;
                    btnEditColumn.DefaultCellStyle.BackColor = Color.Green;
                    btnEditColumn.DefaultCellStyle.ForeColor = Color.White;
                    btnEditColumn.DefaultCellStyle.Font      = new Font("Verdana", 16, FontStyle.Bold);

                    if (dgvListModules.Columns["edit_column"] == null)
                    {
                        dgvListModules.Columns.Insert(columnIndex, btnEditColumn);
                    }
                }
                else
                {
                    MessageBox.Show("Internal server Error", "GetListModule", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "GetListModule", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }