public JsonNetResult LoadData(int uiTemplateID)
        {
            //Data return controlTagElem
            JsonNetResult result = new JsonNetResult();

            //Get the UITemplate
            UITemplateService _uiTemplatesService = new UITemplateService(SessionData.LoggedInUser.ID);
            BLL.BusinessObjects.UITemplate template = _uiTemplatesService.GetByID(uiTemplateID);
            result.Data = template;

            return result;
        }
        public JsonNetResult GetUITemplates()
        {
            //Default return variable
            JsonNetResult result = new JsonNetResult() { Data = null };

            //Retreive UITemplates belonging to the current User
            UITemplateService _uiTemplatesService = new UITemplateService(SessionData.LoggedInUser.ID);
            List<BLL.BusinessObjects.UITemplate> uitemplates = _uiTemplatesService.GetByUserID(SessionData.LoggedInUser.ID, true);
            result.Data = uitemplates;

            //
            return result;
        }
        public JsonNetResult AddNewUITemplate()
        {
            //Default return variable
            JsonNetResult result = new JsonNetResult() { Data = null };

            //Add a new UITemplate
            UITemplateService _uiTemplatesService = new UITemplateService(SessionData.LoggedInUser.ID);
            BLL.BusinessObjects.UITemplate newUITemplate = (BLL.BusinessObjects.UITemplate)_uiTemplatesService.CreateDefault();
            _uiTemplatesService.Add(newUITemplate);

            //
            result.Data = newUITemplate;
            return result;
        }
        public void SaveUITemplate(int uiTemplateID, string name, string content, string css)
        {
            //Create service
            UITemplateService _uiTemplateService = new UITemplateService(SessionData.LoggedInUser.ID);

            //Save changes to template
            UITemplate currentTemplate = _uiTemplateService.GetByID(uiTemplateID);
            currentTemplate.Name = name;
            currentTemplate.Content = content;
            currentTemplate.Stylesheet = css;

            //
            _uiTemplateService.Update(currentTemplate);
        }
        public string GetUITemplates()
        {
            //Retreive UITemplates belonging to the current User
            UITemplateService _uiTemplatesService = new UITemplateService(SessionData.LoggedInUser.ID);
            List<BLL.BusinessObjects.UITemplate> uitemplates = _uiTemplatesService.GetByUserID(SessionData.LoggedInUser.ID, true);

            //
            return JsonConvert.SerializeObject(uitemplates);
        }
 public void DeleteUITemplate(int ID)
 {
     //Delete the Model
     UITemplateService _uiTemplatesService = new UITemplateService(SessionData.LoggedInUser.ID);
     _uiTemplatesService.Delete(ID);
 }
        public JsonNetResult LoadData(int configurationID)
        {
            //Data return wrapper
            JsonNetResult result = new JsonNetResult() { };

            //Load Configuration
            ConfigurationService _configurationService = new ConfigurationService(SessionData.LoggedInUser.ID);
            BLL.BusinessObjects.Configuration configuration = _configurationService.GetByID(configurationID);

            //Load Model
            ModelService _modelService = new ModelService(SessionData.LoggedInUser.ID);
            BLL.BusinessObjects.Model model = _modelService.GetByID(configuration.ModelID);

            //Load UITemplate
            UITemplateService _uiTemplatesService = new UITemplateService(SessionData.LoggedInUser.ID);
            BLL.BusinessObjects.UITemplate template = _uiTemplatesService.GetByID(configuration.UITemplateID);

            //Initialize the ConfiguratorSession
            ConfiguratorSession newSession = new ConfiguratorSession(model, configuration, SolverService.CreateNewContext(model));
            SetupFeatureSelections(ref newSession);
            SessionData.ConfiguratorSessions[configurationID] = newSession;

            //Return the data
            var innerObj = new
            {
                ConfigurationObj = configuration,
                ModelObj = model,
                TemplateObj = template
            };
            result.Data = innerObj;
            return result;
        }