public static CRMDataset GetAgents() { //Get a list of all agents CRMDataset agents = null; CRMServiceClient client = null; try { ObjectCache cache = MemoryCache.Default; agents = cache["agents"] as CRMDataset; if (agents == null) { agents = new CRMDataset(); client = new CRMServiceClient(); DataSet ds = client.GetAgents(); client.Close(); if (ds.Tables["AgentTable"] != null && ds.Tables["AgentTable"].Rows.Count > 0) { agents.Merge(ds); } DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440)); cache.Set("agents", agents, policy); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <EnterpriseFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(agents); }
public static CRMDataset GetIssues() { //Get issues CRMDataset issues = new CRMDataset(); CRMServiceClient client = null; try { if (_Cache == null) { _Cache = new IssueCache(DateTime.Today.AddDays(-App.Config.IssueDaysBack)); } client = new CRMServiceClient(); DataSet ds = client.GetIssuesForDate(_Cache.LastUpdated); client.Close(); System.Diagnostics.Debug.WriteLine("PAYLOAD: fromDate=" + _Cache.LastUpdated.ToString("MM/dd/yyyy HH:mm:ss") + "; bytes=" + ds.GetXml().Length); CRMDataset _issues = new CRMDataset(); if (ds.Tables["IssueTable"] != null && ds.Tables["IssueTable"].Rows.Count > 0) { _issues.Merge(ds); _Cache.UpdateCache(_issues); issues.Merge(_Cache.Issues); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <CustomersFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(issues); }
public static CRMDataset GetIssueTypes(string issueCategory) { //Issue types- all or filtered by category CRMDataset issueTypes = null; CRMServiceClient client = null; try { ObjectCache cache = MemoryCache.Default; issueTypes = cache["issueTypes" + issueCategory] as CRMDataset; if (issueTypes == null) { issueTypes = new CRMDataset(); client = new CRMServiceClient(); DataSet ds = client.GetIssueTypes(issueCategory); client.Close(); if (ds.Tables["IssueTypeTable"] != null && ds.Tables["IssueTypeTable"].Rows.Count > 0) { issueTypes.Merge(ds); } DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440)); cache.Set("issueTypes" + issueCategory, issueTypes, policy); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException fe) { throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(issueTypes); }
public static CRMDataset GetCompanies() { //Companies; cache companies CRMDataset companies = null; CRMServiceClient client = null; try { ObjectCache cache = MemoryCache.Default; companies = cache["companies"] as CRMDataset; if (companies == null) { companies = new CRMDataset(); client = new CRMServiceClient(); DataSet ds = client.GetCompanies(); client.Close(); if (ds.Tables["CompanyTable"] != null && ds.Tables["CompanyTable"].Rows.Count > 0) { CRMDataset _ds = new CRMDataset(); _ds.CompanyTable.AddCompanyTableRow(0, "All", "000", "", 1); _ds.Merge(ds.Tables["CompanyTable"].Select("IsActive = 1", "CompanyName ASC")); companies.Merge(_ds); } DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440)); cache.Set("companies", companies, policy); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <EnterpriseFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(companies); }
public Issue GetIssue(long issueID) { //Get an existing issue Issue issue = null; try { //Load the issue CRMDataset issuesDS = new CRMDataset(); issuesDS.Merge(new CRMGateway().GetIssue(issueID)); if (issuesDS.IssueTable.Rows.Count > 0) { issue = new Issue(issuesDS.IssueTable[0]); //Get the actions and attachments for this issue CRMDataset actionDS = new CRMDataset(); actionDS.Merge(new CRMGateway().GetActions(issueID)); CRMDataset attachmentDS = new CRMDataset(); attachmentDS.Merge(new CRMGateway().GetAttachments(issueID)); //Attach actions to the issue and attachents to the actions Actions actions = new Actions(); if (actionDS != null) { for (int i = 0; i < actionDS.ActionTable.Rows.Count; i++) { //Load an action and add to actions collection Action action = new Action(actionDS.ActionTable[i]); actions.Add(action); //Attach attachments to this action if applicable if (action.AttachmentCount > 0 && attachmentDS != null) { Attachments attachments = new Attachments(); for (int j = 0; j < attachmentDS.AttachmentTable.Rows.Count; j++) { Attachment attachment = new Attachment(attachmentDS.AttachmentTable[j]); if (attachment.ActionID == action.ID) { attachments.Add(attachment); } } action.Attachments = attachments; } else { action.Attachments = new Attachments(); } } } issue.Actions = actions; } } catch (Exception ex) { throw new FaultException <CustomersFault>(new CustomersFault(ex.Message), "Service Error"); } return(issue); }
private void OnScopeChanged(object sender, EventArgs e) { //Event handler for change in scope try { //Prepare a location selector for the specified scope string scope = this.cboScope.SelectedItem != null?this.cboScope.SelectedItem.ToString() : SCOPE_NONE; this.cboLocation.Visible = (scope == SCOPE_NONE || scope == SCOPE_DISTRICTS || scope == SCOPE_REGIONS || scope == SCOPE_AGENTS); this.txtStore.Visible = (scope == SCOPE_STORES || scope == SCOPE_SUBSTORES); this.cboLocation.DataSource = null; CRMDataset locationDS = new CRMDataset(); CRMDataset ds = null; int companyID = int.Parse(this.cboCompany.SelectedValue.ToString()); string number = this.cboCompany.SelectedValue.ToString().PadLeft(8, '0').Substring(5, 3); switch (scope) { case SCOPE_DISTRICTS: ds = CRMGateway.GetDistricts(number); this.cboLocation.DisplayMember = "LocationTable.LocationName"; this.cboLocation.ValueMember = "LocationTable.Location"; break; case SCOPE_REGIONS: ds = CRMGateway.GetRegions(number); this.cboLocation.DisplayMember = "LocationTable.LocationName"; this.cboLocation.ValueMember = "LocationTable.Location"; break; case SCOPE_STORES: case SCOPE_SUBSTORES: this.txtStore.Text = ""; break; case SCOPE_AGENTS: ds = CRMGateway.GetAgents(number); this.cboLocation.DisplayMember = "AgentTable.AgentSummary"; this.cboLocation.ValueMember = "AgentTable.AgentNumber"; break; } if (ds != null) { locationDS.Merge(ds); this.cboLocation.DataSource = locationDS; } this.cboLocation.Enabled = this.cboLocation.Items.Count > 0; if (this.cboLocation.Items.Count > 0) { this.cboLocation.SelectedIndex = 0; } OnCompanyLocationChanged(null, EventArgs.Empty); } catch (Exception ex) { App.ReportError(new ApplicationException("Unexpected error when location scope changed.", ex)); } }
private void showStoreDetail() { // this.txtStoreDetail.Clear(); if (this.cboCompany.SelectedValue != null && this.txtStore.Text.Length > 0) { CRMDataset ds = new CRMDataset(); switch (this.cboScope.SelectedItem.ToString()) { case SCOPE_STORES: ds.Merge(CRMGateway.GetStoreDetail(int.Parse(this.cboCompany.SelectedValue.ToString()), int.Parse(this.txtStore.Text))); break; case SCOPE_SUBSTORES: ds.Merge(CRMGateway.GetStoreDetail(int.Parse(this.cboCompany.SelectedValue.ToString()), this.txtStore.Text)); break; } if (ds.StoreTable.Rows.Count > 0) { this.txtStoreDetail.Text = getStoreDetailString(ds.StoreTable[0]); } } }
public static CRMDataset GetAgents(string clientNumber) { //Get a list of agents for the specified client CRMDataset agents = null; CRMServiceClient client = null; try { ObjectCache cache = MemoryCache.Default; agents = cache["agents" + clientNumber] as CRMDataset; if (agents == null) { agents = new CRMDataset(); agents.AgentTable.AddAgentTableRow("All", "", "All", "", "", "", "", "", 0, "", "", "", "", "", "", "", "", "", "All"); if (clientNumber.Length > 3) { clientNumber = clientNumber.Substring(clientNumber.Length - 3, 3); } if (clientNumber == "000") { clientNumber = null; } client = new CRMServiceClient(); DataSet ds = client.GetAgentsByClient(clientNumber); client.Close(); if (ds.Tables["AgentTable"] != null && ds.Tables["AgentTable"].Rows.Count > 0) { CRMDataset _ds = new CRMDataset(); _ds.Merge(ds); for (int i = 0; i < _ds.AgentTable.Rows.Count; i++) { _ds.AgentTable.Rows[i]["AgentSummary"] = (!_ds.AgentTable.Rows[i].IsNull("MainZone") ? _ds.AgentTable.Rows[i]["MainZone"].ToString().PadLeft(2, ' ') : " ") + " - " + (!_ds.AgentTable.Rows[i].IsNull("AgentNumber") ? _ds.AgentTable.Rows[i]["AgentNumber"].ToString() : " ") + " - " + (!_ds.AgentTable.Rows[i].IsNull("AgentName") ? _ds.AgentTable.Rows[i]["AgentName"].ToString().Trim() : ""); } agents.Merge(_ds.AgentTable.Select("", "MainZone ASC")); agents.AgentTable.AcceptChanges(); } DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440)); cache.Set("agents" + clientNumber, agents, policy); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <EnterpriseFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(agents); }
private void OnStoreKeyUp(object sender, KeyEventArgs e) { //Event handler for store textbox key up event try { if (e.KeyCode == Keys.Enter) { this.txtStoreName.Text = this.txtStoreAddress.Text = this.txtStoreDetail.Text = ""; if (this.cboClient.SelectedValue != null && this.mskStore.Text.Trim().Length > 0) { CRMDataset ds = new CRMDataset(); ds.Merge(CRMGateway.GetStoreDetail(int.Parse(this.cboClient.SelectedValue.ToString()), int.Parse(this.mskStore.Text))); if (ds.StoreTable.Rows.Count > 0) { CRMDataset.StoreTableRow store = ds.StoreTable[0]; this.txtStoreName.Text = store.StoreName.Trim() + " (store #" + store.StoreNumber.ToString() + "; substore #" + store.SubStoreNumber.Trim() + ")"; StringBuilder address = new StringBuilder(); address.AppendLine((!store.IsStoreAddressline1Null() ? store.StoreAddressline1.Trim() : "")); address.AppendLine((!store.IsStoreAddressline2Null() ? store.StoreAddressline2.Trim() : "")); address.AppendLine((!store.IsStoreCityNull() ? store.StoreCity.Trim() : "") + ", " + (!store.IsStoreStateNull() ? store.StoreState.Trim() : "") + " " + (!store.IsStoreZipNull() ? store.StoreZip.Trim() : "")); this.txtStoreAddress.Text = address.ToString(); StringBuilder detail = new StringBuilder(); detail.AppendLine((!store.IsRegionDescriptionNull() ? store.RegionDescription.Trim() : "") + " (" + (!store.IsRegionNull() ? store.Region.Trim() : "") + "), " + (!store.IsDistrictNameNull() ? store.DistrictName.Trim() : "") + " (" + (!store.IsDistrictNull() ? store.District.Trim() : "") + ")"); detail.AppendLine("Zone " + (!store.IsZoneNull() ? store.Zone.Trim() : "") + ", " + "Agent " + (!store.IsAgentNumberNull() ? store.AgentNumber.Trim() : "") + " " + (!store.IsAgentNameNull() ? store.AgentName.Trim() : "")); detail.AppendLine("Window " + (!store.IsWindowTimeStartNull() ? store.WindowTimeStart.ToString("HH:mm") : "") + " - " + (!store.IsWindowTimeEndNull() ? store.WindowTimeEnd.ToString("HH:mm") : "") + ", " + "Del Days " + getDeliveryDays(store) + ", " + (!store.IsScanStatusDescrptionNull() ? store.ScanStatusDescrption.Trim() : "")); detail.AppendLine("JA Transit " + (!store.IsStandardTransitNull() ? store.StandardTransit.ToString() : "") + ", " + "OFD " + getOFD(store)); detail.AppendLine("Special Inst: " + (!store.IsSpecialInstructionsNull() ? store.SpecialInstructions.Trim() : "")); this.txtStoreDetail.Text = detail.ToString(); } } refreshReports(); } } catch (Exception ex) { App.ReportError(new ApplicationException("Unexpected error when store keyed in.", ex)); } }
public static CRMDataset GetDeliveries(int companyID, int storeNumber, DateTime from, DateTime to) { //Get a list of store locations CRMDataset deliveries = new CRMDataset(); CRMServiceClient client = null; try { client = new CRMServiceClient(); DataSet ds = client.GetDeliveries(companyID, storeNumber, from, to); client.Close(); deliveries.Merge(ds); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <EnterpriseFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(deliveries); }
public static CRMDataset GetAgentTerminalDetail(string agentNumber) { //Get details of an agent terminal CRMDataset agent = new CRMDataset(); CRMServiceClient client = null; try { client = new CRMServiceClient(); CRMDataset agents = GetAgentTerminals(agentNumber); client.Close(); agent.Merge(agents.AgentTable.Select("AgentNumber = '" + agentNumber + "'", "")); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <EnterpriseFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(agent); }
public static CRMDataset GetStoreDetail(int companyID, string subStore) { //Get a list of store locations CRMDataset stores = new CRMDataset(); CRMServiceClient client = null; try { client = new CRMServiceClient(); DataSet ds = client.GetSubStoreDetail(companyID, subStore); client.Close(); stores.Merge(ds); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <EnterpriseFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(stores); }
public CRMDataset SearchIssues(string agentNumber, string searchText) { //Get issue search data CRMDataset issues = new CRMDataset(); CRMServiceClient client = new CRMServiceClient(); try { DataSet ds = client.SearchIssues(searchText); client.Close(); if (ds != null && ds.Tables["IssueTable"] != null && ds.Tables["IssueTable"].Rows.Count > 0) { issues.Merge(ds); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(issues); }
public static CRMDataset SearchIssuesAdvanced(object[] criteria) { //Get issues CRMDataset issues = new CRMDataset(); CRMServiceClient client = null; try { client = new CRMServiceClient(); DataSet ds = client.SearchIssuesAdvanced(criteria); client.Close(); if (ds.Tables["IssueTable"] != null && ds.Tables["IssueTable"].Rows.Count > 0) { issues.Merge(ds); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <CustomersFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(issues); }
public static CRMDataset GetActionTypes(long issueID) { //Action types for an issue (state driven) CRMDataset actionTypes = new CRMDataset(); CRMServiceClient client = null; try { client = new CRMServiceClient(); DataSet ds = client.GetActionTypes(issueID); client.Close(); if (ds.Tables["ActionTypeTable"] != null && ds.Tables["ActionTypeTable"].Rows.Count > 0) { actionTypes.Merge(ds); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <CustomersFault> cfe) { throw new ApplicationException(cfe.Detail.Message); } catch (FaultException fe) { throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(actionTypes); }
private void OnAgentTerminalChanged(object sender, EventArgs e) { //Event handler for change in agent terminal try { this.txtTerminalName.Text = this.txtTerminalAddress.Text = this.txtTermainlDetail.Text = ""; if (this.cboTerminal.SelectedValue != null) { CRMDataset ds = new CRMDataset(); ds.Merge(CRMGateway.GetAgentTerminalDetail(this.cboTerminal.SelectedValue.ToString())); if (ds.AgentTable.Rows.Count > 0) { CRMDataset.AgentTableRow agent = ds.AgentTable[0]; this.txtTerminalName.Text = agent.AgentNumber.ToString() + " - " + agent.AgentName.Trim(); StringBuilder address = new StringBuilder(); address.AppendLine((!agent.IsAddressLine1Null() ? agent.AddressLine1.Trim() : "")); address.AppendLine((!agent.IsAddressLine2Null() ? agent.AddressLine2.Trim() : "")); address.AppendLine((!agent.IsCityNull() ? agent.City.Trim() : "") + ", " + (!agent.IsStateNull() ? agent.State.Trim() : "") + " " + (!agent.IsZipNull() ? agent.Zip.Trim() : "")); this.txtTerminalAddress.Text = address.ToString(); StringBuilder detail = new StringBuilder(); detail.AppendLine("Contact: " + (!agent.IsContactNull() ? agent.Contact.Trim() : "")); detail.AppendLine("Phone: " + (!agent.IsPhoneNull() ? agent.Phone.Trim() : "")); detail.AppendLine("Coordinator: " + (!agent.IsCoordinatorNull() ? agent.Coordinator.Trim() : "")); detail.AppendLine("Agent Type: " + (!agent.IsTypeNull() ? agent.Type.Trim() : "")); detail.AppendLine( ("Main Zone: " + (!agent.IsMainZoneNull() ? agent.MainZone.Trim() : "")) + ", " + ("Type= " + (!agent.IsZoneTypeNull() ? agent.ZoneType.Trim() : "")) + ", " + ("Status= " + (!agent.IsZoneStatusNull() ? agent.ZoneStatus.Trim() : "")) + ", " + ("Is Main= " + (!agent.IsIsMainZoneNull() ? agent.IsMainZone.ToString() : "")) ); this.txtTermainlDetail.Text = detail.ToString(); } refreshReports(); } } catch (Exception ex) { App.ReportError(new ApplicationException("Unexpected error on agent selection.", ex)); } }
public CRMDataset ViewIssues(string agentNumber) { //Get issue search data CRMDataset issues = new CRMDataset(); CRMServiceClient client = new CRMServiceClient(); try { DataSet ds = client.ViewIssuesForAgent(agentNumber); client.Close(); if (ds != null) { //CRMDataset _issues = new CRMDataset(); //_issues.Merge(ds); //issues.Merge(_issues.IssueTable.Select("LastActionDescription <> 'closed'","LastActionCreated DESC")); issues.Merge(ds); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(issues); }
public DataSet SearchIssuesAdvanced(string agentNumber, object[] criteria) { //Get issue search data DataSet issues = new DataSet(); try { DataSet ds = SearchIssuesAdvanced(criteria); if (ds != null) { CRMDataset _issues = new CRMDataset(); _issues.Merge(ds); if (agentNumber == null) { issues.Merge(_issues.IssueTable.Select("", "LastActionCreated DESC")); } else { issues.Merge(_issues.IssueTable.Select("AgentNumber='" + agentNumber + "'", "LastActionCreated DESC")); } } } catch (Exception ex) { throw new FaultException <CustomersFault>(new CustomersFault(ex.Message), "Service Error"); } return(issues); }
public static CRMDataset GetAgentTerminals(string agentNumber) { //Get a list of agent terminals for the specified agent CRMDataset terminals = null; CRMServiceClient client = null; try { ObjectCache cache = MemoryCache.Default; CRMDataset allTerminals = cache["agentterminals"] as CRMDataset; if (allTerminals == null) { allTerminals = new CRMDataset(); client = new CRMServiceClient(); DataSet ds = client.GetAgentTerminals(null); client.Close(); if (ds.Tables["AgentTable"] != null && ds.Tables["AgentTable"].Rows.Count > 0) { allTerminals.Merge(ds); } DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440)); cache.Set("agentterminals", allTerminals, policy); } terminals = new CRMDataset(); if (allTerminals.AgentTable.Rows.Count > 0) { terminals.Merge(allTerminals.AgentTable.Select("AgentNumber = '" + agentNumber + "' OR AgentParentNumber = '" + agentNumber + "'", "AgentName ASC")); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <EnterpriseFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(terminals); }
public DataSet ViewIssues(string agentNumber) { //View issues for the specified agent DataSet issues = new DataSet(); try { DataSet ds = ViewIssues(); if (ds != null) { CRMDataset _issues = new CRMDataset(); _issues.Merge(ds); if (agentNumber == null) { issues.Merge(_issues.IssueTable.Select("", "LastActionCreated DESC")); } else { issues.Merge(_issues.IssueTable.Select("AgentNumber='" + agentNumber + "'", "LastActionCreated DESC")); } } } catch (Exception ex) { throw new FaultException <CustomersFault>(new CustomersFault(ex.Message), "Service Error"); } return(issues); }
public DataSet GetActionTypes(long issueID) { //Action types for an issue (state driven) DataSet types = new DataSet(); try { //Get full list CRMDataset actionTypes = new CRMDataset(); actionTypes.Merge(new CRMGateway().GetActionTypes()); //Remove actions that don't apply Actions actions = new Actions(); CRMDataset actionsDS = new CRMDataset(); actionsDS.Merge(new CRMGateway().GetActions(issueID)); for (int i = 0; i < actionsDS.ActionTable.Rows.Count; i++) { actions.Add(new Action(actionsDS.ActionTable[i])); } if (actions.Count == 0) { //New: Notify All, Notify Agent Systems, Notify CRG for (int i = 0; i < actionTypes.ActionTypeTable.Rows.Count; i++) { if (actionTypes.ActionTypeTable[i].ID == 1) { actionTypes.ActionTypeTable[i].Delete(); } else if (actionTypes.ActionTypeTable[i].ID == 2) { actionTypes.ActionTypeTable[i].Delete(); } else if (actionTypes.ActionTypeTable[i].ID == 3) { actionTypes.ActionTypeTable[i].Delete(); } } } else if (actions.Count == 1) { //Open: Dismiss, Notify All, Notify Agent Systems, Notify CRG for (int i = 0; i < actionTypes.ActionTypeTable.Rows.Count; i++) { if (actionTypes.ActionTypeTable[i].ID == 1) { actionTypes.ActionTypeTable[i].Delete(); } else if (actionTypes.ActionTypeTable[i].ID == 3) { actionTypes.ActionTypeTable[i].Delete(); } } } else if (actions.Count > 1) { //Unresolved: Close, Notify All, Notify Agent Systems, Notify CRG, Other for (int i = 0; i < actionTypes.ActionTypeTable.Rows.Count; i++) { if (actionTypes.ActionTypeTable[i].ID == 1) { actionTypes.ActionTypeTable[i].Delete(); } else if (actionTypes.ActionTypeTable[i].ID == 2) { actionTypes.ActionTypeTable[i].Delete(); } } } actionTypes.AcceptChanges(); types.Merge(actionTypes); } catch (Exception ex) { throw new ApplicationException(ex.Message, ex); } return(types); }