// Note: the output of this function is currently treated as mutable. public Dictionary <Locale, string> GetNamesByLocale(int expectedSegments) { TODO.MoreExtensibleFormOfParsingAnnotations(); Dictionary <Locale, string> output = new Dictionary <Locale, string>(); if (annotations != null && this.annotations.ContainsKey("localized")) { foreach (Annotation annotation in this.annotations["localized"]) { if (annotation.Args.Length != 2 || !(annotation.Args[0] is StringConstant) || !(annotation.Args[1] is StringConstant)) { throw this.parser.GenerateParseError( ErrorMessages.LOCALIZED_ANNOTATION_ARGUMENT_MUST_HAVE_2_STRINGS, annotation.FirstToken); } string localeId = ((StringConstant)annotation.Args[0]).Value; string name = ((StringConstant)annotation.Args[1]).Value; int segmentCount = name.Contains('.') ? name.Split('.').Length : 1; if (segmentCount != expectedSegments) { throw this.parser.GenerateParseError( ErrorMessages.LOCALIZED_ANNOTATION_MUST_CONTAIN_SAME_NUMBER_DOTTED_SEGMENTS, annotation.FirstToken); } Locale locale = Locale.Get(localeId); output[locale] = name; } } return(output); }
// Note: the output of this function is currently treated as mutable. public Dictionary <Locale, string> GetNamesByLocale(int expectedSegments) { TODO.MoreExtensibleFormOfParsingAnnotations(); Dictionary <Locale, string> output = new Dictionary <Locale, string>(); if (annotations != null && this.annotations.ContainsKey("localized")) { foreach (Annotation annotation in this.annotations["localized"]) { if (annotation.Args.Length != 2 || !(annotation.Args[0] is StringConstant) || !(annotation.Args[1] is StringConstant)) { throw new ParserException( annotation.FirstToken, "@localized argument must have 2 constant string arguments."); } string localeId = ((StringConstant)annotation.Args[0]).Value; string name = ((StringConstant)annotation.Args[1]).Value; int segmentCount = name.Contains('.') ? name.Split('.').Length : 1; if (segmentCount != expectedSegments) { throw new ParserException( annotation.Args[1].FirstToken, "@localized name must contain the same number of dotted segments as the original definition."); } Locale locale = Locale.Get(localeId); output[locale] = name; } } return(output); }
public void CreateTODO(string descr, Estado est, string ruta, HttpPostedFile adjunto) { try { TODO item = new TODO { Descripcion = descr, Estado = est }; if (!String.IsNullOrEmpty(ruta)) { item.RutaAdjunto = AddAttachment(ruta, adjunto); } else { item.RutaAdjunto = ""; } _context.TODOs.Add(item); Save(); } catch (Exception ex) { throw new Exception("Hubo un error al crear el TODO recibido.", ex); } }
public virtual ActionResult DeleteImageProduct(List <string> checkboxImage, int Id) { var list = new List <ImageProduct>(); var address = Server.MapPath("~/Content/Images/Product/GallerySize/"); foreach (var item in checkboxImage) { list.Add(new ImageProduct { Id = int.Parse(item.Split('/')[0]) }); TODO.DeleteImage(Path.Combine(address, item.Split('/')[1])); } _unitOfWork.RemoveRange <ImageProduct>(list); if (_unitOfWork.SaveAllChanges() > 0) { //Remove Id From Document LuceneProductSearch.ClearLuceneIndexRecord(Id); return(RedirectToAction(actionName: MVC.admin.Product.ActionNames.DetailsProduct, routeValues: new { Id = Id })); } else { ViewData["deleteImageProduct"] = Helperalert.alert(new AlertViewModel { Alert = AlertOperation.SurveyOperation(StatusOperation.Dependencies), Status = AlertMode.info }); return(RedirectToAction(MVC.admin.Product.ActionNames.DeleteImageProduct, new { Id = Id })); } }
private void Hit() { List <GameObject> received = new List <GameObject>(); Collider2D[] collisions = Physics2D.OverlapCircleAll(transform.position, GetComponent <CircleCollider2D>().radius / 2 + 0.1f); foreach (Collider2D collision in collisions) { if (received.Contains(collision.gameObject)) { continue; } received.Add(collision.gameObject); if (collision.CompareTag("Entity")) { collision.GetComponent <Entity>().Regen(); } if (collision.CompareTag("Dragon")) { collision.GetComponentInParent <DragonScript>().leftRegenIterations += 5; } if (collision.CompareTag("Player")) { collision.GetComponent <PlayerController>().Regen(); } TODO.Here(); // Others fire functions } StartCoroutine(Expire()); }
static void Init() { TODO window = (TODO)EditorWindow.GetWindow(typeof(TODO)); window.Show(); window.GetTodoData(); }
public virtual ActionResult CreateSlider(ShowSliderViewModel sliderViewModel) { var file = Request.Files[0]; if (file != null && file.ContentLength > 0) { string fileName = string.Empty; using (var img = Image.FromStream(file.InputStream)) { fileName = TODO.CheckExistFile(Server.MapPath("~/Content/Images/Slider/"), file.FileName); TODO.UploadImage(img, new Size(900, 350), Server.MapPath("~/Content/Images/Slider/"), fileName); } var slider = new Slider { Address = sliderViewModel.AddressSlider, Explain = sliderViewModel.ExplainSlider, Image = fileName, Title = sliderViewModel.TitleSlider }; _sliderService.Create(slider); if (_unitOfWork.SaveAllChanges() > 0) { TempData["createSlider"] = Helperalert.alert(new AlertViewModel { Alert = AlertOperation.SurveyOperation(StatusOperation.SuccsessInsert), Status = AlertMode.success }); return(RedirectToAction(actionName: MVC.admin.Slider.ActionNames.CreateSlider)); } else { TempData["createSlider"] = Helperalert.alert(new AlertViewModel { Alert = AlertOperation.SurveyOperation(StatusOperation.FailInsert), Status = AlertMode.warning }); } } return(View()); }
// PUT api/Tasks/5 public async Task<IHttpActionResult> PutTask(int id, TODO.App.Models.Task task) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != task.id) { return BadRequest(); } db.Entry(task).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaskExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public virtual ActionResult DeleteImageSlider(List <string> checkboxImage) { var listId = new List <Slider>(); var listName = new List <string>(); foreach (var item in checkboxImage) { listId.Add(new Slider { Id = int.Parse(item.Split('/')[0]) }); listName.Add(item.Split('/')[1]); } _unitOfWork.RemoveRange <Slider>(listId); if (_unitOfWork.SaveAllChanges() > 0) { foreach (var item in listName) { TODO.DeleteImage(Server.MapPath("~/Content/Images/Slider/" + item)); } return(PartialView(viewName: MVC.admin.Shared.Views._alert, model: new AlertViewModel { Alert = AlertOperation.SurveyOperation(StatusOperation.SuccsessDelete), Status = AlertMode.success })); } else { return(PartialView(viewName: MVC.admin.Shared.Views._alert, model: new AlertViewModel { Alert = AlertOperation.SurveyOperation(StatusOperation.FailDelete), Status = AlertMode.warning })); } }
private void Hit() { Collider2D[] collisions = Physics2D.OverlapCircleAll(transform.position, GetComponent <CircleCollider2D>().radius + 0.02f); foreach (Collider2D collision in collisions) { if (hits.Contains(collision.gameObject)) { continue; } hits.Add(collision.gameObject); if (collision.CompareTag("Entity")) { collision.GetComponent <Entity>().StoneHit(GetComponent <Rigidbody2D>().velocity); } if (collision.CompareTag("Dragon")) { if (transform.localScale.x > 0.5f) { collision.GetComponent <DragonScript>().Lightning(); collision.GetComponent <DragonScript>().Lightning(); } collision.GetComponentInParent <DragonScript>().StoneHit(GetComponent <Rigidbody2D>().velocity); } if (collision.CompareTag("Player")) { if (transform.localScale.x > 0.5f) { collision.GetComponent <PlayerController>().Lightning(); } //collision.GetComponent<PlayerController>().StoneHit(GetComponent<Rigidbody2D>().velocity); } TODO.Here(); // Others fire functions } }
public HttpResponseMessage Patch(int id, [FromBody] TODO item) { try { var todo = _repo.GetTODObyId(id); if (todo == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } if (item == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "El contenido del item TODO recibido es invalido.")); } if (!_repo.EditEstado(item.Estado, todo)) { return(Request.CreateResponse(HttpStatusCode.BadRequest, $"No se pudo actualizar el estado del TODO {id}")); } return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ex)); } }
public ConstructorDefinition( Token constructorToken, IList <Token> args, IList <Expression> defaultValues, IList <Expression> baseArgs, IList <Executable> code, Token baseToken, TopLevelConstruct owner) : base(constructorToken, owner, owner.FileScope) { this.IsDefault = false; this.ArgNames = args.ToArray(); this.DefaultValues = defaultValues.ToArray(); this.BaseArgs = baseArgs.ToArray(); this.Code = code.ToArray(); this.BaseToken = baseToken; TODO.VerifyDefaultArgumentsAreAtTheEnd(); this.MaxArgCount = this.ArgNames.Length; int minArgCount = 0; for (int i = 0; i < this.ArgNames.Length; ++i) { if (this.DefaultValues[i] == null) { minArgCount++; } else { break; } } this.MinArgCount = minArgCount; }
internal override IList <Executable> Resolve(Parser parser) { parser.ValueStackDepth = 0; this.FunctionID = parser.GetNextFunctionId(); for (int i = 0; i < this.DefaultValues.Length; ++i) { if (this.DefaultValues[i] != null) { this.DefaultValues[i] = this.DefaultValues[i].Resolve(parser); } TODO.RemoveAnnotationsFromParser(); // Annotations not allowed in byte code mode if (this.ArgAnnotations[i] != null) { throw new ParserException(this.ArgAnnotations[i].FirstToken, "Unexpected token: '@'"); } } this.Code = Resolve(parser, this.Code).ToArray(); if (this.Code.Length == 0 || !(this.Code[this.Code.Length - 1] is ReturnStatement)) { List <Executable> newCode = new List <Executable>(this.Code); newCode.Add(new ReturnStatement(this.FirstToken, null, this.FunctionOrClassOwner)); this.Code = newCode.ToArray(); } return(Listify(this)); }
/// <summary> /// Method that update a existence TODO /// </summary> /// <param name="todo">Object that contains the TODO information</param> /// <returns>TODO Updated Object</returns> public TODO DeleteTODO(TODO todo) { todo.State = false; this.db.Entry(todo).State = EntityState.Modified; this.db.SaveChanges(); return(todo); }
public async Task <IActionResult> Edit(Guid id, [Bind("TodoId,CanBeStartedBefore,CategoryId,Deadline,Description,Name,Priority,StartDate,Status,StatusChangeDate,Type")] TODO tODO) { if (id != tODO.TodoId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tODO); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TODOExists(tODO.TodoId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "CategoryId", tODO.CategoryId); return(View(tODO)); }
void Explode() { lightningObject.SetActive(true); GetComponent <SpriteRenderer>().enabled = false; Destroy(GetComponent <Rigidbody2D>()); GetComponent <Collider2D>().enabled = false; List <GameObject> received = new List <GameObject>(); Collider2D[] collisions = Physics2D.OverlapCircleAll(transform.position, explodeRadius / 2); foreach (Collider2D collision in collisions) { if (received.Contains(collision.gameObject)) { continue; } received.Add(collision.gameObject); if (collision.CompareTag("Entity")) { collision.GetComponent <Entity>().Lightning(); } if (collision.CompareTag("Dragon")) { collision.GetComponentInParent <DragonScript>().Lightning(); } if (collision.CompareTag("Player")) { collision.GetComponent <PlayerController>().Lightning(); } TODO.Here(); // Others fire functions } StartCoroutine(DecayParticles()); }
public async Task <IActionResult> PutToDo(int id, TODO itemToDo) { if (id != itemToDo.Id) { return(BadRequest()); } try { await _toDoService.UpdateAsync(itemToDo); } catch (DbUpdateConcurrencyException) { if (!await _toDoService.ExistAsync(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IActionResult CreateTODO(TODO todo) { try { if (todo == null) { throw new ArgumentNullException("The todo is null", nameof(todo)); } this.todoBusiness.CreateTODO(todo); response = new APIResponse { HttpResponseNumber = (int)HttpStatusCode.Created, HttpResponse = HttpStatusCode.Created.ToString(), SuccessfullResponse = todo }; } catch (Exception ex) { response = new APIResponse { HttpResponseNumber = (int)HttpStatusCode.InternalServerError, HttpResponse = HttpStatusCode.InternalServerError.ToString(), ErrorResponse = ex.Message.ToString() }; } return(Ok(response)); }
internal void SetArgs(IList <Token> argNames, IList <Expression> defaultValues, IList <AType> argTypes) { this.ArgNames = argNames.ToArray(); this.DefaultValues = defaultValues.ToArray(); this.ArgTypes = argTypes.ToArray(); TODO.VerifyDefaultArgumentsAreAtTheEnd(); this.MaxArgCount = this.ArgNames.Length; int minArgCount = 0; for (int i = 0; i < this.ArgNames.Length; ++i) { if (this.DefaultValues[i] == null) { minArgCount++; } else { break; } } this.MinArgCount = minArgCount; this.ArgumentNameLookup = new HashSet <string>(this.ArgNames.Select(a => a.Value)); }
public async Task <ActionResult <TODO> > Post([FromBody] TODO item) { _myContext.Set <TODO>().Add(item); await _myContext.SaveChangesAsync(); return(CreatedAtAction("Get", new { id = item.Id }, item)); }
public TODO Add(string content) { TODO tODO = new TODO { Content = content, Date = DateTime.Today }; return(repository.Add(tODO)); }
public override void TranslateConvertRawDictionaryValueCollectionToAReusableValueList(StringBuilder sb, Expression dictionary) { TODO.PleaseRenameThisFunction(); sb.Append("new FastList().initializeValueCollection("); this.TranslateExpression(sb, dictionary); sb.Append(')'); }
public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddEntityFrameworkMySql() .AddDbContext <ProjectNameContext>(options => options TODO .UseMySql(Configuration["ConnectionStrings:DefaultConnection"])); }
public TODOdTO Convert(TODO todo) { TODOdTO dto = new TODOdTO { Id = todo.Id, Content = todo.Content, Date = todo.Date }; return(dto); }
public override bool PreExecute() { using var executor = new ServiceExecutorManager <IGetTodoItemSvc>(_getTodoItemSvc); return(executor.SetRequest(o => o.Request = Request) .OnExecuted(o => { _exists = o.Result; return true; })); }
private LibraryExporter(LibraryMetadata metadata, Platform.AbstractPlatform platform) { TODO.LibrariesNeedVersionNumber(); this.Metadata = metadata; this.platformName = platform.Name; this.Resources = new LibraryResourceDatabase(this, platform); this.CompileTimeConstants = this.LoadFlagsForPlatform(platform); this.filepathsByFunctionName = new Dictionary <string, string>(); // Build a lookup dictionary of all file names that are simple function names e.g. "foo.cry" // Then go through and look up all the file names that contain . prefixes with the platform name and // overwrite the lookup value for that entry with the more specific path. // myFunction.cry // android.myFunction.cry // on Python, myFunction will be included for lib_foo_myFunction(), but on Android, android.myFunction.cry will be included instead. string[] files = new string[0]; if (FileUtil.DirectoryExists(this.Metadata.Directory + "/translate")) { files = FileUtil.DirectoryListFileNames(FileUtil.JoinPath(this.Metadata.Directory, "translate")); } Dictionary <string, string> moreSpecificFiles = new Dictionary <string, string>(); foreach (string file in files) { if (file.EndsWith(".pst")) { string functionName = file.Substring(0, file.Length - ".pst".Length); if (functionName.Contains('.')) { // Add this file to the more specific lookup, but only if it contains the current platform. if (functionName.StartsWith(platformName + ".") || functionName.Contains("." + platformName + ".")) { string[] parts = functionName.Split('.'); moreSpecificFiles[parts[parts.Length - 1]] = file; } else { // just let it get filtered away. } } else { this.filepathsByFunctionName[functionName] = file; } } } foreach (string functionName in moreSpecificFiles.Keys) { this.filepathsByFunctionName[functionName] = moreSpecificFiles[functionName]; } }
public ActionResult DeleteConfirmed(int id) { TODO tODO = db.TODOS.Find(id); TODO_MIRROR tODO_MIRROR = db.TODO_MIRRORS.Find(id); db.TODOS.Remove(tODO); db.TODO_MIRRORS.Remove(tODO_MIRROR); db.SaveChanges(); return(RedirectToAction("Index")); }
private LibraryExporter(AssemblyMetadata metadata, Platform.AbstractPlatform platform) { TODO.LibrariesNeedVersionNumber(); this.Metadata = metadata; this.platformName = platform.Name; this.Resources = new LibraryResourceDatabase(this, platform); this.CompileTimeConstants = this.LoadFlagsForPlatform(platform); }
public ActionResult Edit([Bind(Include = "ID,NAME,DESCRIPTION")] TODO tODO, TODO_MIRROR tODO_MIRROR) { if (ModelState.IsValid) { db.Entry(tODO).State = EntityState.Modified; db.Entry(tODO_MIRROR).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tODO)); }
public async Task <ActionResult <TODO> > Put(int id, TODO todo) { if (todo.Id != id) { return(BadRequest()); } _myContext.Entry(todo).State = EntityState.Modified; await _myContext.SaveChangesAsync(); return(NoContent()); }
public async Task<IHttpActionResult> PostTask(TODO.App.Models.Task task) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Tasks.Add(task); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = task.id }, task); }
public ActionResult Create([Bind(Include = "ID,NAME,DESCRIPTION")] TODO tODO, TODO_MIRROR tODO_MIRROR) { if (ModelState.IsValid) { db.TODOS.Add(tODO); db.TODO_MIRRORS.Add(tODO_MIRROR); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tODO)); }