/// <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())); }
/// <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); }
/// <summary> /// 上传按钮点击响应 /// </summary> protected void uploadButton_Click(object sender, EventArgs e) { if (this.noticeFileUpload.HasFile) { NoticeEditData.NoticeList = TableManager.Unserialize <mw.SysNtfConfig>(this.noticeFileUpload.FileBytes); NoticeEditData.DoLoad(); this.noticeListBox.Items.Clear(); foreach (var config in NoticeEditData.NoticeList) { if (config.id < NoticeEditData.CommonIdStart) { this.noticeListBox.Items.Add(new ListItem(this.GetNoticeText(config), config.title_id.ToString())); } } this.errorLabel.Text = TableManager.GMTDescTable[655].desc; TableManager.Save(NoticeEditData.NoticeList); } else { this.errorLabel.Text = TableManager.GMTDescTable[656].desc; } }
/// <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); }
/// <summary> /// 载入 /// </summary> public static void Load() { NoticeEditData.NoticeList = TableManager.Load <mw.SysNtfConfig>(); NoticeEditData.DoLoad(); }