private void CheckForChangeTracking()
 {
     using (RiftEntities context = new RiftEntities())
     {
         GCTSC_ChangeTracking ctRecord = (from ct in context.GCTSC_ChangeTracking.Where(ct => ct.Accountno == _roTestHelper._testAccountno)
                                          select ct).FirstOrDefault();
         Assert.IsTrue(ctRecord != null);
     }
 }
 private void CheckExceptionExists()
 {
     using (RiftEntities context = new RiftEntities())
     {
         GCTSC_ExceptionLogging exception = (from ex in context.GCTSC_ExceptionLogging.Where(ex => ex.Message.Contains("Lets see if we") &&
                                                                                             ex.InnerMessage.Contains("with an inner"))
                                             select ex).FirstOrDefault();
         Assert.IsNotNull(exception);
     }
 }
 private void ClearTestData()
 {
     using (RiftEntities context = new RiftEntities())
     {
         try
         {
             context.TESTs_ClearGCTSCChangeTrackingLogs();
         } catch (Exception ex) { throw ex; }
     }
 }
 private void ClearExceptionTable()
 {
     using (RiftEntities context = new RiftEntities())
     {
         try
         {
             context.TESTs_ClearGCTSCExceptionTable();
         }
         catch (Exception ex) { throw ex; }
     }
 }
Exemple #5
0
 private void SaveException(GCTSC_ExceptionLogging exception)
 {
     using (RiftEntities context = new RiftEntities())
     {
         try
         {
             context.GCTSC_ExceptionLogging.Add(exception);
             context.SaveChanges();
         }
         catch (Exception ex) { throw ex; }
     }
 }
Exemple #6
0
 public void UpdateContsuppVersionNumber(int newVersion)
 {
     using (RiftEntities context = new RiftEntities())
     {
         SystemKey systemKey = (from sk in context.SystemKeys.Where(sk => sk.Key == Contsupp_LastVersion) select sk).FirstOrDefault();
         if (systemKey != null)
         {
             systemKey.Value = newVersion.ToString();
             context.Entry(systemKey).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
         }
     }
 }
Exemple #7
0
        public int GetCurrentContsuppVersion()
        {
            int currentVersion = 1;

            using (RiftEntities context = new RiftEntities())
            {
                string result = (from sk in context.SystemKeys.Where(sk => sk.Key == Contsupp_LastVersion) select sk.Value).FirstOrDefault();
                if (!string.IsNullOrEmpty(result))
                {
                    currentVersion = int.Parse(result);
                }
            }
            return(currentVersion);
        }
Exemple #8
0
        public string GetTranslatedUser(string user)
        {
            string translatedCaseOwner = string.Empty;

            if (!string.IsNullOrEmpty(user))
            {
                using (RiftEntities context = new RiftEntities())
                {
                    string riftValue = (from r in context.WorkFlowUsernameLookups.Where(r => r.GoldMineUsername == user) select r.WorkFlowUsername).FirstOrDefault();
                    if (!string.IsNullOrEmpty(riftValue))
                    {
                        translatedCaseOwner = riftValue.Split('@')[0];
                    }
                }
            }
            return(translatedCaseOwner);
        }
        private void SaveGeneralRequestInformation(ResponseDetails response, GCTSC_ChangeTracking ctRecord)
        {
            GCTSC_ChangeTracking_Requests request = new GCTSC_ChangeTracking_Requests()
            {
                ChangeTrackingId = ctRecord.Id,
                ResponseCode     = response.SendResponse.ToString(),
                ResponseContent  = response.ResponseContent,
                URL = response.URL
            };

            using (RiftEntities context = new RiftEntities())
            {
                try
                {
                    context.GCTSC_ChangeTracking_Requests.Add(request);
                    context.SaveChanges();
                }
                catch (Exception ex) { throw ex; }
            }
        }
 private void CheckForChangeTrackingRequest()
 {
     using (RiftEntities context = new RiftEntities())
     {
         GCTSC_ChangeTracking ctRecord = (from ct in context.GCTSC_ChangeTracking.Where(ct => ct.Accountno == _roTestHelper._testAccountno)
                                          select ct).FirstOrDefault();
         if (ctRecord == null)
         {
             throw new ArgumentNullException("ctRecord");
         }
         else
         {
             GCTSC_ChangeTracking_Requests ctrRecord = (from ctr in context.GCTSC_ChangeTracking_Requests.Where(
                                                            ctr => ctr.ChangeTrackingId == ctRecord.Id &&
                                                            ctr.ResponseCode == "OK"
                                                            )
                                                        select ctr).FirstOrDefault();
             Assert.IsTrue(ctrRecord != null);
         }
     }
 }
Exemple #11
0
        public string GetTranslatedCaseOwner(string accountno)
        {
            string translatedCaseOwner = string.Empty;
            string goldmineValue       = string.Empty;

            using (GoldmineEntities context = new GoldmineEntities())
            {
                goldmineValue = (from c in context.CONTACT2.Where(c => c.ACCOUNTNO == accountno) select c.UBCASEOWN).FirstOrDefault();
            }
            if (!string.IsNullOrEmpty(goldmineValue))
            {
                using (RiftEntities context = new RiftEntities())
                {
                    string riftValue = (from r in context.WorkFlowUsernameLookups.Where(r => r.GoldMineUsername == goldmineValue) select r.WorkFlowUsername).FirstOrDefault();
                    if (!string.IsNullOrEmpty(riftValue))
                    {
                        translatedCaseOwner = riftValue.Split('@')[0];
                    }
                }
            }
            return(translatedCaseOwner);
        }
        public void Log(ResultsObject resultObject)
        {
            GCTSC_ChangeTracking ctRecord = new GCTSC_ChangeTracking()
            {
                Accountno = resultObject.Accountno,
                Created   = DateTime.Now
            };

            using (RiftEntities context = new RiftEntities())
            {
                try
                {
                    context.GCTSC_ChangeTracking.Add(ctRecord);
                    context.SaveChanges();
                }
                catch (Exception ex) { throw ex; }
            }

            if (ctRecord.Id > 0 && resultObject.Responses.Count > 0)
            {
                SaveResponseInformation(ctRecord, resultObject.Responses);
            }
        }
 private void CheckForChangeTrackingUpdateRequest()
 {
     using (RiftEntities context = new RiftEntities())
     {
         GCTSC_ChangeTracking ctRecord = (from ct in context.GCTSC_ChangeTracking.Where(ct => ct.Accountno == _roTestHelper._testAccountno)
                                          select ct).FirstOrDefault();
         if (ctRecord == null)
         {
             throw new ArgumentNullException("ctRecord");
         }
         else
         {
             GCTSC_ChangeTracking_UpdateRequests cturRecord = (from ctur in context.GCTSC_ChangeTracking_UpdateRequests.Where(
                                                                   ctur => ctur.ChangeTrackingId == ctRecord.Id &&
                                                                   ctur.ResponseCode == "OK" &&
                                                                   ctur.Change == "LASTNAME" &&
                                                                   ctur.ResponseContent.Contains(@"{""id"":1,""first_name"":""TestChange"",""goldmine_customer_number"":165992")
                                                                   )
                                                               select ctur).FirstOrDefault();
             Assert.IsTrue(cturRecord != null);
         }
     }
 }