Exemple #1
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);
        }
Exemple #2
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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
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);
        }
Exemple #6
0
        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);
        }
Exemple #7
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);
        }
Exemple #8
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);
        }
Exemple #9
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);
        }
Exemple #10
0
        public static CRMDataset GetRegions(string clientNumber)
        {
            //Get a list of regional locations for the specified client; convert schema field names to generic Location, LocationName
            CRMDataset       regions = null;
            CRMServiceClient client  = null;

            try {
                ObjectCache cache = MemoryCache.Default;
                regions = cache["regions" + clientNumber] as CRMDataset;
                if (regions == null)
                {
                    regions = new CRMDataset();
                    regions.LocationTable.AddLocationTableRow("All", "All");
                    if (clientNumber.Length > 3)
                    {
                        clientNumber = clientNumber.Substring(clientNumber.Length - 3, 3);
                    }
                    if (clientNumber == "000")
                    {
                        clientNumber = null;
                    }

                    client = new CRMServiceClient();
                    DataSet ds = client.GetRegionsDistricts(clientNumber);
                    client.Close();

                    //Filter out duplicate regions since resultset is district-region (child-parent)
                    System.Collections.Hashtable table = new System.Collections.Hashtable();
                    if (ds.Tables["LocationTable"] != null)
                    {
                        for (int i = 0; i < ds.Tables["LocationTable"].Rows.Count; i++)
                        {
                            string location     = ds.Tables["LocationTable"].Rows[i]["Region"].ToString().Trim();
                            string locationName = ds.Tables["LocationTable"].Rows[i]["RegionName"].ToString().Trim();
                            if (!table.ContainsKey(location))
                            {
                                table.Add(location, locationName);
                                regions.LocationTable.AddLocationTableRow(location, locationName);
                            }
                        }
                    }
                    regions.AcceptChanges();

                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440));
                    cache.Set("regions" + clientNumber, regions, 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(regions);
        }
Exemple #11
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); }
        }
Exemple #12
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);
        }
Exemple #13
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); }
        }
Exemple #14
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);
        }
Exemple #15
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);
        }
Exemple #16
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);
        }
Exemple #17
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);
        }
Exemple #18
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);
        }
Exemple #19
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);
        }
Exemple #20
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);
        }
Exemple #21
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);
        }
Exemple #22
0
        public static CRMDataset GetDistricts(string clientNumber)
        {
            //Get a list of client districts; convert schema field names to generic Location, LocationName
            CRMDataset       districts = null;
            CRMServiceClient client    = null;

            try {
                ObjectCache cache = MemoryCache.Default;
                districts = cache["districts" + clientNumber] as CRMDataset;
                if (districts == null)
                {
                    districts = new CRMDataset();
                    districts.LocationTable.AddLocationTableRow("All", "All");
                    if (clientNumber.Length > 3)
                    {
                        clientNumber = clientNumber.Substring(clientNumber.Length - 3, 3);
                    }
                    if (clientNumber == "000")
                    {
                        clientNumber = null;
                    }

                    client = new CRMServiceClient();
                    DataSet ds = client.GetRegionsDistricts(clientNumber);
                    client.Close();

                    if (ds.Tables["LocationTable"] != null)
                    {
                        for (int i = 0; i < ds.Tables["LocationTable"].Rows.Count; i++)
                        {
                            string location     = ds.Tables["LocationTable"].Rows[i]["District"].ToString().Trim();
                            string locationName = ds.Tables["LocationTable"].Rows[i]["DistrictName"].ToString().Trim();
                            districts.LocationTable.AddLocationTableRow(location, locationName);
                        }
                    }
                    districts.AcceptChanges();

                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1440));
                    cache.Set("districts" + clientNumber, districts, 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(districts);
        }
Exemple #23
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);
        }
Exemple #24
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);
        }
Exemple #25
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);
        }
Exemple #26
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);
        }
Exemple #27
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);
        }
Exemple #28
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);
        }
Exemple #29
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);
        }
Exemple #30
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);
        }