コード例 #1
0
        /// <summary>
        /// 添加按钮点击响应
        /// </summary>
        protected void addButton_Click(object sender, EventArgs e)
        {
            mw.SysNtfConfig config = new mw.SysNtfConfig();

            config.type       = mw.Enums.SysNtfType.SYS_NTF_TYPE_LOGIN;
            config.id         = NoticeEditData.IdIncrease;
            config.title_id   = NoticeEditData.IdIncrease;
            config.details_id = NoticeEditData.IdIncrease + 10000;

            //文字(2016.3.21)
            config.details_str = this.contentTextBox.Text;
            config.title_str   = this.titleTextBox.Text;

            this.UpdateNotice(config);

            mw.SysNtfConfig commonConfig = new mw.SysNtfConfig();
            commonConfig.type       = mw.Enums.SysNtfType.SYS_NTF_TYPE_COMMON;
            commonConfig.id         = config.id + NoticeEditData.CommonIdAdded;
            commonConfig.title_id   = config.title_id + NoticeEditData.CommonIdAdded;
            commonConfig.details_id = config.details_id + NoticeEditData.CommonIdAdded;
            this.UpdateNotice(commonConfig);

            ++NoticeEditData.IdIncrease;

            NoticeEditData.NoticeList.Insert(this.noticeListBox.Items.Count, config);
            NoticeEditData.NoticeList.Add(commonConfig);
            NoticeEditData.Save();

            this.noticeListBox.Items.Add(new ListItem(this.GetNoticeText(config), config.title_id.ToString()));
        }
コード例 #2
0
        /// <summary>
        /// 公告列表选中改变响应
        /// </summary>
        protected void noticeListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.noticeListBox.SelectedIndex < 0)
            {
                return;
            }

            mw.SysNtfConfig config = NoticeEditData.NoticeList[this.noticeListBox.SelectedIndex];

            this.titleTextBox.Text    = TextManager.GetText(config.title_id);
            this.contentTextBox.Text  = TextManager.GetText(config.details_id);
            this.activityTextBox.Text = config.activity.ToString();
            this.icon1TextBox.Text    = config.icon1;
            this.icon2TextBox.Text    = config.icon2;
        }
コード例 #3
0
 //取出
 protected void GetBtn_Click(object sender, EventArgs e)
 {
     if (this.SysNtfListBox.SelectedIndex == -1)
     {
         this.ErrorLable.Text = "请选择一行数据";
         return;
     }
     else
     {
         this.TipLabel.Text = SysNtfDictionary.Count.ToString();
         mw.SysNtfConfig config = SysNtfDictionary[int.Parse(this.SysNtfListBox.SelectedItem.Value)];
         this.SysNtfname.Text = config.title_str;
         this.SysNtfID.Text   = config.id.ToString();
     }
 }
コード例 #4
0
        //修改
        protected void UpdateBtn_Click(object sender, EventArgs e)
        {
            List <mw.SysNtfConfig> list = new List <mw.SysNtfConfig>();

            if (this.SysNtfListBox.SelectedIndex == -1)
            {
                this.TipLabel.Text = "请选择修改项";
                return;
            }

            //填写信息校验,ID不允许重复
            string id = this.SysNtfID.Text;

            if (this.SysNtfListBox.Items.FindByValue(id) != null && id != this.SysNtfListBox.SelectedValue)
            {
                this.TipLabel.Text = "ID不能重复";
                return;
            }

            mw.SysNtfConfig config = SysNtfDictionary[int.Parse(this.SysNtfListBox.SelectedItem.Value)];
            config.title_str = this.SysNtfname.Text;
            config.id        = int.Parse(this.SysNtfID.Text);

            foreach (var pair in SysNtfDictionary.Values)
            {
                list.Add(pair);
            }
            RWManager.Save <mw.SysNtfConfig>("SysNtfConfig.protodata.bytes", list);

            //刷新数据
            this.SysNtfListBox.Items.Clear();
            SysNtfDictionary.Clear();
            List <mw.SysNtfConfig> list2 = new List <mw.SysNtfConfig>();

            list2 = RWManager.Load <mw.SysNtfConfig>("SysNtfConfig.protodata.bytes");
            for (int i = 0; i < list2.Count; i++)
            {
                SysNtfDictionary.Add(list2[i].id, list2[i]);
                this.SysNtfListBox.Items.Add(new ListItem(list2[i].id.ToString() + "" + list2[i].title_str + "" + list2[i].details_str, list2[i].id.ToString()));
            }

            this.ErrorLable.Text = list2.Count.ToString();
        }
コード例 #5
0
        /// <summary>
        /// 更新公告
        /// </summary>
        /// <param name="config">公告配置</param>
        private void UpdateNotice(mw.SysNtfConfig config)
        {
            int activity;

            config.title_id = TextManager.CreateText();
            TextManager.SetText(config.title_id, this.titleTextBox.Text);
            config.details_id = TextManager.CreateText();
            TextManager.SetText(config.details_id, this.contentTextBox.Text);

            if (int.TryParse(this.activityTextBox.Text, out activity))
            {
                config.activity = activity;
            }
            else
            {
                config.activity = 0;
            }

            config.icon1 = this.icon1TextBox.Text;
            config.icon2 = this.icon2TextBox.Text;
        }
コード例 #6
0
        /// <summary>
        /// 删除按钮点击响应
        /// </summary>
        protected void deleteButton_Click(object sender, EventArgs e)
        {
            if (this.noticeListBox.SelectedIndex < 0)
            {
                return;
            }

            mw.SysNtfConfig config = NoticeEditData.NoticeList[this.noticeListBox.SelectedIndex];
            NoticeEditData.NoticeList.RemoveAt(this.noticeListBox.SelectedIndex);

            for (int i = 0; i < NoticeEditData.NoticeList.Count; ++i)
            {
                mw.SysNtfConfig commonConfig = NoticeEditData.NoticeList[i];
                if (commonConfig.id == config.id + NoticeEditData.CommonIdAdded)
                {
                    NoticeEditData.NoticeList.RemoveAt(i);
                    break;
                }
            }

            NoticeEditData.Save();

            this.noticeListBox.Items.RemoveAt(this.noticeListBox.SelectedIndex);
        }
コード例 #7
0
        /// <summary>
        /// 修改按钮点击响应
        /// </summary>
        protected void modifyButton_Click(object sender, EventArgs e)
        {
            if (this.noticeListBox.SelectedIndex < 0)
            {
                return;
            }

            mw.SysNtfConfig config = NoticeEditData.NoticeList[this.noticeListBox.SelectedIndex];

            this.UpdateNotice(config);

            foreach (var commonConfig in NoticeEditData.NoticeList)
            {
                if (commonConfig.id == config.id + NoticeEditData.CommonIdAdded)
                {
                    this.UpdateNotice(commonConfig);
                    break;
                }
            }

            NoticeEditData.Save();

            this.noticeListBox.SelectedItem.Text = this.GetNoticeText(config);
        }
コード例 #8
0
        /// <summary>
        /// 获取公告文本
        /// </summary>
        /// <param name="config">公告配置</param>
        /// <returns>公告文本</returns>
        private string GetNoticeText(mw.SysNtfConfig config)
        {
            string text = config.title_str + " " + config.activity;

            return(text);
        }