コード例 #1
0
        protected void OnSave(object sender, EventArgs e)
        {
            if(m_txtText.Text.ToUpper() == "ALL" || m_txtText.Text.ToUpper() == "UNLABELED")
            {
                ShowMessage("Label may not contain 'All' or 'Unlabeled' as those are use within the system.", InetSolution.Web.MessageTone.Negative);
                return;
            }

            int iIALabelID = 0;
            if(m_oIALabel != null)
            {
                iIALabelID = m_oIALabel.IALabelID;
            }

            if(DataAccess.IALabels.Count(row => row.Text == m_txtText.Text && row.IALabelID != iIALabelID) > 0)
            {
                ShowMessage(string.Format("The label '{0}' already exists.", m_txtText.Text), InetSolution.Web.MessageTone.Negative);
                return;
            }

            if(IsNew)
            {
                m_oIALabel = new IALabel();
                DataAccess.IALabels.InsertOnSubmit(m_oIALabel);
            }

            m_oIALabel.Text = m_txtText.Text;
            m_oIALabel.IsCustomerVisible = m_chkIsCustomerVisible.Checked;
            DataAccess.SubmitChanges();

            Business.Services.LabelsService.FlushLabelsCache();

            RedirectMessage("~/labels.aspx", "Label information saved.", InetSolution.Web.MessageTone.Positive);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if(Request.QueryString["id"] != null)
            {
                if(ApplicationContext.IsAdmin || ApplicationContext.IsStaff)
                {
                    m_oIALabel = DataAccess.IALabels.SingleOrDefault(row => row.IALabelID == MemberProtect.Utility.ValidateInteger(Request.QueryString["id"]));
                }
            }

            if(!IsPostBack)
            {
                SetDefaultButton(m_txtText, m_btnSubmit);

                if(m_oIALabel != null)
                {
                    m_txtText.Text = m_oIALabel.Text;
                    m_chkIsCustomerVisible.Checked = m_oIALabel.IsCustomerVisible;
                }
                else
                {
                    m_txtText.Focus();
                }
            }
        }