protected void ProductList_SelectedIndexChanged(object sender, EventArgs e) { CollectionTypeList.DataSource = _bilCollectionManager.GetCollectionTypeList(Convert.ToInt32(ClientList.SelectedValue)); CollectionTypeList.DataBind(); TranssactionTypeList.DataSource = _bilCollectionManager.GetTransactionTypeList(Convert.ToInt32(ClientList.SelectedValue), Convert.ToInt32(ProductList.SelectedValue)); TranssactionTypeList.DataBind(); ProductTypeSelectedIndexChanged(); EnableOrDisableInstrumentFields(); }
protected void Page_Load(object sender, EventArgs e) { if (Session[MtbBillCollection.Global.Definitions.SessionVariable.Value.IsLoggedIn] == null || Convert.ToBoolean(Session[MtbBillCollection.Global.Definitions.SessionVariable.Value.IsLoggedIn]) == false || (MtbBillCollection.Utility.Screen.IsUserPermitedToAccessScreen(Convert.ToInt32(Session[MtbBillCollection.Global.Definitions.SessionVariable.Value.UserTypeId].ToString()), "BillCollection")) == false) { Response.Redirect("/Default.aspx"); } if (!Page.IsPostBack) { ClientList.DataSource = _bilCollectionManager.GetClientist(); ClientList.DataBind(); if (Request.QueryString.Count > 0) { _clientid = Server.HtmlDecode(Request.QueryString[MtbBillCollection.Global.Definitions.SessionVariable.Value.ClientId].ToString()); ClientList.SelectedValue = _clientid; //lblClient.Text = ClientList.SelectedItem.Text; ViewState.Add(MtbBillCollection.Global.Definitions.SessionVariable.Value.ClientId, _clientid); } else { if (ClientList.Items.Count > 0) { ClientList.SelectedIndex = 0; //lblClient.Text = ClientList.Text; _clientid = ClientList.Items[0].Value; } } InstrumentDate.Text = DateTime.Now.Date.ToString("dd-MM-yyyy"); //lblCollectionDateValue.Text = DateTime.Now.Date.ToString("dd/MMM/yyyy"); //Date.Text = DateTime.Now.ToString("dd-MMM-yyyy"); if (_clientid != "-1") { ProductList.DataSource = _bilCollectionManager.GetProductList(Convert.ToInt32(_clientid)); ProductList.DataBind(); CollectionTypeList.DataSource = _bilCollectionManager.GetCollectionTypeList(Convert.ToInt32(_clientid)); CollectionTypeList.DataBind(); TranssactionTypeList.DataSource = _bilCollectionManager.GetTransactionTypeList(Convert.ToInt32(_clientid), Convert.ToInt32(ProductList.Items[0].Value)); TranssactionTypeList.DataBind(); } //else //{ // ProductList.DataSource = _bilCollectionManager.GetProductList(Convert.ToInt32(ClientList.Items[0].Value)); // ProductList.DataBind(); // CollectionTypeList.DataSource = _bilCollectionManager.GetCollectionTypeList(Convert.ToInt32(ClientList.Items[0].Value)); // CollectionTypeList.DataBind(); // TranssactionTypeList.DataSource = _bilCollectionManager.GetTransactionTypeList(Convert.ToInt32(ClientList.Items[0].Value), Convert.ToInt32(ProductList.Items[0].Value)); // TranssactionTypeList.DataBind(); // TranssactionTypeList.SelectedIndex = (TranssactionTypeList.Items.Count > 0) ? 0 : -1; //} InstrumentBankList.DataSource = _bilCollectionManager.GetBankList(); InstrumentBankList.DataBind(); ProductTypeSelectedIndexChanged(); if (Request.QueryString.Count > 1) { _collectionId = Server.HtmlDecode(Request.QueryString[MtbBillCollection.Global.Definitions.SessionVariable.Value.CollectionId].ToString()); _billCollectionInfo = _bilCollectionManager.GetCollectionInformtion(_collectionId); ProductList.SelectedValue = _billCollectionInfo.ProductId.ToString(); ProductTypeSelectedIndexChanged(); CollectionTypeList.SelectedValue = _billCollectionInfo.CollectionTypeId.ToString(); CollectionFrom.Text = _billCollectionInfo.CollFrom; TranssactionTypeList.SelectedValue = _billCollectionInfo.InstTypeId.ToString(); InstrumentNo.Text = _billCollectionInfo.InstNumber; InstrumentDate.Text = _billCollectionInfo.InstDate; string[] amnt = null; amnt = _billCollectionInfo.CollAmount.ToString().Split('.'); if (amnt.Length > 0) { InstrumentAmount.Text = amnt[0]; if (amnt.Length == 2) { InstrumentAmount.Text += "." + amnt[1].Substring(0, 2); } } InstrumentBankList.SelectedValue = _billCollectionInfo.InstBankCode.ToString(); txtRemarks.Text = _billCollectionInfo.Remarks; //SaveButton.Text = "Update"; _previousPage = this.PreviousPage; _saveMode = false; ViewState.Add(MtbBillCollection.Global.Definitions.SessionVariable.Value.SaveMode, _saveMode); ViewState.Add(MtbBillCollection.Global.Definitions.SessionVariable.Value.CollectionId, _collectionId); } else { CollectionFrom.Focus(); initializeFields(); } //TranssactionTypeList.Attributes.Add("onchange", "ShowData()"); } else { ProductList.Enabled = true; TranssactionTypeList.Enabled = true; InstrumentAmount.Enabled = true; InstrumentBankList.Enabled = true; } EnableOrDisableInstrumentFields(); }