private void LoadOptions() { DataClass clsDataClass = new DataClass(); Int32 iID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"],Session.SessionID)); lblMatrixID.Text = iID.ToString(); Int32 subgroupid = Convert.ToInt32(Common.Decrypt(Request.QueryString["subgroupid"],Session.SessionID)); lblSubGroupID.Text = subgroupid.ToString(); ProductSubGroupUnitsMatrix clsUnitMatrix = new ProductSubGroupUnitsMatrix(); cboBottomUnit.DataTextField = "UnitName"; cboBottomUnit.DataValueField = "UnitID"; cboBottomUnit.DataSource = clsDataClass.DataReaderToDataTable(clsUnitMatrix.AvailableUnitsForProduct(subgroupid,"UnitName",SortOption.Ascending)).DefaultView; cboBottomUnit.DataBind(); cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1; clsUnitMatrix.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); int subgroupid = Convert.ToInt32(Common.Decrypt(Request.QueryString["subgroupid"].ToString(),Session.SessionID)); lblSubGroupID.Text = Convert.ToString(subgroupid); ProductSubGroupUnitsMatrix clsUnitMatrix = new ProductSubGroupUnitsMatrix(); ProductSubGroupUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(subgroupid); if (clsUnitDetails.BottomUnitName == null) { ProductSubGroup clsProductSubGroup = new ProductSubGroup(); ProductSubGroupDetails clsDetails = clsProductSubGroup.Details(subgroupid); clsProductSubGroup.CommitAndDispose(); txtBaseUnit.Text = clsDetails.BaseUnitName; lblBaseUnitID.Text = Convert.ToString(clsDetails.BaseUnitID); } else { txtBaseUnit.Text = clsUnitDetails.BottomUnitName; lblBaseUnitID.Text = Convert.ToString(clsUnitDetails.BottomUnitID); } cboBottomUnit.DataTextField = "UnitName"; cboBottomUnit.DataValueField = "UnitID"; cboBottomUnit.DataSource = clsDataClass.DataReaderToDataTable(clsUnitMatrix.AvailableUnitsForProduct(subgroupid,"UnitName",SortOption.Ascending)).DefaultView; cboBottomUnit.DataBind(); if (cboBottomUnit.Items.Contains( new ListItem(txtBaseUnit.Text, lblBaseUnitID.Text))) { cboBottomUnit.Items.RemoveAt( cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(lblBaseUnitID.Text))); } cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1; clsUnitMatrix.CommitAndDispose(); }