Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
        private void SaveRecord()
        {
            ProductGroupUnitsMatrix        clsUnitMatrix = new ProductGroupUnitsMatrix();
            ProductGroupUnitsMatrixDetails clsDetails    = new ProductGroupUnitsMatrixDetails();

            clsDetails.MatrixID        = Convert.ToInt64(lblMatrixID.Text);
            clsDetails.BaseUnitID      = Convert.ToInt32(lblBaseUnitID.Text);
            clsDetails.BaseUnitValue   = Convert.ToDecimal(txtBaseUnitValue.Text);
            clsDetails.BottomUnitID    = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
            clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text);
            clsUnitMatrix.Update(clsDetails);

            clsUnitMatrix.CommitAndDispose();
        }
Exemplo n.º 3
0
        private Int64 SaveRecord()
        {
            ProductGroupUnitsMatrix        clsUnitMatrix = new ProductGroupUnitsMatrix();
            ProductGroupUnitsMatrixDetails clsDetails    = new ProductGroupUnitsMatrixDetails();

            clsDetails.GroupID         = Convert.ToInt64(lblGroupID.Text);
            clsDetails.BaseUnitID      = Convert.ToInt32(lblBaseUnitID.Text);
            clsDetails.BaseUnitValue   = Convert.ToDecimal(txtBaseUnitValue.Text);
            clsDetails.BottomUnitID    = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
            clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text);
            Int64 id = clsUnitMatrix.Insert(clsDetails);

            clsUnitMatrix.CommitAndDispose();

            return(id);
        }
Exemplo n.º 4
0
        private void LoadRecord()
        {
            Int64 iID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"], Session.SessionID));
            ProductGroupUnitsMatrix        clsUnitMatrix = new ProductGroupUnitsMatrix();
            ProductGroupUnitsMatrixDetails clsDetails    = clsUnitMatrix.Details(iID);

            lblBaseUnitID.Text    = clsDetails.BaseUnitID.ToString();
            txtBaseUnit.Text      = Convert.ToString(clsDetails.BaseUnitName);
            txtBaseUnitValue.Text = clsDetails.BaseUnitValue.ToString();

            //			cboBottomUnit.Items.RemoveAt( cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(lblBaseUnitID.Text)));
            cboBottomUnit.SelectedIndex = cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(clsDetails.BottomUnitID.ToString()));
            txtBottomUnitValue.Text     = clsDetails.BottomUnitValue.ToString();

            clsUnitMatrix.CommitAndDispose();
        }
Exemplo n.º 5
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();
        }