/// <summary> /// Update the progress table, this is table client will use to check process and then navigate to /// display top results /// </summary> /// <param name="message"></param> /// <param name="progressCounter"></param> /// <param name="entities"></param> /// <returns></returns> private async Task UpdateProgress(ManagementModel message, int progressCounter, ObjectsModel entities, bool isInError) { //Update Progress table var currentProgress = await _azureService.RetrieveEntityAsync <ProgressEntity>(AppConst.ProgressTable, AppConst.CountProgressPartitionKey, message.ProcessId); var progress = (ProgressEntity)currentProgress.Result; progress.NormalProgress = message.IsGardenSearch ? progress.NormalProgress : progress.NormalProgress + progressCounter; progress.GardenProgress = message.IsGardenSearch ? progress.GardenProgress + progressCounter : progress.GardenProgress; //Update this so if someone added or removed and object the count will still match up at end to indigate process have completed progress.NumberOfNormalObjects = message.IsGardenSearch ? progress.NumberOfNormalObjects : entities.TotaalAantalObjecten; progress.NumberOfGardenObjects = message.IsGardenSearch ? entities.TotaalAantalObjecten : progress.NumberOfGardenObjects; progress.IsNormalSearchDone = progress.NumberOfNormalObjects == progress.NormalProgress && progress.NormalProgress > 0; progress.IsGardenSearchDone = progress.NumberOfGardenObjects == progress.GardenProgress && progress.GardenProgress > 0; if (isInError) { if (!progress.InErrorState) { progress.InErrorState = isInError; } } await _azureService.InsertOrMergeAsync(AppConst.ProgressTable, progress); }
public IActionResult Objects() { var model = new ObjectsModel(); FillBaseModel(model); model.ObjectTypes = _objectTypesService.GetAll(); return(View(model)); }
public static void DeleteModel(ObjectsModel model) { if (File.Exists(model.ResourcePath)) { File.Delete(model.ResourcePath); } GameManager.Instance.objectsModels.Remove(model); }
public void SetData(ObjectsModel objectsModel) { this.objectsModel = objectsModel; Image.sprite = CommonTools.GetSprite(objectsModel.PreviewImage); Title.text = objectsModel.Name; Detail.text = objectsModel.DetailMessage; Integrated.text = objectsModel.Integrated ? "内置物体" : "用户导入物体"; }
public async Task <IActionResult> AddObject(ObjectsModel objectsModel) { var newObject = await _schoolRepository.AddAsync(objectsModel); if (newObject == null) { return(BadRequest(new { error = "Invalid Inputs" })); } return(Ok(newObject)); }
public void CreateControllerXml(string solutionPath) { string modelFile = solutionPath + @"ApartmentRent.WebApp\bin\ApartmentRent.WebApp.dll"; string filePath = solutionPath + @"ApartmentRent.WebApp\Config\controllers.xml"; if (File.Exists(modelFile)) { byte[] fileData = File.ReadAllBytes(modelFile); Assembly assembly = Assembly.Load(fileData); Type[] assemblyTypes = assembly.GetTypes(); var typeList = assemblyTypes.Where(m => m.BaseType.Name.Equals("Controller")); if (typeList != null && typeList.Count() > 0) { XmlUtils xmlUtils = new XmlUtils(); xmlUtils.BeginInitialize(filePath); ObjectsModel objectsModel = new ObjectsModel() { Xmlns = "http://www.springframework.net", }; List <ObjectModel> objectModelList = new List <ObjectModel>(); foreach (var type in typeList) { ObjectModel objectModel = new ObjectModel() { Type = string.Format("{0}, {1}", type.FullName, type.Assembly.FullName.Substring(0, type.Assembly.FullName.IndexOf(','))), Singleton = "false", }; List <PropertyModel> propertyModelList = new List <PropertyModel>(); var propertyInfos = type.GetProperties().Where(o => o.PropertyType.Assembly.FullName.Contains("ApartmentRent.IBLL")); foreach (PropertyInfo propertyInfo in propertyInfos) { propertyModelList.Add(new PropertyModel() { Name = propertyInfo.Name, Reference = propertyInfo.Name, }); } objectModel.PropertyModel = propertyModelList.ToArray(); objectModelList.Add(objectModel); } objectsModel.ObjectModels = objectModelList.ToArray(); if (File.Exists(filePath)) { xmlUtils.EditXmlElementInstance <ObjectsModel>(objectsModel); } else { xmlUtils.AddXmlElementInstance <ObjectsModel>(objectsModel); } xmlUtils.EndInitialize(); } } }
public async Task <IActionResult> UpdateObject(ObjectsModel objectsModel) { if (!ModelState.IsValid) { return(BadRequest(new { error = "Invalid Fields" })); } var entity = await _schoolRepository.UpdateAsync(objectsModel); if (entity == null) { return(BadRequest(new { Error = "Cant update this Entity something went wrong" })); } return(Ok(entity)); }
public void ImportObject() { if (ImportModel.OpenFile()) { ObjectsModel temp = GameManager.Instance.objectsModels.FirstOrDefault(); GameObject tempObject = CreateObject.CreateSingleObj(temp.ResourcePath); SavePreviewImage(temp.ResourcePath); temp.PreviewImage = temp.ResourcePath.Replace(".obj", ".png"); Destroy(tempObject); ChangeButtonColor(ObjectButton); LoadObjects(); } }
public void SetData(BagSelector selector, ObjectsModel objectsModel) { working = 2; this.Delete.gameObject.SetActive(false); this.bagSelector = selector; this.objectsModel = objectsModel; if (!objectsModel.Integrated) { this.Delete.gameObject.SetActive(true); } Title.text = objectsModel.Name; Image.sprite = CommonTools.GetSprite(objectsModel.PreviewImage); }
public override async Task <ObjectsModel> GetObjectsData(ObjectsIdsModel request, ServerCallContext context) { var objects = await _objectGetter.GetObjectsByIds(request.ObjectsIds.ToList()); var objectsModel = new ObjectsModel(); objects.ForEach(o => objectsModel.Objects.Add(new ObjectModel { Id = o.Id, Description = o.Description, Name = o.Name, PhotoUrl = o.Photos.FirstOrDefault() })); return(objectsModel); }
/// <summary> /// 生成主程序 /// </summary> public static void Create(ObjectsModel model) { if (model == null) { return; } RecordManager.tempRecord.showedObject = model; if (model.ResourcePath.EndsWith("obj") || Path.HasExtension(model.ResourcePath)) { CreateObj(); } else { CreatePrefab(); } }
public bool InsertNewObjects(ObjectsModel objects) { using (IDbConnection cnn = new ApplicationDbContext().Database.Connection) { string sql = $"INSERT INTO dbo.Objects(Id) " + $"VALUES ('{objects.Id}')"; int rows = cnn.Execute(sql); if (rows != 1) { return(false); } else { return(true); } } }
public async Task HandleAsync(ManagementModel message) { var apiUrl = Environment.GetEnvironmentVariable("ApiBaseUrl"); var apiKey = Environment.GetEnvironmentVariable("ApiKey"); var request = message.IsGardenSearch ? $"{apiUrl}{apiKey}{AppConst.SearchQuery}/tuin/&page={message.ObjectNumber}&pagesize=25" : $"{apiUrl}{apiKey}{AppConst.SearchQuery}&page={message.ObjectNumber}&pagesize=25"; var progressCounter = 0; var entities = new ObjectsModel(); var isError = false; try { var result = await _restService.GetAsync(request); entities = JsonConvert.DeserializeObject <ObjectsModel>(result); foreach (var item in entities.Objects) { progressCounter++; //Check if Item is available for sale - Not sure if verhuurd will count as not for sale. If it does, can add item.IsVerhuurd if (item.IsVerkocht) { continue; } await ProcessAgentAsync(item, message); } } catch (Exception ex) { progressCounter--; isError = true; //Log this in Application Insights or some logger - see comment in BeginProcessMessageHandler //What also need to still be handled extra in this exception is that when failed, a method similar to ProcessAgent need to remove the counts //of already added. //Or we can keep a temp (cache) record of agents that were succesfully added and make sure on retry they do not get added again. //This is the main reason for not having the functions app retry (see host.json) at this point as there is no current logic to not add duplicates. For now //we just continue and counts will not be updated, so process will not be seen as finished, but we can handle this on the client side for now. } //Update Progress table await UpdateProgress(message, progressCounter, entities, isError); }
public void CreateServiceXml(string solutionPath) { string modelFile = solutionPath + @"ApartmentRent.BLL\bin\Debug\ApartmentRent.BLL.dll"; string filePath = solutionPath + @"ApartmentRent.WebApp\Config\services.xml"; if (File.Exists(modelFile)) { byte[] fileData = File.ReadAllBytes(modelFile); Assembly assembly = Assembly.Load(fileData); Type[] assemblyTypes = assembly.GetTypes(); var typeList = assemblyTypes.Where(m => m.GetInterface("IBaseService", false) != null); if (typeList != null && typeList.Count() > 0) { XmlUtils xmlUtils = new XmlUtils(); xmlUtils.BeginInitialize(filePath); ObjectsModel objectsModel = new ObjectsModel() { Xmlns = "http://www.springframework.net", }; List <ObjectModel> objectModelList = new List <ObjectModel>(); foreach (var type in typeList) { ObjectModel objectModel = new ObjectModel() { Name = type.Name, Type = string.Format("{0}, {1}", type.FullName, type.Assembly.FullName.Substring(0, type.Assembly.FullName.IndexOf(','))), Singleton = "false", }; objectModelList.Add(objectModel); } objectsModel.ObjectModels = objectModelList.ToArray(); if (File.Exists(filePath)) { xmlUtils.EditXmlElementInstance <ObjectsModel>(objectsModel); } else { xmlUtils.AddXmlElementInstance <ObjectsModel>(objectsModel); } xmlUtils.EndInitialize(); } } }
public IHttpActionResult UpdateObjects(ObjectsModel objects) { IDbConnection con = new ApplicationDbContext().Database.Connection; string sql = "UPDATE dbo.Objects " + $"SET Synti = '{objects.Synti}', Box = '{objects.Box}', Barrel = '{objects.Barrel}',Skull = '{objects.Skull}' " + $"WHERE Id = '{objects.Id}'"; try { con.Execute(sql); } catch (Exception e) { return(BadRequest("Error Update objects in database, " + e.Message)); } finally { con.Close(); } return(Ok()); }
//----------------------------------------------------- void Awake() { cdm = new ContextDataModel (); sm = new SceneModel (); sum = new SceneUpgradeModel (); om = new ObjectsModel (this); UsefullEvents.OnResizingWindow += RelocateUI; UsefullEvents.OnResizeWindowEnd += RelocateUI; #if UNITY_IPHONE EtceteraManager.mailComposerFinishedEvent += IOutils.EndMail; #endif }
public ObjectsInstance(ObjectsModel model, ModuleInstance instance) { }
public ObjectsInstance(ObjectsModel model, ModuleInstance instance) { }