Ejemplo n.º 1
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();
			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"],Session.SessionID));
			lblMatrixID.Text = iID.ToString();

			Int64 groupid = Convert.ToInt64(Common.Decrypt(Request.QueryString["groupid"],Session.SessionID));
			lblGroupID.Text = groupid.ToString();

			ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
			
			cboBottomUnit.DataTextField = "UnitName";
			cboBottomUnit.DataValueField = "UnitID";
			cboBottomUnit.DataSource = clsDataClass.DataReaderToDataTable(clsUnitMatrix.AvailableUnitsForProduct(groupid,"UnitName",SortOption.Ascending)).DefaultView;
			cboBottomUnit.DataBind();
			cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1;

			clsUnitMatrix.CommitAndDispose();	
		}
Ejemplo n.º 2
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();
			Int64 groupid = Convert.ToInt64(Common.Decrypt(Request.QueryString["groupid"].ToString(),Session.SessionID));
			lblGroupID.Text = Convert.ToString(groupid);
			
			ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
			ProductGroupUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(groupid);

			if (clsUnitDetails.BottomUnitName == null)
			{
				ProductGroup clsProductGroup = new ProductGroup();
				ProductGroupDetails clsDetails = clsProductGroup.Details(groupid);
				clsProductGroup.CommitAndDispose();

				txtBaseUnit.Text = clsDetails.UnitDetails.UnitName;
				lblBaseUnitID.Text = clsDetails.UnitDetails.UnitID.ToString();
			}
			else
			{
				txtBaseUnit.Text = clsUnitDetails.BottomUnitName;
				lblBaseUnitID.Text = Convert.ToString(clsUnitDetails.BottomUnitID);
			}

			cboBottomUnit.DataTextField = "UnitName";
			cboBottomUnit.DataValueField = "UnitID";
			cboBottomUnit.DataSource = clsDataClass.DataReaderToDataTable(clsUnitMatrix.AvailableUnitsForProduct(groupid,"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();
		}