protected override void WndProc(ref Message m) { if (m.Msg != WM_CLOSE || !VC2WinFmApp.Engine.Modified) { base.WndProc(ref m); return; } switch (ExUI.ConfirmYesNoCancel("课表被修改,是否保存?")) { case DialogResult.Yes: VC2WinFmApp.Engine.SaveAll(false); base.WndProc(ref m); break; case DialogResult.No: foreach (Form cfm in this.MdiChildren) { cfm.FormClosing -= ItemFormClosing; } base.WndProc(ref m); break; case DialogResult.Cancel: break; } }
private void MMenuCloseAll_Click(object sender, EventArgs e) { if (VC2WinFmApp.Engine.Modified) { switch (ExUI.ConfirmYesNoCancel("课表已经更改,是否保存?")) { case DialogResult.Yes: this.MMenuSaveAll_Click(null, null); //低效简单的做法,无意义地刷新了界面 break; case DialogResult.No: this.MMenuCancelAll_Click(null, null); //低效简单的做法,无意义地刷新了界面 break; case DialogResult.Cancel: return; } } for (Int32 i = this.MdiChildren.Length - 1; i >= 0; i--) { this.MdiChildren[i].Close(); } this.SetControlEnable(); }
private void LessonEditFm_FormClosing(object sender, FormClosingEventArgs e) { if (Biz.Grp != null && Biz.Modify && !ExUI.Confirm("退出将丢失对当前数据所做的编辑")) { e.Cancel = true; } }
private void LoadAct() { foreach (OleDbDataReader reader in ThisModule.OleDB.EachRows( "select Id, FActTimes from TClsLesson")) { Int64 ClsLsnId = Convert.ToInt64(reader[0]); ClsLsnContainer ClsLsnCnt; if (!ClsLsns.TryGetValue(ClsLsnId, out ClsLsnCnt)) { ThisModule.ErrorLog.Error("VcLsnAct恢复错误:ID对应的实体不存在 " + " ClsLesson: " + ClsLsnId); continue; } String ActTimes = reader[1].ToString(); if (String.IsNullOrEmpty(ActTimes)) { continue; } for (Int32 i = 0; i < ActTimes.Length; i++) { //for (Int32 i = ActTimes.Length - 1; i >= 0; i--) if (ActTimes[i] != '_') { EnLsnAct Act = new EnLsnAct(); ActId++; Act.Id = ActId; Act.Time.Week = (DayOfWeek)(i / (4 * 7)); Act.Time.BetideNode = (eBetideNode)((i % (4 * 7)) / 7); Act.Time.Order = i % 7; Act.Locked = ActTimes[i] == 'A'; Act.ClsLesson = ClsLsnCnt.ClsLsn; if (ClsLsnCnt.Acts.Count < ClsLsnCnt.ClsLsn.SharedTime) { ClsLsnCnt.Acts.Add(Act); } } } Int32 cntDec = ClsLsnCnt.ClsLsn.SharedTime - ClsLsnCnt.Acts.Count; for (Int32 cnt = 0; cnt < cntDec; cnt++) { EnLsnAct Act = new EnLsnAct(); ActId++; Act.Id = ActId; Act.ClsLesson = ClsLsnCnt.ClsLsn; ClsLsnCnt.Acts.Add(Act); } if (ClsLsnCnt.Acts.Count != ClsLsnCnt.ClsLsn.SharedTime) { ExUI.ShowInfo(ClsLsnCnt.Acts.Count + "/" + ClsLsnCnt.ClsLsn.SharedTime); } } }
private void MMenuSysInit_Click(object sender, EventArgs e) { if (ExUI.Confirm("系统初始化,将删除所有数据")) { VC2WinFmApp.DataRule.SysInit(); ExUI.ShowInfo("系统初始化结束,当前是一个空白系统,建议使用'菜单\\工具\\数据向导'快速建立贵校数据"); } }
private void MMenuWizardTeacher_Click(object sender, EventArgs e) { Int32 AppendCount = 0; if (WizardTeacherFm.WizardAddTeacher(ref AppendCount)) { ExUI.ShowInfo("成功添加教师" + AppendCount + "名"); } }
private void MMenuWizardSquad_Click(object sender, EventArgs e) { Int32 AppendCount = 0; if (WizardSquadFm.WizardAddSquad(ref AppendCount)) { ExUI.ShowInfo("成功添加班级" + AppendCount + "项"); } }
private void MMenuWizardCourse_Click(object sender, EventArgs e) { Int32 AppendCount = 0; if (WizardCourseFm.WizardAddCourse(ref AppendCount)) { ExUI.ShowInfo("成功添加课程" + AppendCount + "项"); } }
private Boolean Save() { BaseEntity Ety; if (EditState == eDataEditState.esInsert) { Ety = MainBF.NewEty(); } else { Ety = MainGrdBind.Current as BaseEntity; Ety = Ety.Clone() as BaseEntity; } SetEtyField(Ety); //检测 if (String.IsNullOrEmpty(Ety.Name)) { ExUI.ShowInfo("名称必须填写"); tbName.Focus(); return(false); } if (MainBF.NameExist(Ety) && !ExUI.Confirm(MainBF.Kind + ": '" + Ety.Name + "'已存在,是否继续?")) { tbName.Focus(); return(false); } Ety = MainBF.SaveEty(Ety); if (EditState == eDataEditState.esInsert) { MainGrdBind.Add(Ety); } else { MainGrdBind.Refresh(); } return(true); }
public static void ExportData(String kind, VCExportDataGroup data) { if (kind == cExportToHtml) { String fileName = ExFileDialog.GetSaveFileName(ExFileDialog.FileFilter_Html, data.Name + ".htm", Environment.GetFolderPath(Environment.SpecialFolder.Personal)); if (!String.IsNullOrEmpty(fileName)) { try { String[,] mData = ArrangeData(data); ToHtml.ExportDataToHtml(fileName, data.Name, mData); ExUI.ShowInfo("成功输出" + data.Name + ": " + fileName); } catch (Exception e) { ExUI.ShowInfo("输出失败信息: " + e.Message); } } } else if (kind == cExportToExcel) { String fileName = ExFileDialog.GetSaveFileName(ExFileDialog.FileFilter_Excel, data.Name + ".xls", Environment.GetFolderPath(Environment.SpecialFolder.Personal)); if (!String.IsNullOrEmpty(fileName)) { try { String[,] mData = ArrangeData(data); new BindToExcelImpl().ArrayToExcel(mData, fileName); ExUI.ShowInfo("成功输出" + data.Name + ": " + fileName); } catch (Exception e) { ExUI.ShowInfo("输出失败信息: " + e.Message); } } } }
private void ItemFormClosing(object sender, FormClosingEventArgs e) { BaseEntity ety = (sender as IScheduleFm).Entity; if (VC2WinFmApp.Engine.IsModified(ety)) { switch (ExUI.ConfirmYesNoCancel("课表: " + ety + " 已经修改,是否保存?")) { case DialogResult.Yes: VC2WinFmApp.Engine.Save(ety as EnSquad); break; case DialogResult.No: VC2WinFmApp.Engine.Cancel(ety as EnSquad); break; case DialogResult.Cancel: e.Cancel = true; return; } } RemoveItem(ety); }
private void InputDataError(object sender, DataGridViewDataErrorEventArgs e) { ExUI.ShowInfo("请输入正确的数据格式"); e.Cancel = true; }
public static void ExportData(String kind, VCExportData data) { ExUI.ShowInfo("暂未实现"); }