Beispiel #1
0
        public SigmaResultType AddSigmaLog(TypeSigmaLog objSigmaLog)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(new SqlParameter("@Date", objSigmaLog.Date));
            paramList.Add(new SqlParameter("@Thread", objSigmaLog.Thread));
            paramList.Add(new SqlParameter("@Level", objSigmaLog.Level));
            paramList.Add(new SqlParameter("@Logger", objSigmaLog.Logger));
            paramList.Add(new SqlParameter("@Message", objSigmaLog.Message));
            paramList.Add(new SqlParameter("@Exception", objSigmaLog.Exception));
            SqlParameter outParam = new SqlParameter("@NewId", SqlDbType.Int);
            outParam.Direction = ParameterDirection.Output;
            paramList.Add(outParam);

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, CommandType.StoredProcedure, "usp_AddSigmaLog", paramList.ToArray());
                result.IsSuccessful = true;
                result.ScalarValue = (int)outParam.Value;
                scope.Complete();

            }

            return result;
        }
Beispiel #2
0
 public SigmaResultType AddSigmaLog(TypeSigmaLog objSigmaLog)
 {
     SigmaResultType result = new SigmaResultType();
     try
     {
         LogMgr LogMgr = new LogMgr();
         result = LogMgr.AddSigmaLog(objSigmaLog);
         return result;
     }
     catch (Exception ex)
     {
         // Log Exception
         ExceptionHelper.logException(ex);
         result.IsSuccessful = false;
         result.ErrorMessage = ex.Message;
         return result;
     }
 }
Beispiel #3
0
        public SigmaResultType UpdateSigmaLog(TypeSigmaLog objSigmaLog)
        {
            SigmaResultType result = new SigmaResultType();

            try
            {
                result.IsSuccessful = true;
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }
Beispiel #4
0
        public SigmaResultType UpdateSigmaLog(TypeSigmaLog objSigmaLog)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            // Compose parameters
            SqlParameter[] parameters = new SqlParameter[] {
                    new SqlParameter("@Date", objSigmaLog.Date),
                    new SqlParameter("@Thread", objSigmaLog.Thread),
                    new SqlParameter("@Level", objSigmaLog.Level),
                    new SqlParameter("@Logger", objSigmaLog.Logger),
                    new SqlParameter("@Message", objSigmaLog.Message),
                    new SqlParameter("@Exception", objSigmaLog.Exception)
                };

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, "usp_UpdateSigmaLog", parameters);
                result.IsSuccessful = true;
                scope.Complete();

            }

            return result;
        }
Beispiel #5
0
        public SigmaResultType RemoveSigmaLog(TypeSigmaLog objSigmaLog)
        {
            SigmaResultType result = new SigmaResultType();
            TransactionScope scope = null;

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            // Compose parameters
            SqlParameter[] parameters = new SqlParameter[] {
                    new SqlParameter("@Id", objSigmaLog.Id)
                };

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, "usp_RemoveSigmaLog", parameters);
                result.IsSuccessful = true;
                scope.Complete();
            }

            return result;
        }