private void LoadFunctions() { CostCenterFilter costCenterFilter = new CostCenterFilter(SessionManager.GetSessionValueNoRedirect(this, SessionStrings.CONNECTION_MANAGER)); DataSet functionDS = costCenterFilter.SelectProcedure("SelectFunction"); cmbFunction.DataSource = functionDS; cmbFunction.DataMember = functionDS.Tables[0].ToString(); cmbFunction.DataValueField = "Id"; cmbFunction.DataTextField = "Name"; cmbFunction.DataBind(); }
private void LoadInergyLocationsFiltered(int countryId) { CostCenterFilter costCenterFilter = new CostCenterFilter(SessionManager.GetSessionValueNoRedirect(this, SessionStrings.CONNECTION_MANAGER)); costCenterFilter.IdCountry = countryId; DataSet inergyLocationDS = costCenterFilter.SelectProcedure("SelectInergyLocation"); cmbInergyLocation.DataSource = inergyLocationDS; cmbInergyLocation.DataMember = inergyLocationDS.Tables[0].ToString(); cmbInergyLocation.DataValueField = "Id"; cmbInergyLocation.DataTextField = "Name"; cmbInergyLocation.DataBind(); }
private CostCenterFilter GetCostCenterInfo() { //Get the selection for the cmbCostCenter combo/error is thrown if there is none DataRow row = cmbCostCenter.GetComboSelection(); CostCenterFilter costCenterFilter = new CostCenterFilter(SessionManager.GetSessionValueNoRedirect(this, SessionStrings.CONNECTION_MANAGER)); costCenterFilter.IdCountry = (int)row["IdCountry"]; costCenterFilter.IdInergyLocation = (int)row["IdInergyLocation"]; costCenterFilter.IdFunction = (int)row["IdFunction"]; costCenterFilter.IdCostCenter = (int)row["Id"]; costCenterFilter.NameCostCenter = row["Name"].ToString(); return(costCenterFilter); }
private void LoadCostCentersFiltered(int countryId, int inergyLocationId, int functionId) { CostCenterFilter costCenterFilter = new CostCenterFilter(SessionManager.GetSessionValueNoRedirect(this, SessionStrings.CONNECTION_MANAGER)); costCenterFilter.IdCountry = countryId; costCenterFilter.IdInergyLocation = inergyLocationId; costCenterFilter.IdFunction = functionId; DataSet costCenterDS = costCenterFilter.SelectProcedure("SelectCostCenter"); cmbCostCenter.DataSource = costCenterDS; cmbCostCenter.DataMember = costCenterDS.Tables[0].ToString(); cmbCostCenter.DataValueField = "Id"; cmbCostCenter.DataTextField = "Code"; cmbCostCenter.DataBind(); }
protected void btnOk_Click(object sender, EventArgs e) { try { //gather information about the selected item CostCenterFilter costCenterFilter = GetCostCenterInfo(); //Close the window //HACK : to be put in a method if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "ButtonClickScript")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ButtonClickScript", "window.returnValue = 1; window.close();", true); } SessionManager.SetSessionValue(this, SessionStrings.CURRENT_COSTCENTER, costCenterFilter); SessionManager.SetSessionValue(this, SessionStrings.ADD_CC_TO_TARGET, lstAddCCtoWPs.SelectedValue); //Since the pop-up will close anyway, we do not need to transport to the client all the page viewstate since it will not be used anyway //In addition, the items of the comboboxes do not need to be rendered on the client. this.EnableViewState = false; cmbCostCenter.Items.Clear(); cmbCountry.Items.Clear(); cmbFunction.Items.Clear(); cmbInergyLocation.Items.Clear(); } catch (IndException ex) { ShowError(ex); return; } catch (Exception ex) { ShowError(new IndException(ex)); return; } }