/// <summary> /// It will get the Customer Details and returns their Expense details based on that Customer /// </summary> /// <param name="customerId"></param> public void GetCustomerIncomeDetails(int customerId) { try { DataTable dtIncomeDetails = new DataTable(); CustomerBo customerBo = new CustomerBo(); dtIncomeDetails = customerBo.GetCustomerIncomeDetails(customerId); if (dtIncomeDetails.Rows.Count == 0) { btnEdit.Visible = false; btnSave.Text = "Save"; EnableAllControls(); txttotal.Visible = true; txttotalyear.Visible = true; } else { txttotal.Visible = true; txttotalyear.Visible = true; if (dtIncomeDetails.Rows[0]["CI_AgriculturalIncome"].ToString() != "") { txtAIMonthly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_AgriculturalIncome"].ToString())); txtAIYearly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_AgriculturalIncome"].ToString()) * 12).ToString(); ddlAICurrency.SelectedValue = dtIncomeDetails.Rows[0]["XC_CurrencyCodeAgriculturalIncome"].ToString(); } if (dtIncomeDetails.Rows[0]["CI_GrossSalary"].ToString() != "") { txtGSMonthly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_GrossSalary"].ToString())); txtGSYearly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_GrossSalary"].ToString()) * 12).ToString(); ddlGSCurrency.SelectedValue = dtIncomeDetails.Rows[0]["XC_CurrencyCodeGrossSalary"].ToString(); } if (dtIncomeDetails.Rows[0]["CI_TakeHomeSalary"].ToString() != "") { txtTHSMonthly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_TakeHomeSalary"].ToString())); txtTHSYearly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_TakeHomeSalary"].ToString()) * 12).ToString(); ddlTHSCurrency.SelectedValue = dtIncomeDetails.Rows[0]["XC_CurrencyCodeTakeHomeSalary"].ToString(); } if (dtIncomeDetails.Rows[0]["CI_RentalIncome"].ToString() != "") { txtRIMonthly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_RentalIncome"].ToString())); txtRIYearly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_RentalIncome"].ToString()) * 12).ToString(); ddlRICurrency.SelectedValue = dtIncomeDetails.Rows[0]["XC_CurrencyCodeRentalIncome"].ToString(); } if (dtIncomeDetails.Rows[0]["CI_PensionIncome"].ToString() != "") { txtPIMonthly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_PensionIncome"].ToString())); txtPIYearly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_PensionIncome"].ToString()) * 12).ToString(); ddlPICurrency.SelectedValue = dtIncomeDetails.Rows[0]["XC_CurrencyCodePensionIncome"].ToString(); } if (dtIncomeDetails.Rows[0]["CI_BusinessIncome"].ToString() != "") { txtBIMonthly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_BusinessIncome"].ToString())); txtBIYearly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_BusinessIncome"].ToString()) * 12).ToString(); ddlBICurrency.SelectedValue = dtIncomeDetails.Rows[0]["XC_CurrencyCodeBusinessIncome"].ToString(); } if (dtIncomeDetails.Rows[0]["CI_OtherSourceIncome"].ToString() != "") { txtOSIMonthly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_OtherSourceIncome"].ToString())); txtOSIYearly.Text = String.Format("{0:0.00}", decimal.Parse(dtIncomeDetails.Rows[0]["CI_OtherSourceIncome"].ToString()) * 12).ToString(); ddlOSICurrency.SelectedValue = dtIncomeDetails.Rows[0]["XC_CurrencyCodeOtherSourceIncome"].ToString(); } txttotal.Text = (decimal.Parse(txtGSMonthly.Text) + decimal.Parse(txtRIMonthly.Text) + decimal.Parse(txtPIMonthly.Text) + decimal.Parse(txtAIMonthly.Text) + decimal.Parse(txtBIMonthly.Text) + decimal.Parse(txtOSIMonthly.Text)).ToString(); txttotalyear.Text = (decimal.Parse(txtGSYearly.Text) + decimal.Parse(txtRIYearly.Text) + decimal.Parse(txtPIYearly.Text) + decimal.Parse(txtAIYearly.Text) + decimal.Parse(txtBIYearly.Text) + decimal.Parse(txtOSIYearly.Text)).ToString(); if (dtIncomeDetails.Rows[0]["CI_DateOfEntry"].ToString() != "") { txtDateOfEntry.Text = DateTime.Parse(dtIncomeDetails.Rows[0]["CI_DateOfEntry"].ToString()).ToShortDateString(); } if (dtIncomeDetails.Rows[0]["CPA_AccountId"].ToString() != "") { ddlRIProperty.SelectedValue = dtIncomeDetails.Rows[0]["CPA_AccountId"].ToString(); } else { ddlRIProperty.SelectedValue = "Pick a Property"; } btnEdit.Visible = true; btnSave.Text = "Update"; btnSave.Visible = false; DisableAllControls(); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerIncome.ascx:GetCustomerIncomeDetails()"); object[] objects = new object[1]; objects[0] = customerId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }