/// <summary> /// Sự kiện xảy ra khi thực hiện các thao tác trên danh sách người dùng /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void grvListGroups_RowCommand(object sender, GridViewCommandEventArgs e) { //-- Xóa nhóm người dùng if (e.CommandName.Equals("cmdDelete", StringComparison.OrdinalIgnoreCase)) { BGroup ctl = new BGroup(); try { //-- THực hiện xóa nhóm người dùng ctl.Delete(int.Parse((e.CommandArgument.ToString()))); //--Load lại danh sách nhóm người dùng BindData(); } catch (Exception ex) { //--Load lại danh sách nhóm người dùng BindData(); } } //--Cập nhật nhóm người dùng else if (e.CommandName.Equals("cmdEdit", StringComparison.OrdinalIgnoreCase)) { Response.Redirect("EditGroup.aspx?GroupId=" + e.CommandArgument.ToString()); } }
/// <summary> /// Sự kiện xảy ra khi thực hiện các thao tác trên danh sách người dùng /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void grvListGroups_RowCommand(object sender, GridViewCommandEventArgs e) { //-- Xóa nhóm người dùng if (e.CommandName.Equals("cmdDelete", StringComparison.OrdinalIgnoreCase)) { BGroup ctl = new BGroup(); try { BUserGroup ctlBu = new BUserGroup(); OUserGroup objUG = new OUserGroup(); objUG.IDGroup = int.Parse((e.CommandArgument.ToString())); objUG.IDUser = 0; if (ctlBu.Get(objUG).Count > 0) { RegisterClientScriptBlock("notif", "<script language='javascript'>alert('Không thể xóa nhóm do có người dùng tồn tại trong nhóm');</script>"); } //-- THực hiện xóa nhóm người dùng ctl.Delete(int.Parse((e.CommandArgument.ToString()))); //--Load lại danh sách nhóm người dùng BindData(); } catch (Exception ex) { //--Load lại danh sách nhóm người dùng BindData(); } } //--Cập nhật nhóm người dùng else if (e.CommandName.Equals("cmdEdit", StringComparison.OrdinalIgnoreCase)) { Response.Redirect("EditGroup.aspx?GroupId=" + e.CommandArgument.ToString()); } }
/// <summary> /// Initialisation des donnée sur la SideBar. /// </summary> protected override void initializeSideBarData() { List <BrowserData> designs = Service.getBrowserDatas(); ((DesignerSideBar)SideBar).DesignerGroup.DesignerTreeview.fillTree(new ObservableCollection <BrowserData>(designs)); ((DesignerSideBar)SideBar).EntityGroup.InitializeData(); ((DesignerSideBar)SideBar).MeasureGroup.InitializeMeasure(); ((DesignerSideBar)SideBar).PeriodGroup.InitializeData(); List <Kernel.Domain.CalculatedMeasure> CalculatedMeasures = GetDesignService().CalculatedMeasureService.getAllCalculatedMeasure(); if (CalculatedMeasures != null) { ((DesignerSideBar)SideBar).CalculateMeasureGroup.CalculatedMeasureTreeview.fillTree(new ObservableCollection <CalculatedMeasure>(CalculatedMeasures)); } Target targetAll = GetDesignService().ModelService.getTargetAll(); List <Target> targets = new List <Target>(0); targets.Add(targetAll); ((DesignerSideBar)SideBar).TargetGroup.TargetTreeview.DisplayTargets(targets); List <Target> CustomizedTargets = GetDesignService().TargetService.getAll(); ((DesignerSideBar)SideBar).CustomizedTargetGroup.TargetTreeview.fillTree(new ObservableCollection <Target>(CustomizedTargets)); BGroup group = GetDesignService().GroupService.getDefaultGroup(); }
protected override void initializeSideBarData() { List <BrowserData> datas = this.GetTransformationTreeService().getBrowserDatas(); ((TransformationTreeSideBar)SideBar).TransformationTreeGroup.TransformationTreeTreeview.fillTree(new ObservableCollection <BrowserData>(datas)); BGroup group = GetTransformationTreeService().GroupService.getDefaultGroup(); }
private void OnExitEditMode(object sender, EO.Wpf.EditItemEventArgs e) { if (e.Item is BGroup) { BGroup group = (BGroup)e.Item; string name = e.Text.Trim(); if (string.IsNullOrEmpty(name)) { Kernel.Util.MessageDisplayer.DisplayError("Empty group", "Group can't be empty! "); e.Canceled = true; return; } BGroup m = (BGroup)Root.GetChildByName(name); if (m != null && m.Equals(group)) { e.Canceled = true; return; } if (m != null && !m.Equals(group)) { Kernel.Util.MessageDisplayer.DisplayError("Duplicate group", name + " already exists!"); e.Canceled = true; return; } group.name = name; group.parent.UpdateChild(group); SaveGroup(group); if (Changed != null) { Changed(); } } //The event must be canceled, otherwise the TreeView will //set the TreeViewItem's Header to the new text e.Canceled = true; }
public override OperationState RenameItem(string newName) { Object selection = GetBrowser().Form.Grid.SelectedItem; if (selection == null) { return(OperationState.STOP); } BrowserData data = (BrowserData)selection; BGroup group = ((GroupService)Service).getGroupByNameAndType(newName, data.group); if (group != null && group.oid.HasValue && group.oid.Value != data.oid) { DisplayError("Rename ", "There is another group named : " + newName); return(OperationState.STOP); } try { Service.Rename(data.oid, newName); Search(); } catch (Domain.BcephalException) { DisplayError("Unable to rename group", "Unable to rename group : " + newName); return(OperationState.STOP); } return(OperationState.CONTINUE); }
/// <summary> /// Khởi tạo dữ liệu /// </summary> private void InitData() { BGroup ctl = new BGroup(); OGroup obj = new OGroup(); try { //-- kiểm tra và lấy về nhóm người dùng cần sửa if (GroupId > 0) { obj = ctl.Get(GroupId)[0]; } else { return; } txtDescription.Text = obj.Description; txtName.Text = obj.Name; txtName.Visible = false; lblName.Text = obj.Name; lblName.Visible = true; } catch (Exception ex) { } }
/// <summary> /// Load danh sách nhóm người dùng /// </summary> private void BindGroup() { BGroup ctl = new BGroup(); ddlGroup.DataSource = ctl.Get(0); ddlGroup.DataBind(); }
public GroupResult Edit(int id, BGroup bGroup) { var groupResult = new GroupResult(); using (_context = new GroupsManagementDbEntities()) { using (var transaction = _context.Database.BeginTransaction()) { try { Group group = _context.Groups.Find(id); group.Name = bGroup.Name; _context.SaveChanges(); transaction.Commit(); groupResult.bGroups.Add(new BGroup { GroupId = group.GroupId, Name = group.Name }); } catch (Exception e) { groupResult.IsValid = false; groupResult.ErrorMessages.Add(e.Message); } } } return(groupResult); }
/// <summary> /// Khởi tạo dữ liệu /// </summary> private void InitData() { BUser ctlUP = new BUser(); if (!Global.IsAdmin()) { Response.Redirect("/permission-fail.aspx"); } BGroup ctl = new BGroup(); OGroup obj = new OGroup(); try { //-- kiểm tra và lấy về nhóm người dùng cần sửa if (GroupId > 0) { obj = ctl.Get(GroupId)[0]; } else { return; } txtDescription.Text = obj.Description; txtName.Text = obj.Name; txtName.Visible = true; lblName.Text = obj.Name; lblName.Visible = false; } catch (Exception ex) { } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] BGroup bGroup) { if (id != bGroup.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bGroup); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BGroupExists(bGroup.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(bGroup)); }
public async Task <ActionResult> DeleteConfirmed(int id) { BGroup bGroup = await db.BGroups.FindAsync(id); db.BGroups.Remove(bGroup); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public void correctGroup(Kernel.Domain.CombinedTransformationTree combined) { if (GroupService != null) { int oidG = (int)combined.group.oid; BGroup gr = (BGroup)GroupService.getByOid(oidG); combined.group = gr; } }
protected void onGroupFieldChange() { ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage(); string name = page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.groupField.textBox.Text; BGroup group = page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.groupField.Group; ((ReconciliationFilterTemplateSideBar)SideBar).TemplateGroup.TemplateTreeview.updateTemplate(name, page.Title, true); page.EditedObject.group = group; OnChange(); }
/// <summary> /// Initialisation des donnée sur la SideBar. /// </summary> protected override void initializeSideBarData() { List <Target> targets = Service.getAll(); ((TargetSideBar)SideBar).TargetGroup.TargetTreeview.fillTree(new ObservableCollection <Target>(targets)); ((TargetSideBar)SideBar).EntityGroup.InitializeData(); BGroup group = GetTargetService().GroupService.getDefaultGroup(); }
public static BGroup ConvertGroupToBGroup(Group group) { BGroup bGroup = new BGroup() { GroupId = group.GroupId, Name = group.Name }; return(bGroup); }
private void GroupList_SelectionChanged(object sender, SelectionChangedEventArgs e) { var lbx = (ListBox)sender; if (lbx.SelectedItem != null) { checkedBox = (BGroup)lbx.SelectedItem; GVM.Name = checkedBox.Gname; GVM.Describe = checkedBox.Gdescribe; } }
/// <summary> /// call delete group service /// </summary> /// <param name="group"></param> protected void DeleteGroup(BGroup group) { if (group != null) { foreach (BGroup child in group.childrenListChangeHandler.Items) { DeleteGroup(child); } GroupService.delete(group); } }
protected void onGroupFieldChange() { TransformationTreeEditorItem page = (TransformationTreeEditorItem)getTransformationTreeEditor().getActivePage(); string name = page.GetTransformationTreeForm().TransformationTreePropertiePanel.groupField.textBox.Text; BGroup group = page.GetTransformationTreeForm().TransformationTreePropertiePanel.groupField.Group; page.EditedObject.group = group; ((TransformationTreeSideBar)SideBar).TransformationTreeGroup.TransformationTreeTreeview.updateTransformationTree(name, page.Title, true); //page.GetTransformationTreeForm().TransformationTreePropertiePanel.displayTransformationTree(tree); page.EditedObject.isModified = true; }
public async Task <IActionResult> Create([Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] BGroup bGroup) { if (ModelState.IsValid) { _context.Add(bGroup); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bGroup)); }
protected void onGroupFieldChange() { string name = groupField.textBox.Text; BGroup group = groupField.Group; this.EditedObject.group = group; if (ItemChanged != null) { ItemChanged(this.EditedObject); } }
public async Task <ActionResult> Edit([Bind(Include = "Id,Code,Description")] BGroup bGroup) { if (ModelState.IsValid) { db.Entry(bGroup).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(bGroup)); }
/// <summary> /// Cette méthode permet de couper un élément sélectionné dans le treeview /// Lorsqu'on clique sur le menu contextuelle cut, /// la variable CurrentCutObjet prend la valeur de l'élément selectionné /// et une copie de cette dernière est placé dans le presse-papier. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnCutNode(object sender, RoutedEventArgs e) { BGroup group = GetSelectedGroup(); CurrentCutObject = group; if (group != null) { List <Domain.BGroup> grps = new List <BGroup>(0); grps.Add(group); Kernel.Util.ClipbordUtil.SetGroups(grps.ToList <Object>()); } }
protected override void initializeSideBarData() { List <Kernel.Domain.Browser.BrowserData> datas = this.Service.getBrowserDatas(); ((PresentationSideBar)SideBar).PresentationGroup.PresentationTreeView.fillTree(new ObservableCollection <Kernel.Domain.Browser.BrowserData>(datas)); ((PresentationSideBar)SideBar).MeasureGroup.InitializeMeasure(); ((PresentationSideBar)SideBar).SpecialGroup.SpecialTreeView.Items.RemoveAt(1); BGroup group = GetPresentationService().GroupService.getDefaultGroup(); }
private void OnEnterEditMode(object sender, EO.Wpf.EditItemEventArgs e) { if (e.Item is BGroup) { BGroup group = (BGroup)e.Item; if (group.IsDefaultGroup) { e.Canceled = true; return; } e.Text = group.name; } }
public async Task <ActionResult> Create([Bind(Include = "Id,Code,Description")] BGroup bGroup) { if (ModelState.IsValid) { db.BGroups.Add(bGroup); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(bGroup)); }
/// <summary> /// Cette méthode permet de désactiver un menuItem dans le cas /// où l'opération associée à ce menuItem n'est pas possible pour /// le noeud courant. /// </summary> /// <param name="e"></param> protected override void OnContextMenuOpening(ContextMenuEventArgs e) { BGroup selectedItem = GetSelectedGroup(); bool isDefaultGroup = selectedItem != null && selectedItem.IsDefaultGroup; this.newMenuItem.IsEnabled = this.Root != null && !isDefaultGroup; this.deleteMenuItem.IsEnabled = this.Root != null && selectedItem != null && !selectedItem.IsDefaultGroup && selectedItem.parent != null; this.copyMenuItem.IsEnabled = this.Root != null && selectedItem != null && selectedItem.parent != null; this.pasteMenuItem.IsEnabled = this.Root != null && selectedItem != null && !Kernel.Util.ClipbordUtil.IsClipBoardEmptyGroup() && !isDefaultGroup; this.indentMenuItem.IsEnabled = this.Root != null && selectedItem != null && selectedItem.GetPosition() > 0 && selectedItem.parent != null && !isDefaultGroup; this.outdentMenuItem.IsEnabled = this.Root != null && selectedItem != null && selectedItem.parent != null && selectedItem.GetParent() != Root; }
/// <summary> /// Bind danh sách nhóm người dùng /// </summary> private void BindData() { BUser ctlUP = new BUser(); if (!Global.IsAdmin()) { Response.Redirect("/permission-fail.aspx"); } BGroup ctl = new BGroup(); grvListGroups.DataSource = ctl.Get(0); grvListGroups.DataBind(); }
/// <summary> /// Cette methode permet la copie d'un élément sélectionné dans le treeview /// Après la séléction de l'objet, un copie de cet objet est placée dans le presse-papiers /// en attente d'être collé. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnCopyNode(object sender, RoutedEventArgs e) { BGroup group = GetSelectedGroup(); if (group != null) { List <Domain.BGroup> grps = new List <BGroup>(0); grps.Add(group); //IHierarchyObject copy = group.GetCopy(); Kernel.Util.ClipbordUtil.SetGroups(grps.ToList <Object>()); } CurrentCutObject = null; }
/// <summary> /// Crée une nouvelle instance de GroupTreeView /// </summary> public GroupTreeView() { InitializeComponent(); this.Focusable = true; this.BorderBrush = Brushes.White; InitializeDataTemplate(); InitializeHandlers(); InitializeContextMenu(); this.Root = new Domain.BGroup(); defaultValue = new Domain.BGroup(); defaultValue.name = SubjectType.DEFAULT.label; subjectType = SubjectType.DEFAULT; }