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;
        }
예제 #2
0
        public string GetModels()
        {
            //Retreive Models belonging to the current User
            ModelService _modelService = new ModelService(SessionData.LoggedInUser.ID);
            List<BLL.BusinessObjects.Model> models = _modelService.GetByUserID_Shallow(SessionData.LoggedInUser.ID);

            //
            return JsonConvert.SerializeObject(models);
        }
        public JsonNetResult LoadData(int modelID)
        {
            //Data return controlTagElem
            JsonNetResult result = new JsonNetResult();

            //Model
            ModelService _modelService = new ModelService(SessionData.LoggedInUser.ID);
            BLL.BusinessObjects.Model model = _modelService.GetByID(modelID);
            result.Data = model;

            return result;
        }
예제 #4
0
        public JsonNetResult GetModels()
        {
            //Default return variable
            JsonNetResult result = new JsonNetResult() { Data = null };

            //Retreive Models belonging to the current User
            ModelService _modelService = new ModelService(SessionData.LoggedInUser.ID);
            List<BLL.BusinessObjects.Model> models = _modelService.GetByUserID_Shallow(SessionData.LoggedInUser.ID);
            result.Data = models;

            //
            return result;
        }
예제 #5
0
        public JsonNetResult AddNewModel()
        {
            //Default return variable
            JsonNetResult result = new JsonNetResult() { Data = null };

            //Add a new Model
            ModelService modelService = new ModelService(SessionData.LoggedInUser.ID);
            BLL.BusinessObjects.Model newModel = (BLL.BusinessObjects.Model) modelService.CreateDefault();
            modelService.Add(newModel);

            //
            result.Data = newModel;
            return result;
        }
        public void SaveModel(int modelID, string modelName)
        {
            //Create services
            ModelService _modelService = new ModelService(SessionData.LoggedInUser.ID);

            //Save changes to Model
            _modelService.UpdateName(modelID, modelName);
        }
예제 #7
0
 public void DeleteModel(int ID)
 {
     //Delete the Model
     ModelService modelService = new ModelService(SessionData.LoggedInUser.ID);
     modelService.Delete(ID);
 }