Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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); }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
        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); }
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
        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);
        }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
        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);
        }
Exemplo n.º 20
0
        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);
        }
Exemplo n.º 21
0
        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);
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
        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);
        }
Exemplo n.º 24
0
        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);
        }
Exemplo n.º 25
0
        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);
        }
Exemplo n.º 26
0
        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);
        }
Exemplo n.º 27
0
        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);
        }
Exemplo n.º 28
0
        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);
        }
Exemplo n.º 29
0
        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);
        }
Exemplo n.º 30
0
        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);
        }