示例#1
0
 public ActionResult Index()
 {
     using (var context = dataContextFactory.CreateByUser())
     {
         var viewModel = new HomeViewModel(context.GetUser(HttpContext.User.Identity));
         return(View(viewModel));
     }
 }
示例#2
0
        /// <summary>
        /// Show a list of CustomerAppIssues by CustomerApp
        /// </summary>
        /// <param name="customerAppId">CustomerApp to show Issues for</param>
        /// <returns></returns>
        public ActionResult Index(Guid customerAppId)
        {
            using (var context = dataContextFactory.CreateByUser())
            {
                var customerAppIssues =
                    (from x in context.CustomerAppIssues where x.CustomerAppId == customerAppId select x);

                var viewModel = new CustomerAppIssueIndexViewModel(customerAppIssues);

                return(View(viewModel));
            }
        }
示例#3
0
        /// <summary>
        /// Get list of SKUs
        /// </summary>
        /// <returns>SKU index list view</returns>
        public ActionResult Index()
        {
            using (var context = dataContextFactory.CreateByUser())
            {
                //Eager loading SKU
                var SKUQuery = (from x in context.SKUs select x).Include(x => x.PrivateKey)
                               .Include(x => x.SkuFeatures.Select(f => f.Feature))
                               .OrderBy(x => x.SkuCode);

                SKUIndexViewModel viewModel = new SKUIndexViewModel(SKUQuery.ToList());
                return(View(viewModel));
            }
        }
示例#4
0
        public ActionResult IndexPartial(int userId)
        {
            using (var context = dataContextFactory.CreateByUser())
            {
                var objectRightsQuery = (from x in context.UserVendorRights where x.UserId == userId select x as UserObjectRight)
                                        .Union(from x in context.UserCustomerRights where x.UserId == userId select x as UserObjectRight)
                                        .Union(from x in context.UserLicenseRights where x.UserId == userId select x as UserObjectRight)
                                        .Include(x => x.Right);

                var viewModel = new UserObjectRightIndexViewModel(context.GetUser(HttpContext.User.Identity), userId, objectRightsQuery.ToList());

                return(PartialView(viewModel));
            }
        }
示例#5
0
        /// <summary>
        /// Get list of Customers
        /// </summary>
        /// <returns>Customer index list view</returns>
        public ActionResult Index()
        {
            using (var context = dataContextFactory.CreateByUser())
            {
                //Eager loading Customer
                var customerQuery = (from x in context.Customers select x)
                                    .Include(x => x.Country)
                                    .OrderBy(x => x.Name);

                var viewModel = new CustomerIndexViewModel(context.GetUser(HttpContext.User.Identity), customerQuery.ToList());

                return(View(viewModel));
            }
        }
示例#6
0
        /// <summary>
        /// Get list of transactions
        /// </summary>
        /// <returns>Transaction index list view</returns>
        public ActionResult Index()
        {
            using (var context = dataContextFactory.CreateByUser())
            {
                //Eager loading Transaction
                var transactionQuery = (from x in context.Transactions orderby x.CreatedDateTime select x)
                                       .Include(x => x.TransactionItems.Select(s => s.Sku))
                                       .Include(x => x.TransactionItems.Select(s => s.License));

                var viewModel = new TransactionIndexViewModel(transactionQuery.OrderByDescending(x => x.CreatedDateTime).ToList());

                return(View(viewModel));
            }
        }
示例#7
0
        /// <summary>
        /// Start a new basket
        /// </summary>
        /// <param name="dataContextFactory">Data context factory</param>
        /// <returns>An instance of a basketwrapper serving a new transaction</returns>
        public static BasketWrapper CreateNewByIdentity(IDataContextFactory dataContextFactory)
        {
            var basket = new BasketWrapper(dataContextFactory.CreateByUser());
            basket.Transaction = new Transaction {CreatedDateTime = DateTime.Now};

            return basket;
        }
示例#8
0
        /// <summary>
        /// Get list of features
        /// </summary>
        /// <returns>Feature index list view</returns>
        public ActionResult Index()
        {
            using (var context = dataContextFactory.CreateByUser())
            {
                //Authorized vendors
                var vendorGuids = (from v in context.Vendors select v).Select(x => x.ObjectId).ToList();

                //Eager loading feature
                var featureQuery = (from f in context.Features where vendorGuids.Contains(f.VendorId) orderby f.FeatureCode select f)
                                   .Include(x => x.Vendor)
                                   .OrderBy(x => x.FeatureName);

                FeatureIndexViewModel viewModel = new FeatureIndexViewModel(featureQuery.ToList());

                return(View(viewModel));
            }
        }
示例#9
0
        /// <summary>
        /// Start a new basket
        /// </summary>
        /// <param name="dataContextFactory">Data context factory</param>
        /// <returns>An instance of a basketwrapper serving a new transaction</returns>
        public static BasketWrapper CreateNewByIdentity(IDataContextFactory dataContextFactory)
        {
            var basket = new BasketWrapper(dataContextFactory.CreateByUser());

            basket.Transaction = new Transaction {
                CreatedDateTime = DateTime.Now
            };

            return(basket);
        }
示例#10
0
        public ActionResult IndexPartial(Guid parentVendor)
        {
            using (var context = dataContextFactory.CreateByUser())
            {
                var privateKeyQuery = (from x in context.PrivateKeys where x.VendorId == parentVendor orderby x.DisplayName select x);
                var vendorQuery     = (from v in context.Vendors where v.ObjectId == parentVendor select v);

                PrivateKeyIndexViewModel viewModel = new PrivateKeyIndexViewModel(privateKeyQuery.ToList(), vendorQuery.FirstOrDefault());

                return(PartialView(viewModel));
            }
        }
示例#11
0
        public ActionResult IndexPartial(Guid parentLicense)
        {
            using (var context = dataContextFactory.CreateByUser())
            {
                var domainLicenseQuery = (from x in context.DomainLicenses where x.LicenseId == parentLicense orderby x.DomainName select x)
                                         .Include(x => x.License.Sku);

                var viewModel = new DomainLicenseIndexViewModel(parentLicense, domainLicenseQuery.ToList());

                return(PartialView(viewModel));
            }
        }
示例#12
0
        public static VendorCredentialModel ForCreate(IDataContextFactory contextFactory, Guid vendorId)
        {
            VendorCredentialModel result;

            using (var context = contextFactory.CreateByUser())
            {
                var vendor = (from x in context.Vendors where x.ObjectId == vendorId select x).FirstOrDefault();

                result = new VendorCredentialModel()
                {
                    VendorId = vendor.ObjectId,
                    VendorName = vendor.Name,
                };
            }
            return result;
        }
示例#13
0
        public static VendorCredentialModel ForCreate(IDataContextFactory contextFactory, Guid vendorId)
        {
            VendorCredentialModel result;

            using (var context = contextFactory.CreateByUser())
            {
                var vendor = (from x in context.Vendors where x.ObjectId == vendorId select x).FirstOrDefault();

                result = new VendorCredentialModel()
                {
                    VendorId   = vendor.ObjectId,
                    VendorName = vendor.Name,
                };
            }
            return(result);
        }
示例#14
0
        /// <summary>
        /// Get list of CustomerApps
        /// </summary>
        /// <returns>CustomerApp index list view</returns>
        public ActionResult Index()
        {
            using (var context = dataContextFactory.CreateByUser())
            {
                //Eager loading CustomerApp, includes Licenses and from License the SKUs
                var customerAppQuery = (from x in context.CustomerApps select x).Include(x => x.LicenseCustomerApps)
                                       .Include(x => x.LicenseCustomerApps.Select(s => s.License))
                                       .Include(x => x.CustomerAppIssues)
                                       .OrderBy(x => x.ApplicationName);

                var viewModel = new CustomerAppIndexViewModel(customerAppQuery.ToList());

                return(View(viewModel));
            }
        }
示例#15
0
        /// <summary>
        /// Get list of vendors
        /// </summary>
        /// <returns>Vendor index list view</returns>
        public ActionResult Index()
        {
            using (var context = dataContextFactory.CreateByUser())
            {
                //Eager loading Vendor
                var vendorQuery = (from v in context.Vendors select v).Include(x => x.Country);//.FilterByUser(UserEntity);

                var viewModel = new VendorIndexViewModel(context.GetUser(HttpContext.User.Identity), vendorQuery.ToList());

                return(View(viewModel));
            }
        }
示例#16
0
        public static VendorCredentialModel ForEdit(IDataContextFactory dataContextFactory, Guid key)
        {
            VendorCredentialModel result;

            using (var dataContext = dataContextFactory.CreateByUser())
            {
                var vendorCredential =
                    dataContext.VendorCredentials.Where(vs => vs.VendorCredentialId == key).Include(x => x.Vendor).Single();

                result = new VendorCredentialModel()
                {
                    VendorId           = vendorCredential.Vendor.ObjectId,
                    VendorName         = vendorCredential.Vendor.Name,
                    VendorCredentialId = vendorCredential.VendorCredentialId,
                    CredentialName     = vendorCredential.CredentialName,
                    CredentialValue    = Encoding.UTF8.GetString(SymmetricEncryption.DecryptForDatabase(vendorCredential.CredentialValue))
                };
            }
            return(result);
        }
示例#17
0
        public static VendorCredentialModel ForEdit(IDataContextFactory dataContextFactory, Guid key)
        {
            VendorCredentialModel result;

            using (var dataContext = dataContextFactory.CreateByUser())
            {
                var vendorCredential =
                    dataContext.VendorCredentials.Where(vs => vs.VendorCredentialId == key).Include(x => x.Vendor).Single();

                result = new VendorCredentialModel()
                {
                    VendorId = vendorCredential.Vendor.ObjectId,
                    VendorName = vendorCredential.Vendor.Name,
                    VendorCredentialId = vendorCredential.VendorCredentialId,
                    CredentialName = vendorCredential.CredentialName,
                    CredentialValue = Encoding.UTF8.GetString(SymmetricEncryption.DecryptForDatabase(vendorCredential.CredentialValue))
                };
            }
            return result;
        }
示例#18
0
        /// <summary>
        /// Get list of Licenses
        /// </summary>
        /// <returns>License index list view</returns>
        public ActionResult Index()
        {
            using (var context = dataContextFactory.CreateByUser())
            {
                //Eager loading License
                var licenseQuery = (from x in context.Licenses select x).Include(x => x.PurchasingCustomer)
                                   .Include(x => x.OwningCustomer)
                                   .Include(x => x.Sku)
                                   .OrderBy(x => x.OwningCustomer.Name);

                LicenseIndexViewModel viewModel = new LicenseIndexViewModel(context.GetUser(HttpContext.User.Identity), licenseQuery.ToList());

                return(View(viewModel));
            }
        }