public void OrganizationChartManager_GetByOrgCodeAndChartType() { const int testOrgCodeID = 15; int newOrgChartID = -1; int primaryUserID = 1; enumOrgChartType selectedChartType = enumOrgChartType.SingleOrg; try { OC.OrganizationChart chart = OC.OrganizationChartManager.Instance.GetByOrgCodeAndChartType(testOrgCodeID, selectedChartType); if (chart.OrganizationChartID == -1) { newOrgChartID = CreateOrgChartNew("OrganizationChartManager_GetByOrgCodeAndChartType", testOrgCodeID, selectedChartType, primaryUserID); } else { newOrgChartID = chart.OrganizationChartID; } chart = OC.OrganizationChartManager.Instance.GetByID(newOrgChartID); Assert.IsNotNull(chart, "Organization Chart is null"); Assert.IsTrue(chart.OrganizationChartID == newOrgChartID, "Organization Chart not found"); } catch (Exception ex) { throw ex; } finally { DeleteChart(newOrgChartID); } }
public void OrganizationChartPositionManager_Add() { const int testOrgCodeID = 15; int newOrgChartID = -1; int primaryUserID = 1; enumOrgChartType selectedChartType = enumOrgChartType.SingleOrg; try { OC.OrganizationChart chart = OC.OrganizationChartManager.Instance.GetByOrgCodeAndChartType(testOrgCodeID, selectedChartType); if (chart.OrganizationChartID == -1) { newOrgChartID = CreateOrgChartNew("OrganizationChartPositionManager_Add", testOrgCodeID, selectedChartType, primaryUserID); } else { newOrgChartID = chart.OrganizationChartID; } chart = OC.OrganizationChartManager.Instance.GetByID(newOrgChartID); Assert.IsNotNull(chart, "Organization Chart is null"); Assert.IsTrue(chart.OrganizationChartID == newOrgChartID, "Organization Chart not found"); // now add position OrganizationChartPosition newPosition = new OrganizationChartPosition() { OrganizationChartID = newOrgChartID, OrganizationCodeID = testOrgCodeID, CreatedByID = primaryUserID, PositionTitle = "Generated Position Title" }; OrganizationChartPositionManager.Instance.Add(newPosition); // try to find position OrganizationChartPosition position = OrganizationChartPositionManager.Instance.GetByID(newOrgChartID, newPosition.WFPPositionID); Assert.IsTrue(position.WFPPositionID != -1, "Position Not Created"); WorkforcePlanningPositionManager.Instance.Delete(position.WFPPositionID, newOrgChartID, primaryUserID); } catch (Exception ex) { throw ex; } finally { DeleteChart(newOrgChartID); } }
private void dropDownOrganizationCodes_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { try { enumOrgChartType selectedChartType = (enumOrgChartType)int.Parse(this.dropDownChartTypes.SelectedValue); int orgCodeID = ControlUtility.GetDropdownValue(this.dropDownOrganizationCodes, "-1"); // reset panel view resetOrgChartPanels(); if (orgCodeID != -1) { // Three POSSIBLE STATES: // A. Existing In-Progress Chart // B. No In-Process Chart but has a Published Chart // C. No In-Process Chart/No Published Chart // State 1: Existing In-Progress Chart OrganizationChart chart = OrganizationChartManager.Instance.GetByOrgCodeAndChartType(orgCodeID, selectedChartType); if (chart.OrganizationChartID != -1) { // Chart is In-Process setChartView(this.panelInProcessChart, CreationType.None, false); } else { // No In-Process Chart -- now check published charts OrganizationChartLog chartLog = OrganizationChartLogManager.Instance.GetByOrgCodeAndChartType(orgCodeID, selectedChartType); if (chartLog.OrganizationChartLogID == -1) { // State 3: No In-Process Chart/No Published Chart setChartView(this.panelNoInProcessNoPublished, CreationType.New, true); // bind root positions by org code bindRootPositionsByOrgCode(orgCodeID); } else { // State 2: No In-Process Chart but has a Published Chart setChartView(this.panelPublishedChart, CreationType.NewFromTemplate, true); } } } } catch (Exception ex) { base.HandleException(ex); } }
private void toggleOrganizationCodeView(enumOrgChartType selectedChartType, OrgCodeFormatTypes listFormat) { // Get data based on chart type OrganizationCodeCollection listOrgCodes = base.CurrentUser.GetAvailableOrganizationCodesByChartType(selectedChartType, listFormat); if (listOrgCodes.Count == 0) { // display message if there is no organization codes printOrgCodeListMessage(GetLocalResourceObject("NoOrgCodesAvailableMessage").ToString()); } else { printOrgCodeListMessage(string.Empty); string displayTextField = (listFormat == OrgCodeFormatTypes.NewOrgCode) ? "NewOrgCodeLine" : "OldOrgCodeLine"; // show org codes if there is data ControlUtility.BindRadComboBoxControl(dropDownOrganizationCodes, listOrgCodes, null, displayTextField, "OrganizationCodeID", "<<--Select Organization -->>"); } }
public OrganizationCodeCollection GetAvailableOrganizationCodesByChartType(enumOrgChartType selectedChartType, OrgCodeFormatTypes selectedSortType) { OrganizationCodeCollection childDataCollection = null; if (base.ValidateKeyField(this._userID)) { try { DbCommand commandWrapper = GetDbCommand("spr_GetAvailableOrganizationCodesByChartType"); commandWrapper.Parameters.Add(new SqlParameter("@UserID", this._userID)); if (selectedChartType == enumOrgChartType.Undefined) { commandWrapper.Parameters.Add(new SqlParameter("@OrganizationChartTypeID", DBNull.Value)); } else { commandWrapper.Parameters.Add(new SqlParameter("@OrganizationChartTypeID", (int)selectedChartType)); } if (selectedSortType == OrgCodeFormatTypes.None) { commandWrapper.Parameters.Add(new SqlParameter("@OrgCodeFormatTypeID", DBNull.Value)); } else { commandWrapper.Parameters.Add(new SqlParameter("@OrgCodeFormatTypeID", (int)selectedSortType)); } // fill collection list childDataCollection = OrganizationCode.GetCollection(ExecuteDataTable(commandWrapper)); } catch (Exception ex) { HandleException(ex); } } return(childDataCollection); }
protected int CreateOrgChartNew(string title, int orgCodeID, enumOrgChartType chartType, int createdByUserID) { OC.OrganizationChart newChart = new OC.OrganizationChart() { OrgCode = new OrganizationCode() { OrganizationCodeID = orgCodeID }, OrganizationChartTypeID = chartType, CreatedBy = new ActionUser(createdByUserID), Header1 = title, Header2 = string.Format("Generated on {0}", DateTime.Now) }; int newOrgChartID = OC.OrganizationChartManager.Instance.CreateNew(newChart); Assert.IsTrue(newOrgChartID != -1, "Organization Chart not Created"); Console.WriteLine(string.Concat("New Org Chart: ", newOrgChartID)); return(newOrgChartID); }
private void toggleChartTypeView() { try { resetOrgChartPanels(); enumOrgChartType selectedChartType = (enumOrgChartType)int.Parse(this.dropDownChartTypes.SelectedValue); if (selectedChartType == enumOrgChartType.Undefined) { printOrgCodeListMessage(GetLocalResourceObject("NoChartTypeSelectedMessage").ToString()); } else { OrgCodeFormatTypes selectedOrgCodeFormat = (OrgCodeFormatTypes)int.Parse(radioListOrgCode.SelectedValue); toggleOrganizationCodeView(selectedChartType, selectedOrgCodeFormat); } } catch (Exception ex) { base.HandleException(ex); } }
public OrganizationChartLog GetOrganizationChartLogByOrgCodeAndChartType(enumOrgChartType organizationChartTypeID, int organizationCodeID) { return(base.GetOrganizationChartEntity(getObjectFromDataRow, "spr_GetLastPublishedOrganizationChartForOrganizationByOrgChartType", organizationCodeID, (int)organizationChartTypeID)); }
public OrganizationChart GetByOrgCodeAndChartType(int orgCodeID, enumOrgChartType chartType) { return(base.GetItem("spr_GetOrganizationChartByOrgCodeAndChartType", orgCodeID, (int)chartType)); }
public OrganizationChartLog GetByOrgCodeAndChartType(int organizationCodeID, enumOrgChartType organizationChartTypeID) { return(base.GetItem("spr_GetLastPublishedOrganizationChartForOrganizationByOrgChartType", organizationCodeID, (int)organizationChartTypeID)); }