Esempio n. 1
0
 protected void grid_OnDeleteCommand(object sender, GridCommandEventArgs e)
 {
     try
     {
         var item = (e.Item as GridEditableItem);
     // ReSharper disable PossibleNullReferenceException
         var roleId = Guid.Parse(item.GetDataKeyValue("RoleId").ToString());
     // ReSharper restore PossibleNullReferenceException
         var userId = Guid.Parse(item.GetDataKeyValue("UserId").ToString());
         var ur = new UserRole
         {
             UserId = userId,
             RoleId = roleId,
             State = State.删除
         };
         HomoryContext.Value.UserRole.AddOrUpdate(ur);
         HomoryContext.Value.SaveChanges();
         LogOp(OperationType.删除);
         grid.Rebind();
         Notify(panel, "操作成功", "success");
     }
     // ReSharper disable EmptyGeneralCatchClause
     catch
     // ReSharper restore EmptyGeneralCatchClause
     {
     }
 }
Esempio n. 2
0
 protected void view_OnItemDrop(object sender, RadListViewItemDragDropEventArgs e)
 {
     try
     {
         var target = e.DestinationHtmlElement;
         var roleId = Guid.Parse(target);
         var userId = Guid.Parse(e.DraggedItem.GetDataKeyValue("Id").ToString());
         var ur = new UserRole
         {
             UserId = userId,
             RoleId = roleId,
             State = State.启用
         };
         HomoryContext.Value.UserRole.AddOrUpdate(ur);
         HomoryContext.Value.SaveChanges();
         LogOp(OperationType.编辑);
         grid.Rebind();
         Notify(panel, "操作成功", "success");
     }
     // ReSharper disable EmptyGeneralCatchClause
     catch
     // ReSharper restore EmptyGeneralCatchClause
     {
     }
 }