/// <summary> /// add new template category event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btAddCat_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { CatEditor editor = new CatEditor(); editor.Text = "新建模板分类"; if (DialogResult.OK == editor.ShowDialog()) { Alading.Entity.EmailTemplateCat cat = new Alading.Entity.EmailTemplateCat() { Name = editor.CatName, Code = Guid.NewGuid().ToString(), }; Alading.Core.Enum.ReturnType result = Alading.Business.EmailTemplateCatService.AddEmailTemplateCat(cat); if (result == Alading.Core.Enum.ReturnType.Success) { catList.Add(cat); FillTemplateList(); } else { XtraMessageBox.Show("保存数据失败!"); } } }
/// <summary> /// delete selected template category event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btDelCat_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (selectedCat != null) { string msg = string.Format("分类 \"{0}\" 下的所有模板将被删除,是否继续?", selectedCat.Name); if (DialogResult.OK == XtraMessageBox.Show(msg, "提示", MessageBoxButtons.OKCancel)) { Alading.Core.Enum.ReturnType result = Alading.Business.EmailTemplateService.RemoveEmailTemplate(selectedCat.Code); if (result == Alading.Core.Enum.ReturnType.Success) { catList.Remove(selectedCat); FillTemplateList(); gcTempList.DataSource = null; } else { XtraMessageBox.Show("删除数据失败"); } } } }