public void GetAllCostCentersTest()
        {
            CostCenter costCenter = new CostCenter(connManager);
            DataSet    ds         = costCenter.GetAll();

            Assert.AreEqual(11, ds.Tables[0].Columns.Count);
        }
Beispiel #2
0
    private void SetInergyLocation()
    {
        CostCenter costCenter = new CostCenter(SessionManager.GetSessionValueNoRedirect(this.Page, SessionStrings.CONNECTION_MANAGER));

        costCenter.Id = Int32.Parse(cmbCostCenter.SelectedValue);
        DataSet ds = costCenter.GetAll(true);

        if (ds.Tables[0].Rows.Count > 1 || ds.Tables[0].Rows.Count == 0)
        {
            cmbInergyLocation.SelectedValue = ApplicationConstants.INT_NULL_VALUE.ToString();
            cmbInergyLocation.Text          = String.Empty;
            //When SelectedValue property of cmbInergyLocation is set, the SelectedIndexChanged event of cmbInergyLocation is not fired.
            //This is why we have to manually set the currency when the user selects a cost center which causes the cmbInergyLocation combo to
            //change its selected value
            SetCurrency();
            return;
        }

        int idInergyLocation = ApplicationConstants.INT_NULL_VALUE;

        idInergyLocation = (int)ds.Tables[0].Rows[0]["IdInergyLocation"];
        if (idInergyLocation != ApplicationConstants.INT_NULL_VALUE)
        {
            cmbInergyLocation.SelectedValue = idInergyLocation.ToString();
        }
        else
        {
            cmbInergyLocation.SelectedValue = ApplicationConstants.INT_NULL_VALUE.ToString();
            cmbInergyLocation.Text          = String.Empty;
        }
        //When SelectedValue property of cmbInergyLocation is set, the SelectedIndexChanged event of cmbInergyLocation is not fired.
        //This is why we have to manually set the currency when the user selects a cost center which causes the cmbInergyLocation combo to
        //change its selected value
        SetCurrency();
    }
Beispiel #3
0
    private void LoadCostCenterCodeCombo()
    {
        CostCenter costCenter = new CostCenter(SessionManager.GetSessionValueNoRedirect(this.Page, SessionStrings.CONNECTION_MANAGER));

        costCenter.IdInergyLocation = Int32.Parse(cmbInergyLocation.SelectedValue);
        DataSet ds = costCenter.GetAll(true);

        if (ds != null)
        {
            cmbCostCenter.Items.Clear();
            DSUtils.AddEmptyRecord(ds.Tables[0]);
            cmbCostCenter.DataSource     = ds;
            cmbCostCenter.DataMember     = ds.Tables[0].TableName;
            cmbCostCenter.DataTextField  = "Code";
            cmbCostCenter.DataValueField = "Id";
            cmbCostCenter.DataBind();
        }
    }