private void SaveCustomReason()
        {
            if (ReasonListBox.Items.FindByText(SaveReasonAsName.Text) != null)
            {
                // update
                var adaptor = new StudyEditReasonAdaptor();
                var criteria = new CannedTextSelectCriteria();
                criteria.Label.EqualTo(SaveReasonAsName.Text);
                criteria.Category.EqualTo(REASON_CANNEDTEXT_CATEGORY);
                IList<CannedText> reasons = adaptor.Get(criteria);
                foreach (CannedText reason in reasons)
                {
                    var rowColumns = new CannedTextUpdateColumns {Text = Comment.Text};
                    adaptor.Update(reason.Key, rowColumns);
                }

            }
            else
            {
                // add 
                var adaptor = new StudyDeleteReasonAdaptor();
                var rowColumns = new CannedTextUpdateColumns
                                     {
                                         Category = REASON_CANNEDTEXT_CATEGORY,
                                         Label = SaveReasonAsName.Text,
                                         Text = Comment.Text
                                     };
                adaptor.Add(rowColumns);
            }

        }
 public CannedTextSelectCriteria(CannedTextSelectCriteria other)
     : base(other)
 {
 }
        private void EnsurePredefinedReasonsLoaded()
        {
            ReasonListBox.Items.Clear();

            var broker = HttpContextData.Current.ReadContext.GetBroker<ICannedTextEntityBroker>();
            var criteria = new CannedTextSelectCriteria();
            criteria.Category.EqualTo(REASON_CANNEDTEXT_CATEGORY);
            IList<CannedText> list = broker.Find(criteria);

            if (SessionManager.Current.User.IsInRole(Enterprise.Authentication.AuthorityTokens.Study.SaveReason))
            {
                ReasonListBox.Items.Add(new ListItem(SR.CustomReason, SR.CustomReasonComment));
            } else
            {
                ReasonListBox.Items.Add(new ListItem(SR.SelectOne, string.Empty));    
            }

            foreach (CannedText text in list)
            {
                ReasonListBox.Items.Add(new ListItem(text.Label, text.Text));
            }

        }
 public CannedTextSelectCriteria(CannedTextSelectCriteria other)
 : base(other)
 {}