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 Actions GetIssueActions(long issueID) { //Get issue actions Issue issue = null; CRMServiceClient client = new CRMServiceClient(); try { issue = client.GetIssue(issueID); if (issue == null) { issue = new Issue(); } if (issue.Actions == null) { issue.Actions = new Actions(); } for (int i = 0; i < issue.Actions.Count; i++) { issue.Actions[i].Comment = issue.Actions[i].Comment.Replace("\n", "<br />"); } client.Close(); } 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(issue.Actions); }
public TrackingDataset TrackCartonsForStoreDetail(string clientID, string storeNumber, DateTime from, DateTime to, string tl, string by) { //Get carton details TrackingDataset cartons = new TrackingDataset(); CRMServiceClient client = null; try { client = new CRMServiceClient(); DataSet ds = null; if (by.ToLower() == "delivery") { ds = client.TrackCartonsForStoreByDeliveryDate(clientID, storeNumber, from, to, null); } else { ds = client.TrackCartonsForStoreByPickupDate(clientID, storeNumber, from, to, null); } client.Close(); //Snag the carton detail TrackingDataset detail = new TrackingDataset(); if (ds.Tables["CartonDetailForStoreTable"] != null && ds.Tables["CartonDetailForStoreTable"].Rows.Count > 0) { detail.Merge(ds, true, MissingSchemaAction.Ignore); } //Get all cartons for the specified tl cartons.Merge(detail.CartonDetailForStoreTable.Select("TL='" + tl + "'")); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <TrackingFault> tfe) { client.Abort(); throw new ApplicationException(tfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(cartons); }
public TerminalDataset GetTerminals(string agentNumber) { //Returns a list of terminals TerminalDataset terminals = new TerminalDataset(); CRMServiceClient client = new CRMServiceClient(); try { TerminalDataset ts = new TerminalDataset(); DataSet ds = client.GetTerminals(); client.Close(); if (ds.Tables["TerminalTable"] != null && ds.Tables["TerminalTable"].Rows.Count > 0) { ts.Merge(ds); } if (agentNumber == null) { terminals.TerminalTable.AddTerminalTableRow(0, "", "All", ""); terminals.Merge(ts); } else { terminals.Merge(ts.TerminalTable.Select("AgentID='" + agentNumber + "'")); } } 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(terminals); }
public static EnterpriseDataset TrackCartonsForStoreByPickupDate(string clientID, string store, DateTime fromDate, DateTime toDate, string vendorID) { // EnterpriseDataset cartons = new EnterpriseDataset(); CRMServiceClient client = new CRMServiceClient(); try { DataSet ds = null; if (store.Trim().Length > 0) { ds = client.TrackCartonsForStoreByPickupDate(clientID, store, fromDate, toDate, vendorID); } client.Close(); if (ds != null && ds.Tables["CartonDetailForStoreTable"] != null && ds.Tables["CartonDetailForStoreTable"].Rows.Count > 0) { cartons.Merge(ds, true, MissingSchemaAction.Ignore); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <TrackingFault> tfe) { client.Abort(); throw new ApplicationException(tfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(cartons); }
public Attachments GetAttachments(long issueID, long actionID) { //Get issue actions Attachments attachments = null; CRMServiceClient client = new CRMServiceClient(); try { Issue issue = client.GetIssue(issueID); if (issue == null) { issue = new Issue(); } if (issue.Actions == null) { issue.Actions = new Actions(); } for (int i = 0; i < issue.Actions.Count; i++) { if (issue.Actions[i].ID == actionID) { attachments = issue.Actions[i].Attachments; break; } } client.Close(); } 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(attachments); }
public void WriteLogEntry(TraceMessage m) { //Write an entry into the Argix log CRMServiceClient client = new CRMServiceClient(); try { client.WriteLogEntry(m); client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <ConfigurationFault> 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); } }
public byte[] GetAttachment(int attachmentID) { //Get an attachment byte[] attachment = null; CRMServiceClient client = new CRMServiceClient(); try { attachment = client.GetAttachment(attachmentID); client.Close(); } 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(attachment); }
public Issue GetIssue(long issueID) { //Get issue Issue issue = null; CRMServiceClient client = new CRMServiceClient(); try { issue = client.GetIssue(issueID); client.Close(); } 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(issue); }
public long CreateIssue(Issue issue) { //Create a new issue long issueID = 0; CRMServiceClient client = new CRMServiceClient(); try { issueID = client.CreateIssue(issue); client.Close(); } 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(issueID); }
public bool AddAttachment(Attachment attachment) { //Add a new attachment to an existing action bool added = false; CRMServiceClient client = new CRMServiceClient(); try { added = client.AddAttachment(attachment); client.Close(); } 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(added); }
public static void WriteLogEntry(TraceMessage m) { //Get the operating enterprise terminal CRMServiceClient client = null; try { client = new CRMServiceClient(); client.WriteLogEntry(m); client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <ConfigurationFault> 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); } }
public static TrackingItems TrackCartonsByLabelNumber(string[] itemNumbers) { // TrackingItems items = null; CRMServiceClient client = new CRMServiceClient(); try { items = client.TrackCartonsByLabelNumber(itemNumbers, null, null); client.Close(); } 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(items); }
public ServiceInfo GetServiceInfo() { //Get the operating enterprise terminal ServiceInfo info = null; CRMServiceClient client = new CRMServiceClient(); try { info = client.GetServiceInfo(); client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <ConfigurationFault> 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(info); }
public UserConfiguration GetUserConfiguration(string application, string[] usernames) { //Get the application configuration for the specified user UserConfiguration config = null; CRMServiceClient client = new CRMServiceClient(); try { config = client.GetUserConfiguration(application, usernames); client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <ConfigurationFault> 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(config); }
public bool AddAction(Action action) { //Add a new action to an existing issue bool added = false; CRMServiceClient client = null; try { client = new CRMServiceClient(); added = client.AddAction(action); client.Close(); } 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(added); }
public static byte[] GetAttachment(int id) { //Get attachments for the specified issue byte[] attachment = null; CRMServiceClient client = null; try { client = new CRMServiceClient(); attachment = client.GetAttachment(id); client.Close(); } 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(attachment); }
public static long CreateIssue(Issue issue) { // long id = 0; CRMServiceClient client = null; try { client = new CRMServiceClient(); id = client.CreateIssue(issue); client.Close(); } 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(id); }
public DataSet GetStoreDetail(int companyID, string subStore) { //Get a list of store locations DataSet stores = new DataSet(); CRMServiceClient client = new CRMServiceClient(); try { 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 static bool AddAction(Action action) { //Add an action to an existing issue bool res = false; CRMServiceClient client = null; try { //Call service client = new CRMServiceClient(); res = client.AddAction(action); client.Close(); } 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(res); }
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 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 ActionTypeDataset GetActionTypes(long issueID) { //Action types for an issue (state driven) ActionTypeDataset actionTypes = new ActionTypeDataset(); CRMServiceClient client = new CRMServiceClient(); try { 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 fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(actionTypes); }
public IssueTypeDataset GetIssueTypes(string issueCategory) { //Issue types for a category, or category="" for all types IssueTypeDataset issueTypes = new IssueTypeDataset(); CRMServiceClient client = new CRMServiceClient(); try { DataSet ds = client.GetIssueTypes(issueCategory); client.Close(); if (ds.Tables["IssueTypeTable"] != null && ds.Tables["IssueTypeTable"].Rows.Count > 0) { issueTypes.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(issueTypes); }
public CompanyDataset GetCompanies() { //Returns a list of terminals CompanyDataset companies = new CompanyDataset(); CRMServiceClient client = new CRMServiceClient(); try { DataSet ds = client.GetCompanies(); client.Close(); if (ds.Tables["CompanyTable"] != null && ds.Tables["CompanyTable"].Rows.Count > 0) { companies.Merge(ds.Tables["CompanyTable"].Select("", "CompanyName ASC")); } } 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(companies); }
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 EnterpriseDataset GetClients(string vendorID) { // EnterpriseDataset clients = new EnterpriseDataset(); CRMServiceClient client = new CRMServiceClient(); try { DataSet ds = client.GetClients(vendorID); client.Close(); if (ds.Tables["ClientTable"] != null && ds.Tables["ClientTable"].Rows.Count > 0) { clients.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(clients); }
public AgentDataSet GetAgents() { //Get agents AgentDataSet agents = new AgentDataSet(); CRMServiceClient client = new CRMServiceClient(); try { DataSet ds = client.GetAgents(); client.Close(); if (ds.Tables["AgentTable"] != null && ds.Tables["AgentTable"].Rows.Count > 0) { agents.Merge(ds.Tables["AgentTable"].Select("", "AgentName ASC")); } } 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(agents); }
public TerminalDataSet GetTerminals() { //Returns a list of terminals TerminalDataSet terminals = new TerminalDataSet(); CRMServiceClient client = null; try { client = new CRMServiceClient(); DataSet ds = client.GetTerminals(); client.Close(); if (ds.Tables["TerminalTable"] != null && ds.Tables["TerminalTable"].Rows.Count > 0) { terminals.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(terminals); }
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); }