protected void lvRateExchange_ItemUpdating(object sender, ListViewUpdateEventArgs e) { ExchangeRatesRepository facade = new ExchangeRatesRepository(); StoreProRepository storeFacade = new StoreProRepository(); TextBox tbcurrency = (lvRateExchange.EditItem.FindControl("tbCurrency")) as TextBox; RadNumericTextBox rnbVNDRate = (lvRateExchange.EditItem.FindControl("rnbVNDRate")) as RadNumericTextBox; Label lbl = (lvRateExchange.Items[e.ItemIndex].FindControl("lbID")) as Label; String ids = ""; if (lbl != null) ids = lbl.Text; B_ExchangeRates exchangeRate = new B_ExchangeRates(); exchangeRate.Rate = (decimal)rnbVNDRate.Value; exchangeRate.Currency = tbcurrency.Text; exchangeRate.Id = Int32.Parse(ids); B_ExchangeRates exits = facade.GetById(exchangeRate.Id); if (exits != null) { storeFacade.StoreProcessor().B_ExchangeRate_history_process(exchangeRate.Currency, exchangeRate.Rate, this.UserId, 2); facade.Update(facade.GetById(exchangeRate.Id), exchangeRate); facade.Commit(); } lvRateExchange.EditIndex = -1; LoadDataTolvRateExchange(); }
protected void lvRateExchange_ItemInserting(object sender, ListViewInsertEventArgs e) { ExchangeRatesRepository facade = new ExchangeRatesRepository(); StoreProRepository storeFacade = new StoreProRepository(); TextBox tbcurrency = (lvRateExchange.InsertItem.FindControl("tbCurrency")) as TextBox; RadNumericTextBox rnbVNDRate = (lvRateExchange.InsertItem.FindControl("rnbVNDRate")) as RadNumericTextBox; B_ExchangeRates exchangeRate = new B_ExchangeRates(); exchangeRate.Rate = (decimal)rnbVNDRate.Value; exchangeRate.Currency = tbcurrency.Text; storeFacade.StoreProcessor().B_ExchangeRate_history_process(exchangeRate.Currency, exchangeRate.Rate, this.UserId, 1); facade.Add(exchangeRate); facade.Commit(); LoadDataTolvRateExchange(); }
protected void lvRateExchange_ItemDeleting(object sender, ListViewDeleteEventArgs e) { String ids = ""; Label lbl = (lvRateExchange.Items[e.ItemIndex].FindControl("lbID")) as Label; if (lbl != null) ids = lbl.Text; if (!String.IsNullOrEmpty(ids)) { StoreProRepository storeFacade = new StoreProRepository(); ExchangeRatesRepository facade = new ExchangeRatesRepository(); var itm = facade.GetById(Int16.Parse(ids)); if (itm != null) { storeFacade.StoreProcessor().B_ExchangeRate_history_process(itm.Currency, itm.Rate, this.UserId, 3); facade.Delete(itm); facade.Commit(); LoadDataTolvRateExchange(); } } }
protected void Load_SubLimit_DataToReview(string SubLimitID) { BankProject.Controls.Commont.SetEmptyFormControls(this.Controls); //xoa du lieu truoc' do tren form, gan lai gia tri moi' cho Item string CustomerID = SubLimitID.Substring(0, 7); string HanMucCon = SubLimitID.Substring(8, 4); string STTSub = SubLimitID.Substring(13, 2); string KieuHanMuc = ""; decimal rateusd = 1; if (HanMucCon == "7700") { KieuHanMuc = "7000"; } else if (HanMucCon == "8700") { KieuHanMuc = "8000"; } Load_MainLimit_DataToReview(CustomerID + "." + KieuHanMuc); //Load data cho phan Han muc cha tbLimitID.Text = SubLimitID; tbCustomerID.Text = CustomerID; LoadCustomerName(tbCustomerID.Text); rcbGlobalLimit.SelectedValue = HanMucCon; ExchangeRatesRepository exchangeFacade = new ExchangeRatesRepository(); var exchangeRate = exchangeFacade.GetRate("USD").FirstOrDefault(); if (exchangeRate != null) { rateusd = exchangeRate.Rate; } if (TriTT.B_CUSTOMER_LIMIT_LoadCustomerName(SubLimitID.Substring(0, 7)) != null) // lay customreID { lblCheckCustomerName.Text = ""; lblCustomerName.Text = TriTT.B_CUSTOMER_LIMIT_LoadCustomerName(SubLimitID.Substring(0, 7)).ToString(); } else { lblCheckCustomerName.Text = "Customer does not exist !"; } rcbCollateral.Enabled = rcbCollateralType.Enabled = rcbFandA.Enabled = true;// cho phep chinh sua khi tao han muc con rcbFandA.SelectedIndex = 1; // mac dinh gan la variable; rcbFandA.Enabled = false; DataSet ds1 = TriTT.B_CUSTOMER_LIMIT_SUB_Load_for_tab_ORTHER_DETAILS(SubLimitID); if (ds1.Tables != null && ds1.Tables.Count > 0 && ds1.Tables[0].Rows.Count > 0) { //= ds1.Tables[0].Rows[0]["SubLimitID"].ToString(); rcbProduct.SelectedValue = ds1.Tables[0].Rows[0]["ProductID"].ToString(); rcbFandA.SelectedValue = "Variable"; // gan mac dinh khi chua tao han muc con rcbFandA.SelectedValue = ds1.Tables[0].Rows[0]["Mode"].ToString();// gan lai gia tri Khi han muc con da duoc tao rcbCollateralType.SelectedValue = ds1.Tables[0].Rows[0]["CollateralTypeCode"].ToString(); rcbCollateralType.Text = rcbCollateralType.SelectedValue + " - " + ds1.Tables[0].Rows[0]["CollateralTypeName"].ToString(); LoadCollateralCode(rcbCollateralType.SelectedValue); //string AmtSecured = (ds1.Tables[0].Rows[0]["AmtSecured"].ToString() != "" ? ds1.Tables[0].Rows[0]["AmtSecured"].ToString() : "0"); //lblCollateralAmt.Text = string.Format("{0:C}",Convert.ToDouble ( AmtSecured) ).Replace("$", ""); rcbCollateral.SelectedValue = ds1.Tables[0].Rows[0]["CollateralCode"].ToString(); rcbCollateral.Text = rcbCollateral.SelectedValue + " - " + ds1.Tables[0].Rows[0]["CollateralName"].ToString(); lblCollReqdAmt.Text = ds1.Tables[0].Rows[0]["CollReqdAmt"].ToString(); lblColReqdPct.Text = ds1.Tables[0].Rows[0]["CollReqdPct"].ToString(); lblUpToPeriod.Text = ds1.Tables[0].Rows[0]["UptoPeriod"].ToString(); lblPeriodAmt.Text = ds1.Tables[0].Rows[0]["PeriodAmt"].ToString(); lblPeriodPct.Text = ds1.Tables[0].Rows[0]["PeriodPct"].ToString(); tbMaxSecured.Text = ds1.Tables[0].Rows[0]["MaxSecured"].ToString(); tbMaxUnsecured.Text = ds1.Tables[0].Rows[0]["MaxUnSecured"].ToString(); tbMaxTotal.Text = ds1.Tables[0].Rows[0]["MaxTotal"].ToString(); tbAdvisedAmt.Text = ds1.Tables[0].Rows[0]["AdvisedAmt"].ToString(); tbIntLimitAmt.Text = ds1.Tables[0].Rows[0]["InternalLimitAmt"].ToString(); lblOtherSecured.Text = ds1.Tables[0].Rows[0]["OtherSecured"].ToString(); lblCollateralRight.Text = ds1.Tables[0].Rows[0]["CollateralRight"].ToString(); if (ds1.Tables[0].Rows[0]["ApprovedDate"].ToString() != "") { RdpApprovedDate.SelectedDate = DateTime.Parse(ds1.Tables[0].Rows[0]["ApprovedDate"].ToString()); } //else //{ // RdpApprovedDate.SelectedDate = null; //} if (ds1.Tables[0].Rows[0]["OfferedUntil"].ToString() != "") { RdpOfferedUnit.SelectedDate = DateTime.Parse(ds1.Tables[0].Rows[0]["OfferedUntil"].ToString()); } //else //{ // RdpOfferedUnit.SelectedDate = null; //} if (ds1.Tables[0].Rows[0]["ExpiryDate"].ToString() != "") { rdpExpiryDate.SelectedDate = DateTime.Parse(ds1.Tables[0].Rows[0]["ExpiryDate"].ToString()); } //else //{ // rdpExpiryDate.SelectedDate = null; //} if (ds1.Tables[0].Rows[0]["ProposalDate"].ToString() != "") { RdpProposalDate.SelectedDate = DateTime.Parse(ds1.Tables[0].Rows[0]["ProposalDate"].ToString()); } //else //{ // RdpProposalDate.SelectedDate = null; //} if (ds1.Tables[0].Rows[0]["Availabledate"].ToString() != "") { RdpAvailableDate.SelectedDate = DateTime.Parse(ds1.Tables[0].Rows[0]["Availabledate"].ToString()); } //else //{ // RdpAvailableDate.SelectedDate = null; //} //lblOnlineLimit.Text = ds1.Tables[0].Rows[0]["Onlinelimit"].ToString(); //lblAvailableAmt.Text = ds1.Tables[0].Rows[0]["AvailableAmt"].ToString(); //lblTotalOutstand.Text = ds1.Tables[0].Rows[0]["TotalOutstand"].ToString(); LoadToolBar_AllFalse(); BankProject.Controls.Commont.SetTatusFormControls(this.Controls, false); Enable_toAudit = true; // flag cho phep audit thong tin , Acct exists trong DB roi //load them thong tin de view theo yeu cau nghiep vu DataSet ds2 = TriTT.B_CUSTOMER_LIMIT_SUB_Load_them_data_SecuredAmt(SubLimitID); if (ds2.Tables != null && ds2.Tables.Count > 0 && ds2.Tables[0].Rows.Count > 0) { lblCollateralAmt.Text = ds2.Tables[0].Rows[0]["SecuredAmount"].ToString(); } decimal amtVND = 0; decimal amtUSD = 0; DataSet ds3 = TriTT.B_CUSTOMER_LIMIT_SUB_Load_them_data_AvailableAmt(SubLimitID.Substring(0, 7), "VND", "AvailableAmt"); if (ds3.Tables != null && ds3.Tables.Count > 0 && ds3.Tables[0].Rows.Count > 0) { decimal.TryParse(ds3.Tables[0].Rows[0]["Avaiable_Amt"].ToString(), out amtVND); } DataSet ds31 = TriTT.B_CUSTOMER_LIMIT_SUB_Load_them_data_AvailableAmt(SubLimitID.Substring(0, 7), "USD", "AvailableAmt"); if (ds3.Tables != null && ds3.Tables.Count > 0 && ds3.Tables[0].Rows.Count > 0) { decimal.TryParse(ds31.Tables[0].Rows[0]["Avaiable_Amt"].ToString(), out amtUSD); amtUSD = amtUSD * rateusd; } lblAvailableAmt.Text = (amtUSD + amtVND).ToString("#,##.00"); decimal outVND = 0; decimal outUSD = 0; DataSet ds4 = TriTT.B_CUSTOMER_LIMIT_SUB_Load_them_data_AvailableAmt(SubLimitID.Substring(0, 7), "VND", "OutstandingAmt"); if (ds4.Tables != null && ds4.Tables.Count > 0 && ds4.Tables[0].Rows.Count > 0) { decimal.TryParse(ds4.Tables[0].Rows[0]["Outstanding_Loan_Amt"].ToString(), out outVND); } DataSet ds41 = TriTT.B_CUSTOMER_LIMIT_SUB_Load_them_data_AvailableAmt(SubLimitID.Substring(0, 7), "USD", "OutstandingAmt"); if (ds4.Tables != null && ds4.Tables.Count > 0 && ds4.Tables[0].Rows.Count > 0) { decimal.TryParse(ds41.Tables[0].Rows[0]["Outstanding_Loan_Amt"].ToString(), out outUSD); outUSD = outUSD * rateusd; } lblTotalOutstand.Text = (outVND + outUSD).ToString("#,##.00"); lblOnlineLimit.Text = TriTT.B_CUSTOMER_LIMIT_SUB_Load_them_data_TotalLimit(SubLimitID.Substring(0, 7));//load theo yeu cau cua nghiep vu lblExchangeRate.Text = rateusd.ToString("#,###.##"); } }
private void LoadDataTolvRateExchange() { ExchangeRatesRepository facade = new ExchangeRatesRepository(); var db = facade.GetAll(); lvRateExchange.DataSource = db.ToList(); lvRateExchange.DataBind(); }
private void getOrderDetait(String SubLimitID) { decimal rateusd = 1; ExchangeRatesRepository exchangeFacade = new ExchangeRatesRepository(); var exchangeRate = exchangeFacade.GetRate("USD").FirstOrDefault(); if (exchangeRate != null) { rateusd = exchangeRate.Rate; } decimal amtVND = 0; decimal amtUSD = 0; DataSet ds3 = TriTT.B_CUSTOMER_LIMIT_SUB_Load_them_data_AvailableAmt(SubLimitID.Substring(0, 7), "VND", "AvailableAmt"); if (ds3.Tables != null && ds3.Tables.Count > 0 && ds3.Tables[0].Rows.Count > 0) { decimal.TryParse(ds3.Tables[0].Rows[0]["Avaiable_Amt"].ToString(), out amtVND); } DataSet ds31 = TriTT.B_CUSTOMER_LIMIT_SUB_Load_them_data_AvailableAmt(SubLimitID.Substring(0, 7), "USD", "AvailableAmt"); if (ds3.Tables != null && ds3.Tables.Count > 0 && ds3.Tables[0].Rows.Count > 0) { decimal.TryParse(ds31.Tables[0].Rows[0]["Avaiable_Amt"].ToString(), out amtUSD); amtUSD = amtUSD * rateusd; } lblAvailableAmt.Text = (amtUSD + amtVND).ToString("#,##.00"); decimal outVND = 0; decimal outUSD = 0; DataSet ds4 = TriTT.B_CUSTOMER_LIMIT_SUB_Load_them_data_AvailableAmt(SubLimitID.Substring(0, 7), "VND", "OutstandingAmt"); if (ds4.Tables != null && ds4.Tables.Count > 0 && ds4.Tables[0].Rows.Count > 0) { decimal.TryParse(ds4.Tables[0].Rows[0]["Outstanding_Loan_Amt"].ToString(), out outVND); } DataSet ds41 = TriTT.B_CUSTOMER_LIMIT_SUB_Load_them_data_AvailableAmt(SubLimitID.Substring(0, 7), "USD", "OutstandingAmt"); if (ds4.Tables != null && ds4.Tables.Count > 0 && ds4.Tables[0].Rows.Count > 0) { decimal.TryParse(ds41.Tables[0].Rows[0]["Outstanding_Loan_Amt"].ToString(), out outUSD); outUSD = outUSD * rateusd; } lblTotalOutstand.Text = (outVND + outUSD).ToString("#,##.00"); lblOnlineLimit.Text = TriTT.B_CUSTOMER_LIMIT_SUB_Load_them_data_TotalLimit(SubLimitID.Substring(0, 7));//load theo yeu cau cua nghiep vu lblExchangeRate.Text = rateusd.ToString("#,###.##"); }