public PostIt AddPostIt([FromRoute] int id, [FromBody] PostIt postIt) { var board = this.boards.Find(id); if (board != null) { if (string.IsNullOrWhiteSpace(postIt.Text)) { throw new ArgumentException("The text cannot be empty or whitespace only."); } postIt.CreatedAt = DateTime.Now; postIt.Id = board.PostIts.Count() + 1; while (this.boards.FindPostIt(board, postIt.Id) != null) { postIt.Id++; } board.PostIts.Add(postIt); return(postIt); } return(null); }
public void SetTextMesh(PostIt script) { textToChange = script.text; simpleText = script.simpleText; postit = script; rowLimit = 6; }
public void Initialize(PostIt control) { control.Width = 160; control.Height = 150; Set__Text(control); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); PostIt postIt = new PostIt(new DateTime(2020, 3, 2, 10, 0, 0), "title", "content"); postIt.getPostItAge(new DefaultClock()); }
public async Task<IHttpActionResult> PutPostIt(Guid id, PostIt postIt) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != postIt.PostItGuid) { return BadRequest(); } db.Entry(postIt).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostItExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostPostIt(PostIt postIt) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.PostIt.Add(postIt); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (PostItExists(postIt.PostItGuid)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = postIt.PostItGuid }, postIt); }
private void AddNotes(PostIt notes, bool reloadList) { string[] msg; ListViewItem itm = new ListViewItem(); itm.ImageIndex = notes.Alerte == true ? 1 : 0; itm.Tag = notes.Message; msg = notes.Message.Split('\n'); itm.Text = msg[0].Substring(0, msg[0].Length - 1) + "..."; itm.SubItems.Add(notes.Alerte.ToString()); itm.SubItems.Add(notes.AlerteDateTime.ToString()); itm.SubItems.Add(notes.Date.ToString()); itm.ToolTipText = notes.Message; lvNote.Items.Add(itm); if (reloadList == true) { ReloadPostItList(); } }
static void Main(string[] args) { var postit1 = new PostIt(ConsoleColor.DarkRed, "Idea 1", ConsoleColor.Blue); //postit1.Background = ConsoleColor.DarkRed; //postit1.Text = "Idea 1"; //postit1.Textcolor = ConsoleColor.Blue; Console.BackgroundColor = postit1.Background; Console.ForegroundColor = postit1.Textcolor; Console.WriteLine(postit1.Text); var postit2 = new PostIt(ConsoleColor.Magenta, "Awesome", ConsoleColor.Black); //postit2.Background = ConsoleColor.Magenta; //postit2.Text = "Awesome"; //postit2.Textcolor = ConsoleColor.Black; Console.BackgroundColor = postit2.Background; Console.ForegroundColor = postit2.Textcolor; Console.WriteLine(postit2.Text); var postit3 = new PostIt(ConsoleColor.Yellow, "Superb", ConsoleColor.Green); //postit3.Background = ConsoleColor.Yellow; //postit3.Text = "Superb"; //postit3.Textcolor = ConsoleColor.Green; Console.BackgroundColor = postit3.Background; Console.ForegroundColor = postit3.Textcolor; Console.WriteLine(postit3.Text); Console.ReadLine(); }
public JsonResult CreatePostIt(PostItHelpModel postItHelpModel) { if (ModelState.IsValid) { TimeZone localTime = TimeZone.CurrentTimeZone; Console.WriteLine(localTime.StandardName); using (PostItRepository _postItRepo = new PostItRepository(ApplicationDbContext.Create())) using (CustomerRepository _customerRepository = new CustomerRepository(ApplicationDbContext.Create())) using (EmployeeRepository _employeeRepository = new EmployeeRepository(ApplicationDbContext.Create())) { PostIt postIt = new PostIt() { Title = postItHelpModel.title, From = postItHelpModel.start, To = postItHelpModel.end, Note = postItHelpModel.note, DayOfWeek = postItHelpModel.dayOfWeek, TemplateNo = postItHelpModel.templateNo, CreatedDate = DateTime.Now, CustomerId = postItHelpModel.customerId, EmployeeId = postItHelpModel.employeeId, IsAssigned = true }; _postItRepo.Insert(postIt); _postItRepo.Save(); return(Json(true)); } } return(Json(false)); }
public JsonResult UpdatePostIt(PostItHelpModel postItHelpModel) { if (ModelState.IsValid) { using (PostItRepository _postItRepo = new PostItRepository(ApplicationDbContext.Create())) using (CustomerRepository _customerRepository = new CustomerRepository(ApplicationDbContext.Create())) using (EmployeeRepository _employeeRepository = new EmployeeRepository(ApplicationDbContext.Create())) { PostIt postIt = _postItRepo.Find(postItHelpModel.id); postIt.Title = postItHelpModel.title; postIt.From = postItHelpModel.start; postIt.To = postItHelpModel.end; postIt.CustomerId = postItHelpModel.customerId; postIt.EmployeeId = postItHelpModel.employeeId; postIt.DayOfWeek = postItHelpModel.dayOfWeek; postIt.Note = postItHelpModel.note; postIt.TemplateNo = postItHelpModel.templateNo; postIt.IsAssigned = true; _postItRepo.Update(postIt); _postItRepo.Save(); return(Json(true)); } } return(Json(false)); }
public List <PostIt> GetAll() { List <PostIt> postIts = new List <PostIt>(); try { string sql = "SELECT p.id, p.content, p.color, p.position, p.fontColor FROM postit AS p ORDER BY p.position DESC;"; List <List <object> > result = _dbRepository.ExecuteReader(sql); foreach (List <object> list in result) { long id = Convert.ToInt64(list[0]); string content = list[1].ToString(); SolidColorBrush color = ConvertToColor(list[2]); int position = Convert.ToInt32(list[3]); SolidColorBrush fontColor = ConvertToColor(list[4]); PostIt temp = new PostIt(id, content, color, position, fontColor); postIts.Add(temp); } return(postIts); } catch (Exception ex) { throw ex; } }
static void Main(string[] args) { PostIt Idea1 = new PostIt("orange", "Idea1", "blue"); PostIt Awesome = new PostIt("pink", "Awesome", "black"); PostIt Superb = new PostIt("yellow", "Superb!", "green"); Console.WriteLine(Superb.backgroundColor); }
public ActionResult DeleteConfirmed(int id) { PostIt postIt = db.PostIt.Find(id); db.PostIt.Remove(postIt); db.SaveChanges(); return(RedirectToAction("Index")); }
private void AddPostIt(PostIt pPostIt) { var vm = new ViewModelPostIt(pPostIt); vm.RemovePostIt += RemovePostIt; vm.PropertyChanged += PostItChanged; _postItsViewModels.Add(vm); }
private void OnTriggerExit2D(Collider2D collision) { PostIt postIt = collision.GetComponent <PostIt>(); if (postIt != null) { postIt.currentTarget = null; } }
static void Main(string[] args) { PostIt myFirstObject = new PostIt("orange", "Idea 1", "blue"); PostIt mySecondObject = new PostIt("pink", "Awesome", "black"); PostIt myThirdObject = new PostIt("yellow", "Superb", "green"); Console.WriteLine(myFirstObject.backGroundColor); Console.ReadKey(); }
/* * Create a PostIt a struct that has * a BackgroundColor * a Text on it * a TextColor * Create a few example post-it objects: * an orange with blue text: "Idea 1" * a pink with black text: "Awesome" * a yellow with green text: "Superb!" */ static void Main(string[] args) { PostIt idea1 = new PostIt("orange", "Idea 1", "blue"); PostIt awesome = new PostIt("pink", "Awesome", "black"); PostIt superb = new PostIt("yellow", "Superb", "green"); Console.WriteLine(idea1.backGroundColor); Console.ReadLine(); }
static void Main(string[] args) { PostIt postit1 = new PostIt("orange", "Idea 1", "blue"); PostIt postit2 = new PostIt("pink", "Awesome", "black"); PostIt postit3 = new PostIt("yellow", "Superb!", "green"); Console.WriteLine("An " + postit1.BackgroundColor + " post-it note with " + postit1.TextArea + " written on it in " + postit1.TextColor + " ink."); Console.WriteLine("An " + postit2.BackgroundColor + " post-it note with " + postit2.TextArea + " written on it in " + postit2.TextColor + " ink."); Console.WriteLine("An " + postit3.BackgroundColor + " post-it note with " + postit3.TextArea + " written on it in " + postit3.TextColor + " ink."); }
public ActionResult Edit([Bind(Include = "PostID,ProjectID,PostTopic,PostBody,PostDate,PostNotify,SiteCoID,SiteUserID,PostTime")] PostIt postIt) { if (ModelState.IsValid) { db.Entry(postIt).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(postIt)); }
public void PostPins([FromRoute(Name = "board-id")] int boardId, [FromBody] PostIt postit) { if (boardId <= 0) { throw new ArgumentOutOfRangeException(nameof(boardId), "Board ID must be greater than zero."); } if (!boards.AddPostIt(boardId, postit)) { throw new Exception("Unable to Add Post Its to board"); } }
public ActionResult Create([Bind(Include = "PostID,ProjectID,PostTopic,PostBody,PostDate,PostNotify,SiteCoID,SiteUserID,PostTime")] PostIt postIt) { if (ModelState.IsValid) { db.PostIt.Add(postIt); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(postIt)); }
public bool Contains(PostIt value) { foreach (PostIt s in base.List) { if (value.Equals(s)) { return(true); } } return(false); }
static void Main(string[] args) { PostIt postIt1 = new PostIt("Orange", "Idea 1", "Blue"); PostIt postIt2 = new PostIt("Pink", "Awesome", "Black"); PostIt postIt3 = new PostIt("Yellow", "Superb", "Green"); Console.WriteLine(postIt1.BackgroundColor + ", " + postIt1.Text + ", " + postIt1.TextColor); Console.WriteLine(postIt2.BackgroundColor + ", " + postIt2.Text + ", " + postIt2.TextColor); Console.WriteLine(postIt3.BackgroundColor + ", " + postIt3.Text + ", " + postIt3.TextColor); Console.ReadKey(); }
public PostIt Notes(int index) { PostIt notes = new PostIt { Message = (string)lvNote.Items[index].Tag, Alerte = Convert.ToBoolean(lvNote.Items[index].SubItems[1].Text), AlerteDateTime = DateTime.Parse(lvNote.Items[index].SubItems[2].Text), Date = DateTime.Parse(lvNote.Items[index].SubItems[3].Text) }; return(notes); }
// GET: Common/PostItInfo/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PostIt postIt = db.PostIt.Find(id); if (postIt == null) { return(HttpNotFound()); } return(View(postIt)); }
public static IList <PostIt> MockedPostIts() { IList <PostIt> mockedPosts = new List <PostIt>(); PostIt p1 = new PostIt(1, "shopItem", "Buy 8 onions"); PostIt p2 = new PostIt(1, "message", "Wash the dishes"); PostIt p3 = new PostIt(1, "shopItem", "Buy a new laptop"); PostIt p4 = new PostIt(1, "shopItem", "Buy everything"); mockedPosts.Add(p1); mockedPosts.Add(p2); mockedPosts.Add(p3); mockedPosts.Add(p4); return(mockedPosts); }
// Creates a PostIt for each Color in colors and returns their list public override List <ISpawnableItem> Load() { List <ISpawnableItem> items = new List <ISpawnableItem>(); foreach (Color c in colors) { PostIt newPostIt = new PostIt(); newPostIt.Name = c.ToString(); newPostIt.color = c; newPostIt.GenerateThumbnail(); items.Add(newPostIt); } return(items); }
public JsonResult Post(PostItVm postItVm) { var categoria = _categoriaRepositorio.ObterPor(postItVm.CategoriaId); var quadro = _quadroRepositorio.ObterAtivo(); var tag = new Tag(postItVm.TagNome); var postIt = new PostIt(postItVm.Conteudo, quadro, categoria, tag); _postItRepositorio.Adicionar(postIt); if (_sugestaoDeTagRepositorio.ObterPorTag(tag) == null) _sugestaoDeTagRepositorio.Adicionar(new SugestaoDeTag(tag)); return Json(new { sucesso = true }); }
public void OnPointerDown(BaseEventData eventData) { if (!gameController.enabled || !enabled) { return; } Debug.Log("Spawning PostIt: " + name); draggedPostIt = GameObject.Instantiate(postItPrefab, Input.mousePosition, Quaternion.identity, this.transform.parent) .GetComponent <PostIt>(); draggedPostIt.spawner = this; draggedPostIt.GetComponent <Image>().color = spawnColor; }
public bool Delete(PostIt postIt) { try { string sql = "DELETE FROM postit WHERE id = @id"; SQLiteParameter idParameter = new SQLiteParameter("@id", postIt.Id); _dbRepository.ExecuteNonQuery(sql, idParameter); return(true); } catch (Exception ex) { throw ex; } }
public void Insert(PostIt postIt) { try { string sql = "INSERT INTO postit(content, position) VALUES (@content, @position);"; SQLiteParameter contentParameter = new SQLiteParameter("@content", postIt.Content); SQLiteParameter positionParameter = new SQLiteParameter("@position", postIt.Position); _dbRepository.ExecuteNonQuery(sql, contentParameter, positionParameter); } catch (Exception ex) { throw ex; } }
private void m_btnPoubelle_Click(object sender, System.EventArgs e) { if (CFormAlerte.Afficher(I.T("Remove this Note ?|827"), EFormAlerteType.Question) == DialogResult.Yes) { CResultAErreur result = PostIt.Delete(); if (!result) { CFormAlerte.Afficher(result.Erreur); return; } Hide(); Close(); Dispose(); } }
public PostItData storeOneElement(PostIt postIt) { PostItData postItData = new PostItData(); postItData.texto = postIt.textito.text; postItData.xPos = postIt.transform.position.x; postItData.yPos = postIt.transform.position.y; postItData.ZPos = postIt.transform.position.z; postItData.id = postIt.playerID; arrayPostItData.Add(postItData); return(postItData); }
// Update is called once per frame void Update() { foreach (Collider p in assignedPostIts) { PostIt postIt = p.GetComponent <PostIt>(); if (!postIt.isInHand()) { postIt.gameObject.transform.rotation = gameObject.transform.rotation; postIt.gameObject.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); } else { } } }
public void AddToItems() { foreach (Picture newPicture in Board.master.pictures) { if(newPicture != picture && IsInPicture(newPicture)){ newPicture.pins.Add(this); picture = newPicture; break; } } foreach (PostIt newPostIt in Board.master.postits) { if(newPostIt != postit && IsInPostIt(newPostIt)){ newPostIt.pins.Add(this); postit = newPostIt; break; } } }
public void DelPostIt() { IsSelected = false; List <PostItField> toDelete = PostItFields.Where(x => x.IsFocused).Cast <PostItField>().ToList(); foreach (PostItField pf in toDelete) { PostItFields.Remove(pf); group.Children.Remove(pf); PostIt postIt = new PostIt(pf.Id); postItRepository.Delete(postIt); } PostItFields.ForEach(x => x.textField.IsEnabled = true); SavePostIt(); }
public void RemoveFromItems() { if (picture != null){ if(!IsInPicture(picture)){ picture.pins.Remove(this); if(picture.pins.Count == 0){ Board.master.pictures.Remove(picture); Destroy(picture.gameObject); } picture=null; } } if (postit != null){ if(!IsInPostIt(postit)){ postit.pins.Remove(this); postit = null; } } }
public void Open(PostIt script) { postit = script; }
bool IsInPostIt(PostIt referencePostIt) { Vector2 pinOffset = (Vector2)position - (Vector2)referencePostIt.position; Vector2 normal = new Vector2(Mathf.Cos(referencePostIt.rotation*Mathf.Deg2Rad), Mathf.Sin(referencePostIt.rotation*Mathf.Deg2Rad)); float[] postitSize = {referencePostIt.transform.localScale.x, referencePostIt.transform.localScale.y}; for (int i=0; i<4; i++){ float p = Vector2.Dot(normal, pinOffset); if(p > postitSize[i%2]/2) return false; normal = new Vector2(-normal.y, normal.x); } return true; }
public void Set__Text(PostIt control) { control.Text = RandomData.LoremIpsum(5, 20); }
public void Change__Angle(PostIt control) { control.Angle = control.Angle == 0 ? 30 : 0; }