public static void SaveSystemUser(SystemUser user)
 {
     using (var ctx = new BMIKidsEntities(ConnectionString))
     {
         try
         {
             ctx.SystemUsers.ApplyChanges(user);
             ctx.SaveChanges();
         }
         catch (Exception ex)
         {
             LogUtility.WriteEntryEventLog("SaveSystemUser_DataProvider_UpdateTransaction", ex, EventLogEntryType.Information);
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }
Exemplo n.º 2
0
 public static void Save(FAQCategory faqCat)
 {
     using (var ctx = new BMIKidsEntities(ConnectionString))
     {
         try
         {
             ctx.FAQCategories.ApplyChanges(faqCat);
             ctx.SaveChanges();
         }
         catch (Exception ex)
         {
             LogUtility.WriteEntryEventLog("faqCat_DataProvider_DataProvider", ex, EventLogEntryType.Information);
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }
 public static void SavePostalCard(PostalCard PostalCard)
 {
     using (var ctx = new BMIKidsEntities(ConnectionString))
     {
         try
         {
             ctx.PostalCards.ApplyChanges(PostalCard);
             ctx.SaveChanges();
         }
         catch (Exception ex)
         {
             LogUtility.WriteEntryEventLog("PostalCard_DataProvider_DataProvider", ex, EventLogEntryType.Information);
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }
        public static void SaveExamQuestion(BankStoryExam_Question Question)
        {
            using (var ctx = new BMIKidsEntities(ConnectionString))
            {
                try
                {
                    ctx.BankStoryExam_Question.ApplyChanges(Question);
                    ctx.SaveChanges();

                }
                catch (Exception ex)
                {
                    LogUtility.WriteEntryEventLog("BankStory_DataProvider_SaveExamQuestion", ex, EventLogEntryType.Information);
                    if (ex.InnerException != null)
                        throw ex.InnerException;
                    throw;
                }
            }
        }
 public static int SaveExam(BankStoryExam Exam)
 {
     using (var ctx = new BMIKidsEntities(ConnectionString))
     {
         try
         {
             ctx.BankStoryExams.ApplyChanges(Exam);
             ctx.SaveChanges();
             return Exam.ExamId;
         }
         catch (Exception ex)
         {
             LogUtility.WriteEntryEventLog("BankStory_DataProvider_SaveExam", ex, EventLogEntryType.Information);
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }
Exemplo n.º 6
0
 public static void SavePollResponse(PollUserResponse UserResp)
 {
     using (var ctx = new BMIKidsEntities(ConnectionString))
     {
         try
         {
             UserResp.Serial = Guid.NewGuid();
             ctx.PollUserResponses.ApplyChanges(UserResp);
             ctx.SaveChanges();
         }
         catch (Exception ex)
         {
             LogUtility.WriteEntryEventLog("Poll_DataProvider_SavePollResponse", ex, EventLogEntryType.Information);
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }
        public static void SaveUserResponse(QuestionnaireForm_UserResponses resp)
        {
            using (var ctx = new BMIKidsEntities(ConnectionString))
            {
                try
                {
                    ctx.QuestionnaireForm_UserResponses.ApplyChanges(resp);
                    ctx.SaveChanges();

                }
                catch (Exception ex)
                {
                    LogUtility.WriteEntryEventLog("Poll_DataProvider_SavePoll", ex, EventLogEntryType.Information);
                    if (ex.InnerException != null)
                        throw ex.InnerException;
                    throw;
                }
            }
        }
Exemplo n.º 8
0
        public static void SaveConfig(Config c)
        {
            using (var ctx = new BMIKidsEntities(BaseDataProvider.ConnectionString))
            {
                try
                {
                    if (c.ChangeTracker.State == ObjectState.Unchanged)
                        c.MarkAsModified();

                    ctx.Configs.ApplyChanges(c);
                    ctx.SaveChanges();
                    c.AcceptChanges();
                }
                catch (Exception ex)
                {
                    if (ex.InnerException != null)
                        throw ex.InnerException;
                    throw;
                }
            }
        }
        public static void SaveFestival(Festival festival)
        {
            using (var ctx = new BMIKidsEntities(ConnectionString))
            {
                try
                {
                    if (festival.ChangeTracker.State == ObjectState.Unchanged)
                        festival.MarkAsModified();

                    ctx.Festivals.ApplyChanges(festival);
                    ctx.SaveChanges();
                }
                catch (Exception ex)
                {
                    LogUtility.WriteEntryEventLog("Festival_DataProvider_DataProvider", ex, EventLogEntryType.Information);
                    if (ex.InnerException != null)
                        throw ex.InnerException;
                    throw;
                }
            }
        }
Exemplo n.º 10
0
 public static void DeleteConfig(Config c)
 {
     using (var ctx = new BMIKidsEntities(BaseDataProvider.ConnectionString))
     {
         try
         {
             c.MarkAsDeleted();
             ctx.Configs.ApplyChanges(c);
             ctx.SaveChanges();
             c.AcceptChanges();
         }
         catch (Exception ex)
         {
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }
Exemplo n.º 11
0
 public static long SavePoll(PollQuestion p)
 {
     using (var ctx = new BMIKidsEntities(ConnectionString))
     {
         try
         {
             ctx.PollQuestions.ApplyChanges(p);
             ctx.SaveChanges();
             return p.QuestionId;
         }
         catch (Exception ex)
         {
             LogUtility.WriteEntryEventLog("Poll_DataProvider_SavePoll", ex, EventLogEntryType.Information);
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }
Exemplo n.º 12
0
 public static void SaveGeustKidsUser(GeustKidsUser gUser)
 {
     using (var ctx = new BMIKidsEntities(ConnectionString))
     {
         try
         {
             ctx.GeustKidsUsers.ApplyChanges(gUser);
             ctx.SaveChanges();
             gUser.AcceptChanges();
         }
         catch (Exception ex)
         {
             LogUtility.WriteEntryEventLog("SaveGeustKidsUser", ex, EventLogEntryType.Information);
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }
Exemplo n.º 13
0
        public static void SaveKidsUserPayment(KidsUsers_Payments payment)
        {
            using (var ctx = new BMIKidsEntities(ConnectionString))
            {
                try
                {

                    if (payment.ChangeTracker.State == ObjectState.Added)
                    {
                        payment.CreateDateTime = DateTime.Now;
                        payment.LastUpdateDateTime = null;
                    }
                    else
                        payment.LastUpdateDateTime = DateTime.Now;

                    ctx.KidsUsers_Payments.ApplyChanges(payment);
                    ctx.SaveChanges();
                    payment.AcceptChanges();
                }
                catch (Exception ex)
                {
                    LogUtility.WriteEntryEventLog("SaveSystemUser_DataProvider_UpdateTransaction", ex, EventLogEntryType.Information);
                    if (ex.InnerException != null)
                        throw ex.InnerException;
                    throw;
                }
            }
        }
Exemplo n.º 14
0
        public static void SaveKidsUser(KidsUser user, object p, Action<Object> a)
        {
            using (var ctx = new BMIKidsEntities(ConnectionString))
            {
                try
                {
                    if (user.ChangeTracker.State == ObjectState.Unchanged)
                        user.MarkAsModified();

                    if (user.ChangeTracker.State == ObjectState.Added)
                    {
                        user.CreateDateTime = DateTime.Now;
                        user.LastUpdateDateTime = null;
                    }
                    else
                        user.LastUpdateDateTime = DateTime.Now;

                    ctx.KidsUsers.ApplyChanges(user);
                    ctx.SaveChanges();
                    user.AcceptChanges();

                    if (a != null)
                        a(p);
                }
                catch (Exception ex)
                {
                    LogUtility.WriteEntryEventLog("SaveSystemUser_DataProvider_UpdateTransaction", ex, EventLogEntryType.Information);
                    if (ex.InnerException != null)
                        throw ex.InnerException;
                    throw;
                }
            }
        }
Exemplo n.º 15
0
 internal static void SaveScore(Kids_Scores game)
 {
     using (var ctx = new BMIKidsEntities(ConnectionString))
     {
         try
         {
             ctx.Kids_Scores.ApplyChanges(game);
             ctx.SaveChanges();
         }
         catch (Exception ex)
         {
             LogUtility.WriteEntryEventLog("Kids_Scores_DataProvider", ex, EventLogEntryType.Information);
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }