/// <summary> /// UpdateForDashboard /// </summary> /// <param name="companyId">companyId</param> public void UpdateForDashboard(int companyId) { foreach (DashboardTDS.DashboardInProgressServiceRequestsRow row in (DashboardTDS.DashboardInProgressServiceRequestsDataTable)Table) { // Get ruleId for the each service ServiceInformationBasicInformationGateway serviceInformationBasicInformationGateway = new ServiceInformationBasicInformationGateway(); serviceInformationBasicInformationGateway.LoadByServiceId(row.ServiceID, companyId); int? ruleId = serviceInformationBasicInformationGateway.GetRuleId(row.ServiceID); if (ruleId.HasValue) { RuleGateway ruleGateway = new RuleGateway(); ruleGateway.LoadAllByRuleId((int)ruleId, companyId); if (ruleGateway.Table.Rows.Count > 0) { // Get ruleName for each service if exists string ruleName = ruleGateway.GetName((int)ruleId); row.InProgressServicesCompleteName = row.InProgressServicesCompleteName + " - " + ruleName; } } } }
private void LoadData(int ruleId) { RuleGateway ruleGateway = new RuleGateway(ruleTDS); if (ruleGateway.Table.Rows.Count > 0) { tbxName.Text = ruleGateway.GetName(ruleId); cbxMtoDot.Checked = ruleGateway.GetMto(ruleId); tbxDescription.Text = ruleGateway.GetDescription(ruleId); tbxFrecuency.Text = ruleGateway.GetFrequency(ruleId); tbxServicesRequestDaysBefore.Text = ""; if (ruleGateway.GetServiceRequestDays(ruleId).HasValue) tbxServicesRequestDaysBefore.Text = ((int)(ruleGateway.GetServiceRequestDays(ruleId))).ToString(); // Load Trees GetNodeForCategory(tvCategoriesRoot.Nodes, 0); GetNodeForCompanyLevels(tvCompanyLevelsRoot.Nodes, 0); // Load Units int companyId = Int32.Parse(hdfCompanyId.Value); string category = ""; UnitsList unitsList = new UnitsList(new DataSet()); foreach (int categoryId in arrayCategoriesSelected) { CategoryGateway categoryGateway = new CategoryGateway(); //Verify the location of the unit foreach (int companyLevelId in arrayCompanyLevelsSelected) { // Load the unit if corresponds categoryGateway.LoadByCategoryId(categoryId, Int32.Parse(hdfCompanyId.Value)); category = categoryGateway.GetName(categoryId); unitsList.LoadAndAddItemByCategoryCompanyLevelId(category, companyLevelId, companyId); } } if (unitsList.Table != null) { cbxlUnitsSelected.DataSource = RemoveDuplicateRows(unitsList.Table, "UnitID"); cbxlUnitsSelected.DataValueField = "UnitID"; cbxlUnitsSelected.DataTextField = "UnitCode"; cbxlUnitsSelected.DataBind(); // Total units lblTotalUnits.Text = "Total Units: " + cbxlUnitsSelected.Items.Count; } else { // Total units lblTotalUnits.Text = "Total Units: 0"; } } }