Example #1
0
        private void LoadOptions()
        {
            DataClass clsDataClass = new DataClass();

            Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID));

            Data.Unit clsUnit = new Data.Unit();

            cboProductGroupUnit.DataTextField  = "UnitName";
            cboProductGroupUnit.DataValueField = "UnitID";
            cboProductGroupUnit.DataSource     = clsUnit.ListAsDataTable().DefaultView;
            cboProductGroupUnit.DataBind();
            cboProductGroupUnit.SelectedIndex = cboProductGroupUnit.Items.Count - 1;

            clsUnit.CommitAndDispose();

            ProductGroupUnitsMatrix        clsUnitMatrix  = new ProductGroupUnitsMatrix();
            ProductGroupUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(iID);

            clsUnitMatrix.CommitAndDispose();
            if (clsUnitDetails.BottomUnitName == null)
            {
                cboProductGroupUnit.Enabled = true;
            }
        }
Example #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();
        }