Exemplo n.º 1
0
        protected void CommentItemCommand(object o, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.InitInsertCommandName)
            {
                //e.Canceled = true;
                //var i = new HRR.Core.Domain.CommentCategory();
                //i.Name = "";
                //i.AccountID = ((Person)SecurityContextManager.Current.CurrentUser).AccountID;
                //i.ID = 0;
                //e.Item.OwnerTableView.InsertItem(i);
            }

            if (e.CommandName == RadGrid.PerformInsertCommandName)
            {
                var t = new HRR.Core.Domain.CommentCategory();
                t.Name      = (e.Item.FindControl("tbName") as IdeaSeed.Web.UI.TextBox).Text;
                t.AccountID = ((Person)SecurityContextManager.Current.CurrentUser).AccountID;
                new CommentCategoryServices().Save(t);
            }
            if (e.CommandName == RadGrid.UpdateCommandName)
            {
                if (e.Item is GridEditableItem)
                {
                    var t = new CommentCategoryServices().GetByID((int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"]); t.Name = (e.Item.FindControl("tbName") as IdeaSeed.Web.UI.TextBox).Text;
                    t.AccountID = ((Person)SecurityContextManager.Current.CurrentUser).AccountID;
                    new CommentCategoryServices().Save(t);
                }
            }
            if (e.CommandName == RadGrid.DeleteCommandName)
            {
                var t = new CommentCategoryServices().GetByID((int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"]);
                new CommentCategoryServices().Delete(t);
            }
            //LoadCategories(true);
        }
Exemplo n.º 2
0
        private void LoadCategories(bool bindData)
        {
            var l = new CommentCategoryServices().GetAll();

            rgCommentCategories.DataSource = l;
            if (bindData)
            {
                rgCommentCategories.DataBind();
            }
        }