Пример #1
0
        private void SetControls(string action, PropertyVo propertyVo, CustomerAccountsVo customerAccountsVo, string path)
        {
            try
            {
                txtAccountNum.Enabled    = false;
                txtModeofHolding.Enabled = false;
                //txtPurchaseDate.Enabled = false;
                txtModeofHolding.Text = XMLBo.GetModeOfHoldingName(path, customerAccountsVo.ModeOfHolding.ToString());
                txtAccountNum.Text    = customerAccountsVo.AccountNum.ToString();
                if (customerAccountsVo.AccountOpeningDate != DateTime.MinValue)
                {
                    txtPurchaseDate.Text = customerAccountsVo.AccountOpeningDate.ToShortDateString();
                }

                //txtPropertyName.Text = customerAccountsVo.
                // Joint Holders
                // Nominees

                // Bind Initial Drop Downs
                BindDropDowns(propertyVo, customerAccountsVo, path);
                BindInstrumentSubCategory(customerAccountsVo);
                ddlInstrumentCat.SelectedValue    = customerAccountsVo.AssetCategory.ToString().Trim();
                ddlInstrumentSubCat.SelectedValue = customerAccountsVo.AssetSubCategory.Trim();

                if (action == "entry")
                {
                    // Clear all controls here
                    txtPropertyName.Text = "";
                    txtAdrLine1.Text     = "";
                    txtAdrLine2.Text     = "";
                    txtAdrLine3.Text     = "";
                    txtPinCode.Text      = "";
                    txtCity.Text         = "";
                    txtPurchaseDate.Text = "";
                    txtPurchaseDate_CalendarExtender.Enabled         = true;
                    txtPurchaseDate_TextBoxWatermarkExtender.Enabled = true;
                    //imgPurchaseDate.Visible = true;
                    //dvPurchaseDate.Visible = true;
                    txtQuantity.Text      = "";
                    txtPurchasePrice.Text = "";
                    txtPurchaseValue.Text = "";
                    txtCurrentPrice.Text  = "";
                    txtCurrentValue.Text  = "";
                    txtSaleDate.Text      = "";
                    txtSaleDate_CalendarExtender.Enabled         = true;
                    txtSaleDate_TextBoxWatermarkExtender.Enabled = true;
                    //imgSaleDate.Visible = true;
                    //dvSaleDate.Visible = true;
                    txtSaleRate.Text     = "";
                    txtSaleProceeds.Text = "";
                    txtRemarks.Text      = "";

                    // Enable/Disable Controls
                    ddlInstrumentCat.Enabled    = false;
                    ddlInstrumentSubCat.Enabled = false;

                    txtPropertyName.Enabled  = true;
                    txtAdrLine1.Enabled      = true;
                    txtAdrLine2.Enabled      = true;
                    txtAdrLine3.Enabled      = true;
                    txtPinCode.Enabled       = true;
                    txtCity.Enabled          = true;
                    txtPurchaseDate.Enabled  = true;
                    txtQuantity.Enabled      = true;
                    txtPurchasePrice.Enabled = true;
                    txtPurchaseValue.Enabled = true;
                    txtCurrentPrice.Enabled  = true;
                    txtCurrentValue.Enabled  = true;
                    txtSaleDate.Enabled      = true;
                    txtSaleRate.Enabled      = true;
                    txtSaleProceeds.Enabled  = true;
                    txtRemarks.Enabled       = true;

                    trSubmitButton.Visible = true;
                    btnSubmit.Text         = "Submit";
                }
                else
                {
                    ddlInstrumentCat.Enabled    = false;
                    ddlInstrumentSubCat.Enabled = false;

                    // Set the Drop Downs to respective values

                    ddlMeasureCode.SelectedValue = propertyVo.MeasureCode.Trim();
                    ddlState.SelectedValue       = propertyVo.PropertyState.ToString();
                    // Bind values to the respective controls
                    txtPropertyName.Text = propertyVo.Name.ToString().Trim();
                    txtAdrLine1.Text     = propertyVo.PropertyAdrLine1.ToString().Trim();
                    txtAdrLine2.Text     = propertyVo.PropertyAdrLine2.ToString().Trim();
                    txtAdrLine3.Text     = propertyVo.PropertyAdrLine3.ToString().Trim();
                    txtPinCode.Text      = propertyVo.PropertyPinCode.ToString();
                    txtCity.Text         = propertyVo.PropertyCity.ToString().Trim();;
                    if (propertyVo.PurchaseDate != DateTime.MinValue)
                    {
                        txtPurchaseDate.Text = propertyVo.PurchaseDate.ToShortDateString().Trim();
                    }
                    ;
                    txtQuantity.Text      = propertyVo.Quantity.ToString().Trim();
                    txtPurchasePrice.Text = propertyVo.PurchasePrice.ToString();
                    txtPurchaseValue.Text = propertyVo.PurchaseValue.ToString();
                    txtCurrentPrice.Text  = propertyVo.CurrentPrice.ToString();
                    txtCurrentValue.Text  = propertyVo.CurrentValue.ToString();
                    if (propertyVo.SellDate != DateTime.MinValue)
                    {
                        txtSaleDate.Text = propertyVo.SellDate.ToShortDateString();
                    }
                    txtSaleRate.Text     = propertyVo.SellPrice.ToString();
                    txtSaleProceeds.Text = propertyVo.SellValue.ToString();
                    if (propertyVo.Remark != null)
                    {
                        txtRemarks.Text = propertyVo.Remark.ToString().Trim();
                    }
                    else
                    {
                        txtRemarks.Text = "";
                    }



                    EnableDisableControls(action);
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "PortfolioPropertyEntry.ascx:SetControls()");
                object[] objects = new object[4];

                objects[0] = action;
                objects[1] = propertyVo;
                objects[2] = customerAccountsVo;
                objects[3] = path;

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }