Ejemplo n.º 1
0
        public List <IDTPErrorLog> GetIDTPErrorLog(DateTime?logDate)
        {
            IEnumerable <IDTPErrorLog> resultSet;

            using (var context = new IDTPDBContext())
            {
                var LogDate = new SqlParameter("@LogDate", logDate);
                resultSet = context.IDTPErrorLogs.FromSqlRaw <IDTPErrorLog>("usp_GetIDTPErrorLog", LogDate);
            }
            return(resultSet.ToList());
        }
Ejemplo n.º 2
0
        public List <IDTPAppErrorLog> GetIDTPAppErrorLog(DateTime?logDate)
        {
            IEnumerable <IDTPAppErrorLog> applogs = null;

            using (var context = new IDTPDBContext())
            {
                var LogDate = new SqlParameter("@LogDate", logDate);
                applogs = context.IDTPAppErrorLogs.FromSqlRaw <IDTPAppErrorLog>("dbo.usp_GetIDTPAppErrorLog @LogDate",
                                                                                new SqlParameter("@LogDate", LogDate));
            }
            return(applogs.ToList());
        }
Ejemplo n.º 3
0
        public DataTable GetDataWithSProc(string sprocName)
        {
            DataTable data = new DataTable();

            using (var context = new IDTPDBContext())
            {
                SqlConnection  sqlConnection  = new SqlConnection(context.Database.GetDbConnection().ConnectionString);
                SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sprocName, sqlConnection);
                sqlDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                sqlConnection.Open();
                sqlDataAdapter.Fill(data);
                sqlConnection.Close();
                sqlDataAdapter.Dispose();
            }
            return(data);
        }
Ejemplo n.º 4
0
        public virtual T GetSingle(Func <T, bool> where, params System.Linq.Expressions.Expression <Func <T, object> >[] navigationProperties)
        {
            if (_context == null)
            {
                _context = new IDTPDBContext();
            }

            T item = null;
            IQueryable <T> dbQuery = _context.Set <T>();

            //Apply eager loading
            foreach (Expression <Func <T, object> > navigationProperty in navigationProperties)
            {
                dbQuery = dbQuery.Include <T, object>(navigationProperty);
            }

            item = dbQuery
                   .AsNoTracking()         //Don't track any changes for the selected item
                   .FirstOrDefault(where); //Apply where clause
            return(item);
        }
Ejemplo n.º 5
0
        public virtual IQueryable <T> GetAll(params System.Linq.Expressions.Expression <Func <T, object> >[] navigationProperties)
        {
            if (_context == null)
            {
                _context = new IDTPDBContext();
            }

            IQueryable <T> list;
            IQueryable <T> dbQuery = _context.Set <T>();

            //Apply eager loading
            foreach (Expression <Func <T, object> > navigationProperty in navigationProperties)
            {
                dbQuery = dbQuery.Include <T, object>(navigationProperty);
            }

            list = dbQuery
                   .AsNoTracking()
                   .AsQueryable <T>();
            return(list);
        }
Ejemplo n.º 6
0
        public void LogIDTPError(int?UserID, int errorNumber, string errorContext, string errorMessage, string errorTimeStamp)
        {
            if (_isVerbose.ToLower(CultureInfo.CurrentCulture) == "true")
            {
                using (var context = new IDTPDBContext())
                {
                    SqlParameter param1 = new SqlParameter("@UserID", UserID);

                    SqlParameter param2 = new SqlParameter("@ErrorNumber", errorNumber);

                    SqlParameter param3 = new SqlParameter("@ErrorContex", errorContext);

                    SqlParameter param4 = new SqlParameter("@errorMessage", errorMessage);

                    SqlParameter param5 = new SqlParameter("@errorTimeStamp ", errorTimeStamp);

                    context.Database.ExecuteSqlRaw("usp_LogIDTPError @UserID, @ErrorNumber, @ErrorContex, @errorMessage, @errorTimeStamp",
                                                   param1, param2, param3, param4, param5);
                }
            }
        }
Ejemplo n.º 7
0
        public DataTable GetDataUsingSprocWithParam(string sprocName, string prameterName, string parameterValue, SqlDbType sqlDbType)
        {
            DataTable data = new DataTable();

            using (var context = new IDTPDBContext())
            {
                SqlConnection  sqlConnection  = new SqlConnection(context.Database.GetDbConnection().ConnectionString);
                SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sprocName, sqlConnection);
                sqlDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;

                sqlDataAdapter.SelectCommand.CommandTimeout = 120;

                /*SqlParameter SqlParameter = new SqlParameter(prameterName, sqlDbType);
                 * SqlParameter.Value = parameterValue;
                 * sqlDataAdapter.SelectCommand.Parameters.Add(SqlParameter);
                 */
                sqlDataAdapter.SelectCommand.Parameters.AddWithValue(prameterName, Int32.Parse(parameterValue));
                sqlConnection.Open();
                sqlDataAdapter.Fill(data);
                sqlConnection.Close();
                sqlDataAdapter.Dispose();
            }
            return(data);
        }
Ejemplo n.º 8
0
        //Logging error message from android app for the IDTP system

        public void LogAppErrorInfo(int UserID, string ErrorMessage, string ErrorStackTrace, int ErrorType, DateTime ErrorTimeStamp, string ErrorDeviceInfo)
        {
            if (_isVerbose.ToLower(CultureInfo.CurrentCulture) == "true")
            {
                using (var context = new IDTPDBContext())
                {
                    SqlParameter param1 = new SqlParameter("@UserID", UserID);

                    SqlParameter param2 = new SqlParameter("@ErrorMessage", ErrorMessage);

                    SqlParameter param3 = new SqlParameter("@ErrorStackTrace", ErrorStackTrace);

                    SqlParameter param4 = new SqlParameter("@ErrorType", ErrorType);

                    SqlParameter param5 = new SqlParameter("@ErrorTimeStamp", ErrorTimeStamp);

                    SqlParameter param6 = new SqlParameter("@ErrorDeviceInfo", ErrorDeviceInfo);

                    context.Database.ExecuteSqlRaw("dbo.usp_LogAndroidAppError @UserID, @ErrorMessage, @ErrorStackTrace,@ErrorType,@ErrorTimeStamp,@ErrorDeviceInfo",
                                                   param1, param2, param3, param4, param5, param6);
                    //context.Database.ExecuteSqlCommand("usp_Update_BI_Dashboard_Data");
                }
            }
        }
Ejemplo n.º 9
0
        public void LogUserActivity(int?UserID, string activity, System.Uri pageUrl)
        {
            if (_isVerbose.ToLower(CultureInfo.CurrentCulture) == "true")
            {
                try
                {
                    using (var context = new IDTPDBContext())
                    {
                        SqlParameter param1 = new SqlParameter("@UserId", UserID);

                        SqlParameter param2 = new SqlParameter("@Activity", activity);

                        SqlParameter param3 = new SqlParameter("@PageUrl", pageUrl);

                        context.Database.ExecuteSqlRaw("usp_LogUserActivity @UserId, @Activity, @PageUrl",
                                                       param1, param2, param3);
                    }
                }
                catch (WebException)
                {
                    throw;
                }
            }
        }
Ejemplo n.º 10
0
 public GenericDataRepository()
 {
     _context = new IDTPDBContext();
 }
Ejemplo n.º 11
0
 public SuspenseTransactionRepository()
 {
     _context = new IDTPDBContext();
 }