public ActionResult Edit(int id, TEdit model) { var svc = CreateTipService(); try { if (!ModelState.IsValid) { return(View(model)); } else if (svc.UpdateTip(model, id)) { TempData["SaveResult"] = " Your tip was updated."; return(RedirectToAction("Index")); } } catch { if (model.TipId != id) { ModelState.AddModelError("", "Tip ID Missmatch"); return(View(model)); } } return(View(model)); }
public Hidemaru() { System.Diagnostics.FileVersionInfo vi = System.Diagnostics.FileVersionInfo.GetVersionInfo(strExecuteFullpath); _ver = 100 * vi.FileMajorPart + 10 * vi.FileMinorPart + 1 * vi.FileBuildPart + 0.01 * vi.FilePrivatePart; SetUnManagedDll(); Edit = new TEdit(); Macro = new TMacro(); }
// Update // GET: Edit (Update) // Tip/Edit/{id} public ActionResult Edit(int id) { var service = CreateTipService(); var detail = service.GetTipById(id); var model = new TEdit { Title = detail.Title, Text = detail.Text }; return(View(model)); }
//TEST public bool UpdateTCompletedBy(TEdit model) { using (var ctx = new ApplicationDbContext()) { TamcTymcSamples entity = ctx.TamcTymcSamples.SingleOrDefault(e => e.TId == model.TId); //entity.DueOnDate = model.DueOnDate; entity.CompletedOnDate = DateTime.Now; entity.IsComplete = true; entity.EmployeeId = model.EmployeeId; return(ctx.SaveChanges() == 1); } }
protected TEdit CreateEdit <TEdit>() where TEdit : Control, new() { var edit = new TEdit { Dock = DockStyle.Fill }; edit.KeyDown += (s, e) => OnKeyDown(e); GotFocus += (s, e) => edit.Focus(); Controls.Add(edit); _editor = edit; return(edit); }
//GET: TamcTymc/Edit/{id} public ActionResult Edit(int id) { TDetail detail = service.GetTById(id); TEdit model = new TEdit { TId = detail.TId, IsComplete = detail.IsComplete, DueOnDate = detail.DueOnDate, //CompletedOnDate = detail.CompletedOnDate //Should I add employee here? }; return(View(model)); }
// Update public bool UpdateTip(TEdit model, int id) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .Tips .Single(e => e.TipId == id && e.Id == _userId); entity.Title = model.Title; entity.Text = model.Text; return(ctx.SaveChanges() == 1); } }
private void Button1_Click(object sender, EventArgs e) { string text = this.SelectGroupName.Text; if (StringType.StrCmp(text, "Select Group A", false) == 0) { TEdit tag = (TEdit)this.Tag; tag.Selected_Terrain_A = (ClsTerrain)this.SelectGroup.SelectedItem; tag.MenuTerrainA.Text = string.Format("Select Terrain A - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, null, "Name", new object[0], null, null))); tag = null; } else if (StringType.StrCmp(text, "Select Group B", false) == 0) { TEdit selectedItem = (TEdit)this.Tag; selectedItem.Selected_Terrain_B = (ClsTerrain)this.SelectGroup.SelectedItem; selectedItem.MenuTerrainB.Text = string.Format("Select Terrain B - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, null, "Name", new object[0], null, null))); selectedItem = null; } else if (StringType.StrCmp(text, "Select Group C", false) == 0) { TEdit tEdit = (TEdit)this.Tag; tEdit.Selected_Terrain_C = (ClsTerrain)this.SelectGroup.SelectedItem; tEdit.MenuTerrainC.Text = string.Format("Select Terrain C - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, null, "Name", new object[0], null, null))); tEdit = null; } else if (StringType.StrCmp(text, "Clone Group A", false) == 0) { TEdit tag1 = (TEdit)this.Tag; tag1.Selected_Terrain_A = (ClsTerrain)this.SelectGroup.SelectedItem; tag1.Menu_CloneGroupA.Text = string.Format("Select Terrain A - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, null, "Name", new object[0], null, null))); tag1 = null; } else if (StringType.StrCmp(text, "Clone Group B", false) == 0) { TEdit selectedItem1 = (TEdit)this.Tag; selectedItem1.Selected_Terrain_B = (ClsTerrain)this.SelectGroup.SelectedItem; selectedItem1.Menu_CloneGroupB.Text = string.Format("Select Terrain B - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, null, "Name", new object[0], null, null))); selectedItem1 = null; } this.Close(); }
public ActionResult Edit(int id, TEdit model) { if (!ModelState.IsValid) { return(View(model)); } if (model.TId != id) { ModelState.AddModelError("", "ID does not match."); return(View(model)); } if (service.UpdateT(model)) { TempData["SaveTResult"] = $"Tamc/Tymc Sample {service.GetTById(id).DueOnDate.ToLongDateString()} was updated."; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Tamc/Tymc Sample date could not be updated."); return(View()); }
void _wvm_RequestScroll(object sender, TEdit.Framework.Events.EventArgs<ScrollDirection> e) { float x = _scrollPosition.X; float y = _scrollPosition.Y; float inc = 1 / _zoom * 10; switch (e.Value1) { case ScrollDirection.Up: y += inc; break; case ScrollDirection.Down: y -= inc; break; case ScrollDirection.Left: x += inc; break; case ScrollDirection.Right: x -= inc; break; } _scrollPosition = new Vector2(x, y); ClampScroll(); }
void _wvm_RequestZoom(object sender, TEdit.Framework.Events.EventArgs<bool> e) { if (e.Value1) { Zoom(1); } else { Zoom(-1); } }
public void HelloWorld() { Application = new TApplication(null); Application.Initialize(); Application.Run(); // Create form var lForm = new TForm(null); lForm.Width = 800; // we can display the form in an existing div element. If Show parameter is nil, a new div is created lForm.Show(null); var lTopLabel = new TLabel(lForm); lTopLabel.Left = 1; lTopLabel.Parent = lForm; lTopLabel.Caption = "Write the item caption on the edit and press Add New button to add to ListBox:"; var lButton = new TButton(lForm); lButton.Left = 50; lButton.Top = 50; lButton.Caption = "Add New"; lButton.Parent = lForm; var lEdit = new TEdit(lForm); lEdit.Left = 150; lEdit.Top = 50; lEdit.Parent = lForm; var lListBox = new TListBox(lForm); lListBox.Left = 350; lListBox.Top = 50; lListBox.Parent = lForm; lListBox.Width = 250; lListBox.MultiSelect = true; lButton.OnClick = (s) => { lListBox.Items.Add(lEdit.Text); }; var lChangeLabel = new TLabel(lForm); lChangeLabel.Top = 165; lChangeLabel.Parent = lForm; lChangeLabel.Caption = "Press button to change label font:"; var lChangeButton = new TButton(lForm); lChangeButton.Left = 50; lChangeButton.Top = 200; lChangeButton.Caption = "Change font"; lChangeButton.Parent = lForm; var lLabel = new TLabel(lForm); lLabel.Left = 150; lLabel.Top = 200; lLabel.Caption = "Sample text!"; lLabel.Parent = lForm; lChangeButton.OnClick = (s) => { lLabel.Font.Name = "Verdana"; lLabel.Font.Size = 24; }; var lMemo = new TMemo(lForm); lMemo.Left = 50; lMemo.Top = 300; lMemo.Width = 250; lMemo.Height = 150; lMemo.Parent = lForm; var lMemoButton = new TButton(lForm); lMemoButton.Left = 350; lMemoButton.Top = 325; lMemoButton.Caption = "Add text"; lMemoButton.Parent = lForm; var lList = TStringList.Create(); lList.Add("one line"); lList.Add("another one"); lMemoButton.OnClick = (s) => { lMemo.Lines.AddStrings(lList); }; var lDisplayButton = new TButton(lForm); lDisplayButton.Top = lMemoButton.Top; lDisplayButton.Left = 450; lDisplayButton.Caption = "Show memo text"; lDisplayButton.Parent = lForm; lDisplayButton.OnClick = (s) => { ShowMessage(lMemo.Lines.Text); }; }