Exemplo n.º 1
0
        private void SaveRecord()
        {
            ProductSubGroupUnitsMatrix        clsUnitMatrix = new ProductSubGroupUnitsMatrix();
            ProductSubGroupUnitsMatrixDetails clsDetails    = new ProductSubGroupUnitsMatrixDetails();

            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.º 2
0
        private void LoadRecord()
        {
            Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID));
            ProductSubGroupUnitsMatrix        clsUnitMatrix = new ProductSubGroupUnitsMatrix();
            ProductSubGroupUnitsMatrixDetails 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.º 3
0
        private Int64 SaveRecord()
        {
            ProductSubGroupUnitsMatrix        clsUnitMatrix = new ProductSubGroupUnitsMatrix();
            ProductSubGroupUnitsMatrixDetails clsDetails    = new ProductSubGroupUnitsMatrixDetails();

            clsDetails.SubGroupID      = Convert.ToInt32(lblSubGroupID.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 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();
        }