public ActionResult UtgTransactionPage(DataTablesPageRequest pageRequest)
        {
            var petaPocoPage = _repository.GetUtgTransactions(pageRequest);
            var pageResponse = DataTablesFormat.PageResponseUtgTransactions(pageRequest, petaPocoPage);

            return Json(pageResponse);
        }
        public ActionResult chipPage(DataTablesPageRequest pageRequest)
        {
            if (User.IsInRole("Administrator") || User.IsInRole("Read Only") || User.IsInRole("Regular User"))
            {
                var petaPocoPage = _repository.Getchips(pageRequest);
                var pageResponse = DataTablesFormat.PageResponsechips(pageRequest, petaPocoPage);

                return Json(pageResponse);
            }
            else
            {
                FormsAuthentication.SignOut();
                return RedirectToAction("Index", "Home");
            }
        }
 public static object PageResponseApplicationUsers(DataTablesPageRequest pageRequest, Page<ApplicationUsers> report)
 {
     return new
     {
         sEcho = pageRequest.Echo,
         iTotalRecords = report.TotalItems,
         iTotalDisplayRecords = report.TotalItems,
         sColumns = pageRequest.ColumnNames,
         aaData = (from i in report.Items
                   select new[]
            		                 	{
                                         i.UserName,
                                         i.RoleName,
                                         i.LastActivityDate.ToString()
            		                 	}).ToList()
     };
 }
 public static object PageResponseHistorychipReadable(DataTablesPageRequest pageRequest, Page<History_chipsReadable> report)
 {
     return new
     {
         sEcho = pageRequest.Echo,
         iTotalRecords = report.TotalItems,
         iTotalDisplayRecords = report.TotalItems,
         sColumns = pageRequest.ColumnNames,
         aaData = (from i in report.Items
                   select new[]
            		                 	{
                                       //  i.Id.ToString(),
                                         //i.TransactionId.ToString(CultureInfo.InvariantCulture),
                                         i.Date.ToString(),
                                         i.chipId.ToString(CultureInfo.InvariantCulture),
                                         i.UserId,
                                         i.FieldName,
                                         i.OldValue,
                                         i.NewValue
            		                 	}).ToList()
     };
 }
 public static object PageResponsechips(DataTablesPageRequest pageRequest, Page<chip> report)
 {
     return new
     {
         sEcho = pageRequest.Echo,
         iTotalRecords = report.TotalItems,
         iTotalDisplayRecords = report.TotalItems,
         sColumns = pageRequest.ColumnNames,
         aaData = (from i in report.Items
                   select new[]
            		                 	{
                                         i.chipId.ToString(CultureInfo.InvariantCulture),
                                         //i.TcGuid,
                                         //i.CardId,
                                         i.CardName,
                                         i.CardVersion,
                                         i.HardwareRevision,
                                         i.ManufactureDate.ToString(),
                                         i.Description
            		                 	}).ToList()
     };
 }
Esempio n. 6
0
        private static IEnumerable<string> GetSearchClause(DataTablesPageRequest pageRequest)
        {
            var columns = pageRequest.ColumnNames.Split(',');

            for (var idx = 0; idx < pageRequest.Searchable.Count; ++idx)
            {
                if (pageRequest.Searchable[idx])
                    yield return string.Format("{0} LIKE @0", columns[idx]);
            }
        }
Esempio n. 7
0
        private static IEnumerable<string> GetOrderByClause(DataTablesPageRequest pageRequest)
        {
            var columns = pageRequest.ColumnNames.Split(',');

            for (var idx = 0; idx < pageRequest.SortingCols; ++idx)
            {
                yield return string.Format("{0} {1}", columns[pageRequest.SortCol[idx]], pageRequest.SortDir[idx]);
            }
        }
Esempio n. 8
0
        public Page<UtgTransaction> GetUtgTransactionsForChip(DataTablesPageRequest pageRequest, int chipId)
        {
            var query = Sql.Builder
                .Append("SELECT *")
                .Append("FROM [ProvisioningRecords].[dbo].[UtgTransactions]")
                .Append("WHERE [ProvisioningRecords].[dbo].[UtgTransactions].[chipId] = '" + chipId + "'");

            if (!string.IsNullOrEmpty(pageRequest.Search))
            {
                var whereClause = string.Join(" OR ", GetSearchClause(pageRequest));

                if (!string.IsNullOrEmpty(whereClause))
                    query.Append("WHERE " + whereClause, "%" + pageRequest.Search + "%");
            }

            var orderBy = string.Join(",", GetOrderByClause(pageRequest));

            if (!string.IsNullOrEmpty(orderBy))
            {
                query.Append("ORDER BY " + orderBy);
            }

            var startPage = (pageRequest.DisplayLength == 0) ? 1 : pageRequest.DisplayStart / pageRequest.DisplayLength + 1;

            return _database.Page<UtgTransaction>(startPage, pageRequest.DisplayLength, query);
        }
Esempio n. 9
0
        public Page<UtgTransaction> GetUtgTransactions(DataTablesPageRequest pageRequest)
        {
            var query = Sql.Builder
                .Select("*")
                .From("dbo.UtgTransactions");

            if (!string.IsNullOrEmpty(pageRequest.Search))
            {
                var whereClause = string.Join(" OR ", GetSearchClause(pageRequest));

                if (!string.IsNullOrEmpty(whereClause))
                    query.Append("WHERE " + whereClause, "%" + pageRequest.Search + "%");
            }

            var orderBy = string.Join(",", GetOrderByClause(pageRequest));

            if (!string.IsNullOrEmpty(orderBy))
            {
                query.Append("ORDER BY " + orderBy);
            }

            var startPage = (pageRequest.DisplayLength == 0) ? 1 : pageRequest.DisplayStart / pageRequest.DisplayLength + 1;

            return _database.Page<UtgTransaction>(startPage, pageRequest.DisplayLength, query);
        }
Esempio n. 10
0
        public Page<History_chips> GetTcHistoryRecordsForChip(DataTablesPageRequest pageRequest, int chipId)
        {
            try
            {
                var query = Sql.Builder
                    .Append("SELECT *")
                    .Append("FROM [ProvisioningRecords].[dbo].[history_chips]")
                    .Append("WHERE [ProvisioningRecords].[dbo].[history_chips].[chipId] = '" + chipId + "'");

                if (!string.IsNullOrEmpty(pageRequest.Search))
                {
                    var whereClause = string.Join(" OR ", GetSearchClause(pageRequest));

                    if (!string.IsNullOrEmpty(whereClause))
                        query.Append("WHERE " + whereClause, "%" + pageRequest.Search + "%");
                }

                var orderBy = string.Join(",", GetOrderByClause(pageRequest));

                if (!string.IsNullOrEmpty(orderBy))
                {
                    query.Append("ORDER BY " + orderBy);
                }

                var startPage = (pageRequest.DisplayLength == 0) ? 1 : pageRequest.DisplayStart / pageRequest.DisplayLength + 1;

                return _database.Page<History_chips>(startPage, pageRequest.DisplayLength, query);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                return null;
            }
        }
 public static object PageResponseMfgTransactions(DataTablesPageRequest pageRequest, Page<MfgTransaction> report)
 {
     return new
     {
         sEcho = pageRequest.Echo,
         iTotalRecords = report.TotalItems,
         iTotalDisplayRecords = report.TotalItems,
         sColumns = pageRequest.ColumnNames,
         aaData = (from i in report.Items
                   select new[]
            		                 	{
                                         i.TransactionId.ToString(CultureInfo.InvariantCulture),
                                         i.chipId.ToString(CultureInfo.InvariantCulture),
                                         i.ProvStation,
                                         i.ResultCode,
                                         i.MfgTestFailureMode,
                                         i.ChipProductName,
                                         i.ChipRevision,
                                         i.ChipDateStamp.ToString(),
                                         i.DateStartRun.ToString(),
                                         //i.DateDoneRun.ToString(),
                                         //i.DateStartSecureAndTest.ToString(),
                                         //i.DateDoneSecureAndTest.ToString(),
                                         //i.DateStartProvision.ToString(),
                                         //i.DateDoneProvision.ToString(),
                                         //i.VersionFPGAPattern,
                                         //i.VersionFirmwareBootBin,
                                         //i.VersionFirmwareSdCardBin,
                                         i.SetNonReprogammable,
                                         i.LockOnly.ToString()
            		                 	}).ToList()
     };
 }
Esempio n. 12
0
        public Page<ApplicationUsers> GetApplicationUsers(DataTablesPageRequest pageRequest)
        {
            var query = Sql.Builder
                .Append("SELECT [ProvisioningRecords].[dbo].[Users].[UserName], [ProvisioningRecords].[dbo].[Roles].[RoleName], [ProvisioningRecords].[dbo].[Users].[LastActivityDate]")
                .Append("FROM [ProvisioningRecords].[dbo].[Users]")
                .Append("LEFT OUTER JOIN [ProvisioningRecords].[dbo].[UsersInRoles]")
                .Append("ON [ProvisioningRecords].[dbo].[Users].[UserId] = [ProvisioningRecords].[dbo].[UsersInRoles].[UserId]")
                .Append("LEFT OUTER JOIN [ProvisioningRecords].[dbo].[Roles]")
                .Append("ON [ProvisioningRecords].[dbo].[UsersInRoles].[RoleId] = [ProvisioningRecords].[dbo].[Roles].[RoleId]");

            if (!string.IsNullOrEmpty(pageRequest.Search))
            {
                var whereClause = string.Join(" OR ", GetSearchClause(pageRequest));

                if (!string.IsNullOrEmpty(whereClause))
                    query.Append("WHERE " + whereClause, "%" + pageRequest.Search + "%");
            }

            var orderBy = string.Join(",", GetOrderByClause(pageRequest));

            if (!string.IsNullOrEmpty(orderBy))
            {
                query.Append("ORDER BY " + orderBy);
            }

            var startPage = (pageRequest.DisplayLength == 0) ? 1 : pageRequest.DisplayStart / pageRequest.DisplayLength + 1;

            return _database.Page<ApplicationUsers>(startPage, pageRequest.DisplayLength, query);
        }
 public static object PageResponseUtgTransactions(DataTablesPageRequest pageRequest, Page<UtgTransaction> report)
 {
     return new
     {
         sEcho = pageRequest.Echo,
         iTotalRecords = report.TotalItems,
         iTotalDisplayRecords = report.TotalItems,
         sColumns = pageRequest.ColumnNames,
         aaData = (from i in report.Items
                   select new[]
            		                 	{
                                         i.TransactionId.ToString(CultureInfo.InvariantCulture),
                                         i.TransactionDate.ToString(),
                                         i.chipId.ToString(CultureInfo.InvariantCulture),
                                         //i.TcGuid,
                                         i.Customer,
                                         i.UtgType,
                                         i.ResultCode,
                                         i.FirmwareRev,
                                         i.ErrorCode
            		                 	}).ToList()
     };
 }
 public static object PageResponseUirHistory(DataTablesPageRequest pageRequest, Page<History_UsersInRoles> report)
 {
     return new
     {
         sEcho = pageRequest.Echo,
         iTotalRecords = report.TotalItems,
         iTotalDisplayRecords = report.TotalItems,
         sColumns = pageRequest.ColumnNames,
         aaData = (from i in report.Items
                   select new[]
            		                 	{
                                       //  i.Id.ToString(),
                                         i.Date.ToString(),
                                         i.AdminId.ToString(),
                                         i.SubjectUserId.ToString(),
                                         i.OldRole,
                                         i.NewRole
            		                 	}).ToList()
     };
 }
        public ActionResult HistorychipPageForchip(DataTablesPageRequest pageRequest, int chipId)
        {
            if (User.IsInRole("Administrator"))
            {
                var petaPocoPage = GeneralHelpers.GetReadableTcHistoryForSubjectUser(_repository.GetTcHistoryRecordsForChip(pageRequest, chipId));
                var pageResponse = DataTablesFormat.PageResponseHistorychipReadable(pageRequest, petaPocoPage);

                return Json(pageResponse);
            }
            else
            {
                FormsAuthentication.SignOut();
                return RedirectToAction("Index", "Home");
            }
        }
Esempio n. 16
0
        public Page<chip> Getchips(DataTablesPageRequest pageRequest)
        {
            var query = Sql.Builder
                .Select("*")
                //.Select("chipId, CardName, CardVersion, HardwareRevision, ManufactureDate, Description")
                .From("dbo.chips");

            if (!string.IsNullOrEmpty(pageRequest.Search))
            {
                var whereClause = string.Join(" OR ", GetSearchClause(pageRequest));

                if (!string.IsNullOrEmpty(whereClause))
                    query.Append("WHERE " + whereClause, "%" + pageRequest.Search + "%");
            }

            var orderBy = string.Join(",", GetOrderByClause(pageRequest));

            if (!string.IsNullOrEmpty(orderBy))
            {
                query.Append("ORDER BY " + orderBy);
            }

            var startPage = (pageRequest.DisplayLength == 0) ? 1 : pageRequest.DisplayStart / pageRequest.DisplayLength + 1;

            return _database.Page<chip>(startPage, pageRequest.DisplayLength, query);
        }
        public ActionResult HistoryUsersInRolePageForSubjectUser(DataTablesPageRequest pageRequest, Guid subjectUserId)
        {
            if (User.IsInRole("Administrator"))
            {
                var petaPocoPage = GeneralHelpers.GetReadableRolesHistoryForSubjectUser(_repository.GetRolesHistoryForSubjectUser(pageRequest, subjectUserId));
                var pageResponse = DataTablesFormat.PageResponseReadableUirHistory(pageRequest, petaPocoPage);

                return Json(pageResponse);
            }
            else
            {
                FormsAuthentication.SignOut();
                return RedirectToAction("Index", "Home");
            }
        }