public ActionResult Update(MActionItem viewModel, FormCollection formCollection) { MActionItem actionItem = _mActionItemRepository.Get(viewModel.Id); TransferFormValuesTo(actionItem, viewModel); actionItem.ItemId = _mItemRepository.Get(formCollection["ItemId"]); actionItem.ModifiedDate = DateTime.Now; actionItem.ModifiedBy = User.Identity.Name; actionItem.DataStatus = EnumDataStatus.Updated.ToString(); _mActionItemRepository.Update(actionItem); try { _mActionItemRepository.DbContext.CommitTransaction(); } catch (Exception e) { _mActionItemRepository.DbContext.RollbackTransaction(); //throw e.GetBaseException(); return(Content(e.GetBaseException().Message)); } return(Content("success")); }
public ActionResult Insert(MActionItem viewModel, FormCollection formCollection) { MActionItem actionItem = new MActionItem(); actionItem.SetAssignedIdTo(Guid.NewGuid().ToString()); TransferFormValuesTo(actionItem, viewModel); actionItem.ItemId = _mItemRepository.Get(formCollection["ItemId"]); actionItem.ActionId = _mActionRepository.Get(formCollection["ActionId"]); actionItem.CreatedDate = DateTime.Now; actionItem.CreatedBy = User.Identity.Name; actionItem.DataStatus = EnumDataStatus.New.ToString(); _mActionItemRepository.Save(actionItem); try { _mActionItemRepository.DbContext.CommitChanges(); } catch (Exception e) { _mActionItemRepository.DbContext.RollbackTransaction(); //throw e.GetBaseException(); return(Content(e.GetBaseException().Message)); } return(Content("success")); }
public ActionResult Delete(MActionItem viewModel) { MActionItem actionItem = _mActionItemRepository.Get(viewModel.Id); if (actionItem != null) { _mActionItemRepository.Delete(actionItem); } try { _mActionItemRepository.DbContext.CommitTransaction(); } catch (Exception e) { _mActionItemRepository.DbContext.RollbackTransaction(); return(Content(e.GetBaseException().Message)); } return(Content("success")); }
private void TransferFormValuesTo(MActionItem actionItem, MActionItem viewModel) { actionItem.ActionItemStatus = viewModel.ActionItemStatus; actionItem.ActionItemDesc = viewModel.ActionItemDesc; actionItem.ActionItemQty = viewModel.ActionItemQty; }
public override EvasObject CreateContent(EvasObject parent) { Box box = new ColoredBox(parent); box.Show(); var naviIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "menu.png"); var appbar = new MBottomAppBar(parent) { NavigationItem = new MActionItem("naviItem", naviIconPath, () => { Console.WriteLine($"Navigation action item clicked"); }) }; appbar.Show(); var airplaneIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "airplane.png"); var alarmIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "alarm.png"); var bluetoothIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "bluetooth.png"); appbar.ActionItems.Add(new MActionItem("airplane", airplaneIconPath, () => { Console.WriteLine($"ariplane"); })); appbar.ActionItems.Add(new MActionItem("alarm", alarmIconPath, () => { Console.WriteLine($"alarm"); })); appbar.ActionItems.Add(new MActionItem("bluetooth", bluetoothIconPath, () => { Console.WriteLine($"bluetooth"); })); var nButton = new MButton(parent) { Text = "add/remove naviitem", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; var item = new MActionItem("new", naviIconPath, () => { Console.WriteLine($"new Navigation action item"); }); nButton.Clicked += (s, e) => { if (appbar.NavigationItem == null) { appbar.NavigationItem = item; } else { appbar.NavigationItem = null; } }; nButton.Show(); var addButton = new MButton(parent) { Text = "add item", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; int itemNum = 1; addButton.Clicked += (s, e) => { var iconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "alarm.png"); appbar.ActionItems.Add(new MActionItem("new item" + itemNum++, iconPath, () => { Console.WriteLine($"new item{itemNum} clicked!!"); }));; }; addButton.Show(); var removeButton = new MButton(parent) { Text = "remove item", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; removeButton.Clicked += (s, e) => { if (appbar.ActionItems.Count > 0) { appbar.ActionItems.RemoveAt(appbar.ActionItems.Count - 1); } }; removeButton.Show(); var lbutton = new MButton(parent) { Text = "layout", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; int layout = 0; lbutton.Clicked += (s, e) => { layout++; if (layout % 3 == 2) { appbar.LayoutOption = BottomAppBarLayoutOption.NoFAB; } else if (layout % 3 == 1) { appbar.LayoutOption = BottomAppBarLayoutOption.EndFAB; } else { appbar.LayoutOption = BottomAppBarLayoutOption.CenteredFAB; } lbutton.Text = "layout: " + appbar.LayoutOption.ToString(); lbutton.MinimumWidth = 400; }; lbutton.Show(); var entry = new MTextField(parent) { AlignmentX = -1, WeightY = 1, Label = "textfield", Text = "click here to show virtual keypad" }; entry.Show(); _conformant.KeyPadOn += (s, e) => { box.UnPack(appbar); }; _conformant.KeyPadOff += (s, e) => { box.PackEnd(appbar); }; MFloatingActionButton fab = new MFloatingActionButton(_conformant); Image img2 = new Image(parent); img2.Load(Path.Combine(MaterialGallery.ResourceDir, "airplane.png")); fab.Icon = img2; appbar.FloatingActionButton = fab; box.PackEnd(nButton); box.PackEnd(lbutton); box.PackEnd(addButton); box.PackEnd(removeButton); box.PackEnd(entry); box.PackEnd(appbar); return(box); }
public override EvasObject CreateContent(EvasObject parent) { Box box = new ColoredBox(parent); box.Show(); var naviIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "menu.png"); var appbar = new MTopAppBar(parent) { Title = "Page title", NavigationItem = new MActionItem("naviItem", naviIconPath, () => { Console.WriteLine($"Navigation action item clicked"); }) }; appbar.Show(); box.PackStart(appbar); var airplaneIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "airplane.png"); var alarmIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "alarm.png"); var bluetoothIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "bluetooth.png"); appbar.ActionItems.Add(new MActionItem("airplane", airplaneIconPath, () => { Console.WriteLine($"ariplane"); })); appbar.ActionItems.Add(new MActionItem("alarm", alarmIconPath, () => { Console.WriteLine($"alarm"); })); appbar.ActionItems.Add(new MActionItem("bluetooth", bluetoothIconPath, () => { Console.WriteLine($"bluetooth"); })); var bButton = new MButton(parent) { Text = "set/unset bg", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; var bFlag = true; bButton.Clicked += (s, e) => { if (bFlag) { appbar.BackgroundOption = BackgroundOptions.Center; appbar.BackgroundImageFile = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "photo.jpg"); } else { appbar.BackgroundImageFile = ""; } bFlag = !bFlag; }; bButton.Show(); var nButton = new MButton(parent) { Text = "add/remove naviitem", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; var item = new MActionItem("new", naviIconPath, () => { Console.WriteLine($"new Navigation action item"); }); nButton.Clicked += (s, e) => { if (appbar.NavigationItem == null) { appbar.NavigationItem = item; } else { appbar.NavigationItem = null; } }; nButton.Show(); var ltButton = new MButton(parent) { Text = "change title", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; bool ltFlag = true; ltButton.Clicked += (s, e) => { if (ltFlag) { appbar.Title = "Page title"; } else { appbar.Title = "Page title looooooooooooooooooooong"; } ltFlag = !ltFlag; }; ltButton.Show(); var tButton = new MButton(parent) { Text = "change title color", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; bool tFlag = true; tButton.Clicked += (s, e) => { if (tFlag) { appbar.TitleColor = Color.Red; } else { appbar.TitleColor = Color.Default; } tFlag = !tFlag; }; tButton.Show(); var pButton = new MButton(parent) { Text = "prominent on/off", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; pButton.Show(); pButton.Clicked += (s, e) => { appbar.Prominent = !appbar.Prominent; }; var addButton = new MButton(parent) { Text = "add item", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; addButton.Clicked += (s, e) => { var iconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "image.png"); appbar.ActionItems.Add(new MActionItem("new item", iconPath, () => { Console.WriteLine($"new item"); })); }; addButton.Show(); var removeButton = new MButton(parent) { Text = "remove item", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; removeButton.Clicked += (s, e) => { if (appbar.ActionItems.Count > 0) { appbar.ActionItems.RemoveAt(appbar.ActionItems.Count - 1); } }; removeButton.Show(); box.PackEnd(bButton); box.PackEnd(pButton); box.PackEnd(nButton); box.PackEnd(ltButton); box.PackEnd(tButton); box.PackEnd(addButton); box.PackEnd(removeButton); return(box); }