Ejemplo n.º 1
0
        private void LoadScales(bool bindData)
        {
            var list = new QuestionRatingScaleServices().GetAll();

            rgList.DataSource = list;
            if (bindData)
            {
                rgList.DataBind();
            }
        }
Ejemplo n.º 2
0
        protected void ItemCommand(object o, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.InitInsertCommandName)
            {
                //e.Canceled = true;
                //var i = new HRR.Core.Domain.QuestionRatingScale();
                //i.Title = "";
                //i.ID = 0;
                //e.Item.OwnerTableView.InsertItem(i);
            }

            if (e.CommandName == RadGrid.PerformInsertCommandName)
            {
                var t = new HRR.Core.Domain.QuestionRatingScale();
                t.Title     = (e.Item.FindControl("tbTitle") as IdeaSeed.Web.UI.TextBox).Text;
                t.AccountID = ((Person)SecurityContextManager.Current.CurrentUser).AccountID;
                new QuestionRatingScaleServices().Save(t);
            }
            if (e.CommandName == RadGrid.UpdateCommandName)
            {
                if (e.Item is GridEditableItem)
                {
                    var t = new QuestionRatingScaleServices().GetByID((int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"]);
                    t.Title     = (e.Item.FindControl("tbTitle") as IdeaSeed.Web.UI.TextBox).Text;
                    t.AccountID = ((Person)SecurityContextManager.Current.CurrentUser).AccountID;
                    new QuestionRatingScaleServices().Save(t);
                }
            }
            if (e.CommandName == RadGrid.DeleteCommandName)
            {
                var t = new QuestionRatingScaleServices().GetByID((int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"]);
                new QuestionRatingScaleServices().Delete(t);
            }
            IdeaSeed.Core.Data.NHibernate.NHibernateSessionManager.Instance.CloseSession();
            LoadScales(true);
        }