Exemple #1
0
        //Insert Daily Log
        public void insertLog(string description, string logType, string stID, int LogID)
        {
            try
            {
                using (var context = new STHookEntities())
                {
                    var STHookLog = context.STHookLog.Find(LogID);

                    var DailyLog = context.DailyLog.Add(new DailyLog
                    {
                        ServiceTradeId = stID,
                        Description    = description,
                        TimeStamp      = System.DateTime.Now,
                        logType        = logType
                    });

                    STHookLog.DailyLog.Add(DailyLog);

                    context.SaveChanges();
                }
            }
            catch
            {
            }
        }
        //Update SMTP Settings
        public bool updateSMTPSettings(int Id, bool enableSSL, string port, string host, string username, string email, string password)
        {
            bool success = false;

            STHookEntities context = new STHookEntities();

            var smtpSettings = context.SMTPSettings.SingleOrDefault(s => s.id == Id);

            try
            {
                if (smtpSettings != null)
                {
                    smtpSettings.SMTPEnableSSL         = enableSSL;
                    smtpSettings.SMTPPort              = port;
                    smtpSettings.SMTPHost              = host;
                    smtpSettings.SMTPUsername          = username;
                    smtpSettings.SMTPNotificationEmail = email;
                    smtpSettings.SMTPPassword          = password;
                    context.SaveChanges();
                    success = true;
                }
            }

            catch
            {
                success = false;
            }

            return(success);
        }
Exemple #3
0
        //Insert Main Log Entry
        public int insertSTHookLog()
        {
            int LogID = 0;

            try
            {
                STHookEntities context = new STHookEntities();

                var STHookLog = context.STHookLog.Add(new STHookLog

                {
                    TimeStamp = System.DateTime.Now
                });
                context.SaveChanges();

                //Return LogID
                LogID = STHookLog.LogID;
            }
            catch
            {
            }
            return(LogID);
        }
        //Update Hook Settings
        public bool updateHookCredentials(int Id, bool runProductionMode, string uri, string username, string password, string connectionstring, string uriTest, string usernameTest,
                                          string passwordTest, string connectionstringTest)
        {
            bool success = false;

            STHookEntities context = new STHookEntities();

            var hookSettings = context.HookCredentials.SingleOrDefault(h => h.id == Id);


            try
            {
                if (hookSettings != null)
                {
                    hookSettings.runProductionMode     = runProductionMode;
                    hookSettings.ServiceTradeURI       = uri;
                    hookSettings.ServiceTradeUserName  = username;
                    hookSettings.ServiceTradePassword  = password;
                    hookSettings.AS400ConnectionString = connectionstring;


                    hookSettings.ServiceTradeURITest       = uriTest;
                    hookSettings.ServiceTradeUserNameTest  = usernameTest;
                    hookSettings.ServiceTradePasswordTest  = passwordTest;
                    hookSettings.AS400ConnectionStringTest = connectionstringTest;
                    context.SaveChanges();
                    success = true;
                }
            }

            catch
            {
                success = false;
            }

            return(success);
        }