Пример #1
0
        public ActionResult DesktopGroupsAddEx(Catalog newItem)
        {
            using (log4net.NDC.Push(Guid.NewGuid().ToString()))
            {
                var dbgMsg = "Request to Create Desktop group " + newItem.Name + " data: " + newItem;
                logger.Debug(dbgMsg);
                try
                {
                    var networks = XenDesktopInventoryItem.GetNetworkList();
                    newItem.Network = networks[networks.Count - 1].Id;
                    logger.Debug("Using network " + newItem.Network);
                    if (XenDesktopInventoryItem.ZoneSupportsSecurityGroups())
                    {
                        var securityGroups = XenDesktopInventoryItem.GetSecurityGroupList();
                        newItem.SecurityGroup = securityGroups[0].Id;
                        logger.Debug("Using security group " + newItem.SecurityGroup);
                    }

                    Catalog.CreateCatalog(newItem);
                    newItem.Status = CreateStatus;

                    // Network names can include an apostrophe, which triggers code that screens for an SQL injection attack,
                    // so we null out the network
                    newItem.Network = null;
                    return(RedirectToAction("DesktopGroups", newItem));
                }
                catch (System.Exception ex)
                {
                    var errMsg = "Exception when starting create for " + newItem + " Message: " + ex.Message;
                    logger.Error(errMsg, ex);
                    return(View());
                }
            }
        }
Пример #2
0
        public ActionResult DesktopGroupsAdd()
        {
            using (log4net.NDC.Push(Guid.NewGuid().ToString()))
            {
                logger.Debug("Request for Create DesktopGroups page");
                LoginViewModel clientId =
                    LoginViewModel.JsonDeserialize(((FormsIdentity)User.Identity).Ticket);
                ViewBag.Domain = clientId.DomainName;
                // ViewBag offers typeless mechanism of exposing objects to the view page
                ViewBag.Templates = new List <Template>();
//                ViewBag.Templates = Template.GetTemplates(CloudStackClient);
                ViewBag.DesktopTypes     = Catalog.DesktopTypeList;
                ViewBag.ComputeOfferings = XenDesktopInventoryItem.GetServiceOfferingList();
                ViewBag.AvailableUsers   = Catalog.GetActiveDirectoryUsers("*");
                return(View());
            }
        }
Пример #3
0
        public ActionResult DesktopGroupsAddEx()
        {
            using (log4net.NDC.Push(Guid.NewGuid().ToString()))
            {
                logger.Debug("Request for Create DesktopGroups page with billing");
                LoginViewModel clientId =
                    LoginViewModel.JsonDeserialize(((FormsIdentity)User.Identity).Ticket);
                ViewBag.Domain = clientId.DomainName;
                // ViewBag offers typeless mechanism of exposing objects to the view page
                ViewBag.Templates = new List <Template>();

                // Templates come from AJAX call
                //                ViewBag.Templates = Template.GetTemplates(CloudStackClient);
                ViewBag.DesktopTypes     = Catalog.DesktopTypeList;
                ViewBag.ComputeOfferings = XenDesktopInventoryItem.GetServiceOfferingList();
                ViewBag.AvailableUsers   = Catalog.GetActiveDirectoryUsers("*");

                // ProductBundle list comes from CPBM
                if (DT2.Properties.Settings.Default.TestDisableProductBundleGet)
                {
                    // Dev scaffolding:
                    dynamic response = JsonConvert.DeserializeObject(ProductBundle.SampleCatalogJson2);
                    ViewBag.Bundles = DT2.Models.ProductBundle.ParseJson(response);
                }
                else
                {
                    var bundles = ProductBundle.GetBundles();

                    // verify that each bundle has a monthly and one time charge.
                    foreach (var item in bundles)
                    {
                        if (item.RateCardCharges.Count < 2)
                        {
                            item.RateCardCharges.Add("0.00");
                        }
                        if (item.RateCardCharges.Count < 2)
                        {
                            item.RateCardCharges.Add("0.00");
                        }
                    }
                    ViewBag.Bundles = bundles;
                }
                return(View());
            }
        }