private void btnLogout_ItemClick(object sender, ItemClickEventArgs e) { if (!Msg.AskQuestion("真的要登出吗?")) { return; } try { if (this.AnyDataChanged()) { Msg.Warning("系统检测到有数据窗体没有保存,不能登出!"); return; } if (!Application.AllowQuit) { return; //程序不允许退出 } SystemAuthentication.Current.Logout(); //登出 this.Hide(); //显示登录窗体 Program.MainForm = null; if (frmLogin.Login() && Program.MainForm != null) { Program.MainForm.Show(); } GC.Collect(); } catch (Exception ex) { Msg.ShowException(ex); } }
/// <summary> /// 关窗体中... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmBaseDataForm_FormClosing(object sender, FormClosingEventArgs e) { if (this.DataChanged) { e.Cancel = !Msg.AskQuestion("您修改了数据没有保存,确定要退出吗?"); } }
public override void DoDelete(IButtonInfo sender) { AssertFocusedRow();//检查是否选择一条记录 if (!Msg.AskQuestion("真的要删除?")) { return; } //调用业务逻辑类删除记录 DataRow summary = _SummaryView.GetDataRow(_SummaryView.FocusedRowHandle); string sFdes = "删除菜单" + summary[tb_sys_Function.FName] + "(" + summary[tb_sys_Function.FNumber] + ")"; bool b = _BLL.Delete(summary[_BLL.KeyFieldName].ToString()); AssertEqual(b, true, "删除记录时发生错误!"); bllComDataBaseTool.WriteLogOp(_FunctionID, "0", sFdes); base.DoDelete(sender); this.DeleteSummaryRow(_SummaryView.FocusedRowHandle); //删除Summary资料行 if (_SummaryView.FocusedRowHandle < 0) //删除了最後一条记录. 显示Summary页面. { ShowSummaryPage(true); } else { _BLL.CreateDataBinder(_SummaryView.GetDataRow(_SummaryView.FocusedRowHandle)); this.DoViewContent(sender); base.DoDelete(sender); } }
private void btnCancel_Click(object sender, EventArgs e) { if (Msg.AskQuestion("确定要退出系统吗?")) { Application.Exit(); } }
private void btnDelCommonType_Click(object sender, EventArgs e) { //int id = 0; //Int32.TryParse(txtCommonTypeId.Text, out id); //if (id == 0) //{ // Msg.Warning("编号必须大于0!"); // txtCommonTypeId.Focus(); // return; //} if (false == Msg.AskQuestion("确认要删除 '" + txtCommonTypeId.Text + "' 的记录!")) { return; } //删除字典类型 bool success = (_BLL as bllCommonDataDict).DeleteCommonType(txtCommonTypeId.Text); if (success) { //DataDictCache.Cache.DeleteCacheRow(tb_CommDataDictType.__TableName, tb_CommDataDictType.__KeyName, txtCommonTypeId.Text); Msg.ShowInformation("删除成功!"); } }
private void gc_DBList_EmbeddedNavigator_ButtonClick(object sender, NavigatorButtonClickEventArgs e) { //frmDialog_DBList if (e.Button.ButtonType == NavigatorButtonType.Remove) { if (Msg.AskQuestion("确定要删除选中账套吗?")) { gv_DBList.DeleteSelectedRows(); } } if (e.Button.ButtonType == NavigatorButtonType.Append) { //添加角色 //frmDialog_RoleList DataTable dtdetail = EditData.Tables[dt_MyUserDBs._TableName]; var str = dtdetail.FormatInValue(dt_MyUserDBs.DBCode); dtDBList.DefaultView.RowFilter = String.IsNullOrEmpty(str) ? "" : String.Format("{0} NOT IN ({1})", sys_DataBaseList.DBCode, str); DataTable dt = frmDialog_DBList.ShowForm(dtDBList.DefaultView.ToTable()); if (dt != null) { foreach (DataRow dr in dt.Rows) { DataRow row = EditData.Tables[dt_MyUserDBs._TableName].Rows.Add(); row[dt_MyUserDBs.Account] = txtAccount.EditValue; row[dt_MyUserDBs.DBCode] = dr[sys_DataBaseList.DBCode]; } } } e.Handled = true; }
public override void DoDelete(IButtonInfo sender) { try { if (!Msg.AskQuestion("真的要删除?")) { return; } AssertFocusedRow(); DataRow summary = _SummaryView.GetDataRow(_SummaryView.FocusedRowHandle); string sSaveDesc = "删除" + summary[tb_sys_DbLink.FName] + "(" + summary[tb_sys_DbLink.FNumber] + ")成功"; bool b = _DataProxy.Delete(summary[tb_sys_DbLink.__KeyName].ToString()); AssertEqual(b, true, "删除记录时发生错误!"); bllComDataBaseTool.WriteLogOp(_FunctionID, "0", sSaveDesc); //日志 base.DoDelete(sender); this.DeleteSummaryRow(_SummaryView.FocusedRowHandle); //删除Summary资料行 if (_SummaryView.FocusedRowHandle < 0) //删除了最後一条记录. 显示Summary页面. { ShowSummaryPage(true); } else { _DataProxy.CreateDataBinder(_SummaryView.GetDataRow(_SummaryView.FocusedRowHandle)); DoBindingSummaryEditor(_DataProxy.DataBinder); //显示主表记录详细资料 base.DoDelete(sender); } } catch (Exception e) { Msg.ShowException(e); } }
/// <summary> /// 删除记录 /// </summary> /// <param name="sender"></param> public override void DoDelete(IButtonInfo sender) { AssertFocusedRow();//检查是否选择一条记录 if (!Msg.AskQuestion("真的要删除?")) { return; } //调用业务逻辑类删除记录 DataRow summary = _SummaryView.GetDataRow(_SummaryView.FocusedRowHandle); bool b = _BLL.Delete(summary[_BLL.KeyFieldName].ToString()); AssertEqual(b, true, "删除记录时发生错误!"); if (b) { bllComDataBaseTool.WriteLogOp(_FunctionID, "0", "删除数据字典" + summary[tb_t_CommonDataDict.FNativeName].ToString() + "(" + summary[tb_t_CommonDataDict.FDataCode].ToString() + ")"); } base.DoDelete(sender); this.DeleteSummaryRow(_SummaryView.FocusedRowHandle); //删除Summary资料行 if (_SummaryView.FocusedRowHandle < 0) //删除了最後一条记录. 显示Summary页面. { ShowSummaryPage(true); } else { _BLL.CreateDataBinder(_SummaryView.GetDataRow(_SummaryView.FocusedRowHandle)); DoBindingSummaryEditor(_BLL.DataBinder); //显示主表记录详细资料 base.DoDelete(sender); } }
public override void DoDelete(IButtonInfo sender) { try { if (!Msg.AskQuestion("真的要删除?")) { return; } AssertFocusedRow(); DataRow summary = _SummaryView.GetDataRow(_SummaryView.FocusedRowHandle); bool b = _DataProxy.Delete(summary["Account"].ToString()); AssertEqual(b, true, "删除记录时发生错误!"); base.DoDelete(sender); this.DeleteSummaryRow(_SummaryView.FocusedRowHandle); //删除Summary资料行 if (_SummaryView.FocusedRowHandle < 0) //删除了最後一条记录. 显示Summary页面. { ShowSummaryPage(true); } else { _DataProxy.CreateDataBinder(_SummaryView.GetDataRow(_SummaryView.FocusedRowHandle)); DoBindingSummaryEditor(_DataProxy.DataBinder); //显示主表记录详细资料 base.DoDelete(sender); } } catch (Exception e) { Msg.ShowException(e); } }
public override void DoCancel(IButtonInfo sender) { if (Msg.AskQuestion("要取消修改吗?")) { base.DoCancel(sender); } }
//取消修改 public override void DoCancel(IButtonInfo sender) { try { if (!Msg.AskQuestion("要取消修改吗?")) { return; } if (_UpdateType == UpdateType.Add) { base.DoCancel(sender); this.ShowSummaryPage(true); } else { base.DoCancel(sender); this.DoViewContent(sender); } } catch (Exception e) { Msg.ShowException(e); } }
private void gc_Detail_EmbeddedNavigator_ButtonClick(object sender, DevExpress.XtraEditors.NavigatorButtonClickEventArgs e) { if (e.Button.ButtonType == DevExpress.XtraEditors.NavigatorButtonType.Remove) { e.Handled = Msg.AskQuestion("是否确定要删除选中行?") == false; } }
private void btnDelCommonType_Click(object sender, EventArgs e) { int id = 0; Int32.TryParse(txtCommonTypeId.Text, out id); if (id == 0) { Msg.Warning("编号必须大于0!"); txtCommonTypeId.Focus(); return; } if (false == Msg.AskQuestion("确认要删除 '" + txtCommonTypeId.Text + "' 的记录!")) { return; } //删除字典类型 bool success = (_BLL as bllCommonDataDict).DeleteCommonType(txtCommonTypeId.Text); if (success) { DataDictCache.Cache.DeleteCacheRow(tb_t_CommDataDictType.__TableName, tb_t_CommDataDictType.__KeyName, txtCommonTypeId.Text); bllComDataBaseTool.WriteLogOp(_FunctionID, "0", "删除公共字典类型:" + txtCommonTypeName.Text + "(" + txtCommonTypeId.Text + ")"); DataDictCache.RefreshCache(); gcProfileClass.DataSource = DataDictCache.Cache.CommonDataDictType; DataBinder.BindingLookupEditDataSource(txtDataType, DataDictCache.Cache.CommonDataDictType, "FTYPENAME", "FID"); Msg.ShowInformation("删除成功!"); } }
void AppExit() { if (Msg.AskQuestion("确定要退出系统吗?")) { this.Close(); } }
private void btnGenBLLDataDict_Click(object sender, EventArgs e) { if (false == Msg.AskQuestion("确认要生成吗?")) { return; } //创建参数对象 Params4DataDictBLL param = new Params4DataDictBLL(); param.BLL_Name = txtBLL.Text; param.BLL_Namespace = txtBllNamespace.Text; param.ConcretelyName = txtConcretelyName.Text; param.DAL_Name = txtDAL.Text; param.ORM_Name = txtORM.Text; param.UsingNamespace = txtUsingNamespace.Lines; //生成源码 string code = new GenerateBLL().GenerateDataDictBLL(param); //显示代码 if (chkPreviewBLL.Checked) { this.ShowCode(code); } //输出.cs文件 if (chkExportToFileBLL.Checked) { string fileName = txtOutpup_BLL_DataDict.Text + txtBLL.Text + ".cs"; File.WriteAllText(fileName, code, Encoding.UTF8); MessageBox.Show("输出文件:" + fileName); } }
//删除 protected override void DoDelete(object sender) { DataRow dr = _SummaryView.GetFocusedDataRow(); if (dr == null) { Msg.Warning("没有选择数据!"); return; } if (Msg.AskQuestion("确定要删除选中记录吗?") == false) { return; } //CurrentDataState = FormDataState.View;删除不需要修改状态 string Key = ConvertEx.ToString(dr[_bll.SummaryModel.PrimaryKey]); if (_bll.Delete(Key)) { _SummaryView.DeleteSelectedRows(); if (CurrentDataState == FormDataState.View) { DoView(null); } else//2015年10月21日12:06:17,查看明细后跳转到查询页面,进行删除当前记录后光标定位到新纪录,然而明细页数据是旧数据切是可用状态,修改为明细页不可用,当有新的查看时,就会刷新明细页数据了 { tp_Edit.PageEnabled = false; } Msg.Warning("删除成功!"); } }
/// <summary> /// 删除记录 /// </summary> /// <param name="sender"></param> public override void DoDelete(IButtonInfo sender) { AssertFocusedRow();//检查是否选择一条记录 if (!Msg.AskQuestion("真的要删除?")) { return; } //调用业务逻辑类删除记录 DataRow summary = _SummaryView.GetDataRow(_SummaryView.FocusedRowHandle); bool b = _BLL.Delete(summary[_BLL.KeyFieldName].ToString()); AssertEqual(b, true, "删除记录时发生错误!"); base.DoDelete(sender); this.DeleteSummaryRow(_SummaryView.FocusedRowHandle); //删除Summary资料行 if (_SummaryView.FocusedRowHandle < 0) //删除了最後一条记录. 显示Summary页面. { ShowSummaryPage(true); } else { _BLL.CreateDataBinder(_SummaryView.GetDataRow(_SummaryView.FocusedRowHandle)); DoBindingSummaryEditor(_BLL.DataBinder); //显示主表记录详细资料 base.DoDelete(sender); } }
/// <summary> /// 删除记录 /// </summary> /// <param name="sender"></param> public override void DoDelete(IButtonInfo sender) { AssertFocusedRow(); DataRow row = _SummaryView.GetDataRow(_SummaryView.FocusedRowHandle); if (_BLL.IsApproved(row)) { Msg.Warning("单据已经审核,不能删除!"); } else { if (Msg.AskQuestion("真的要删除?")) { bool b = _BLL.Delete(row[_BLL.KeyFieldName].ToString()); //删除数据 AssertEqual(b, true, "删除记录时发生错误!"); base.DoDelete(sender); this.SetSummaryRowZero(row);//删除单据:只删除明细,主表金额清零!!! this.ShowSummaryPage(true); Msg.ShowInformation("删除成功!\r\n\r\n提示:仅删除明细数据,保留主表仅数量金额清零!"); } } }
private void btnGenDALBusiness_Click(object sender, EventArgs e) { if (false == Msg.AskQuestion("确认要生成吗?")) { return; } Params4BusinessDAL param = new Params4BusinessDAL(); param.ConcretelyName = txtConcretelyName_DAL.Text; param.DAL_Name = txtDAL_DAL.Text; param.ORM_Name = txtORM_DAL.Text; param.DAL_Namespace = txtNamespace_DAL.Text; param.UsingNamespace = txtUsingNamespace_DAL.Lines; //生成源码 string code = new GenerateDAL().GenerateBusinessDAL(param); if (chkPreviewDAL.Checked) { this.ShowCode(code); } //输出cs文件 if (chkExportToFileDAL.Checked) { string fileName = txtOutpup_DAL_Business.Text + txtDAL_DAL.Text + ".cs"; File.WriteAllText(fileName, code, Encoding.UTF8); MessageBox.Show("输出文件:" + fileName); } }
private void gc_Detail_EmbeddedNavigator_ButtonClick(object sender, DevExpress.XtraEditors.NavigatorButtonClickEventArgs e) { if (e.Button.ButtonType == NavigatorButtonType.Remove) { if (Msg.AskQuestion("确定要删除选中角色吗?")) { gv_Detail.DeleteSelectedRows(); UpdateRoleAuthority(); } } if (e.Button.ButtonType == NavigatorButtonType.Append) { //添加角色 //frmDialog_RoleList DataTable dtdetail = EditData.Tables[dt_MyUserRole._TableName]; var str = dtdetail.FormatInValue(dt_MyRole.RoleID); dtRoles.DefaultView.RowFilter = String.IsNullOrEmpty(str) ? "" : String.Format("{0} NOT IN ({1})", dt_MyRole.RoleID, str); DataTable dt = frmDialog_RoleList.ShowForm(dtRoles.DefaultView.ToTable()); if (dt != null) { foreach (DataRow dr in dt.Rows) { DataRow row = EditData.Tables[dt_MyUserRole._TableName].Rows.Add(); row[dt_MyUserRole.Account] = txtAccount.EditValue; row[dt_MyUserRole.RoleID] = dr[dt_MyRole.RoleID]; //row[dt_MyRole.RoleName] = dr[dt_MyRole.RoleName]; } UpdateRoleAuthority(); } } e.Handled = true; }
private void btnDel_Click(object sender, EventArgs e) { var rows = this.gridView1.GetSelectedRows(); if (rows.Length == 0) { Msg.Warning("请选择需要删除的数据行"); } else { // var model = (Products)gridView1.GetFocusedRow(); if (Msg.AskQuestion("确定删除?")) { int selRow = gridView1.FocusedRowHandle; string Id = gridView1.GetRowCellValue(selRow, "productId").ToString(); var ret = _productApp.DelById(Id.ToInt()); if (ret) { Msg.ShowInformation("删除成功"); //GridView view = sender as GridView; //view.DeleteRow(view.FocusedRowHandle); gridView1.DeleteRow(selRow); } else { Msg.ShowError("删除失败"); } } } }
public override void DoCancel(IButtonInfo sender) { if (Msg.AskQuestion("要取消修改吗?")) { tpSummary.PageEnabled = true; base.DoCancel(sender); } }
private void btn_Exit_Click(object sender, EventArgs e) { if (Msg.AskQuestion("确定要退出系统吗?") == false) { return; } Application.Exit(); }
public override void DoCancel(IButtonInfo sender) { if (Msg.AskQuestion("要取消修改吗?")) { gvprofile.Columns[2].OptionsColumn.AllowEdit = false; base.DoCancel(sender); } }
public override void DoCancel(IButtonInfo sender) { if (Msg.AskQuestion("要取消修改吗?")) { _DataProxy.DataBinder.Rows[0][tb_sys_DbLink.FNumber] = sHead + txtNum.Text; _DataProxy.DataBinder.Rows[0][tb_sys_DbLink.FPwd] = CEncoder.Encode(txtPwd.Text); base.DoCancel(sender); } }
//清空 private void btn_Clear_Click(object sender, EventArgs e) { //Msg.ShowInformation("清空"); if (Msg.AskQuestion("确定要清空数据吗?") == false) { return; } EditData.Tables[tb_SODetail._TableName].Rows.Clear(); }
//删除用户组 public override void DoDelete(IButtonInfo sender) { try { if (!Msg.AskQuestion("真的要删除?")) { return; } AssertFocusedRow(); DataRow row = this.GetFocusedRow(); base.DoDelete(sender); string key = row[tb_sys_UserGroup.FNumber].ToString(); string sFdes = "删除角色" + row[tb_sys_UserGroup.FName].ToString() + "(" + row[tb_sys_UserGroup.FName].ToString() + ")"; if (key == string.Empty) { return; } bool ret = _DataProxy.DeleteGroupByKey(bllComDataBaseTool.GetTableFieldValue(tb_sys_UserGroup.__TableName, tb_sys_UserGroup.__KeyName, " AND " + tb_sys_UserGroup.FNumber + "='" + key + "'")); if (ret) { this.DeleteSummaryRow(_SummaryView.FocusedRowHandle);//删除Summary资料行 row = this.GetFocusedRow(); if (row == null) { return; } //获取下一条记录的数据 _CurrentBusiness = _DataProxy.GetGroupDataByKey(row[tb_sys_UserGroup.FNumber].ToString()); if (tcBusiness.SelectedTabPage == this.tpDetail) { //显示下一条记录的数据 this.DoBindingSummaryEditor(_CurrentBusiness.Tables[BusinessDataSetIndex.Groups]); //显示主表记录详细资料 _DataProxy.ShowUsers(lbSelectedUser, _CurrentBusiness.Tables[BusinessDataSetIndex.GroupUsers]); _DataProxy.ShowUsers(lbAvailableUser, _CurrentBusiness.Tables[BusinessDataSetIndex.GroupAvailableUser]); _DataProxy.ShowGroupAutority(_CurrentBusiness.Tables[BusinessDataSetIndex.GroupAuthorities]); } bllComDataBaseTool.WriteLogOp(_FunctionID, "0", sFdes); base.DoDelete(sender); Msg.ShowInformation("删除成功!"); } else { Msg.ShowError("删除发生错误!"); } } catch (Exception e) { Msg.ShowException(e); } }
private void btnClose_Click(object sender, EventArgs e) { if (_Changed) { if (Msg.AskQuestion("您已经修改了配置,要保存吗?")) { btnSave.PerformClick(); } } this.Close(); }
private void frmMain_FormClosing(object sender, FormClosingEventArgs e) { if (this.AnyDataChanged()) { bool ok = Msg.AskQuestion("系统检测到有数据没有保存,真的要退出吗?"); if (!ok) { e.Cancel = true; } } }
//删除用户组 public override void DoDelete(IButtonInfo sender) { try { if (!Msg.AskQuestion("真的要删除?")) { return; } AssertFocusedRow(); DataRow row = this.GetFocusedRow(); base.DoDelete(sender); string key = row[TUserGroup.GroupCode].ToString(); if (key == string.Empty) { return; } bool ret = _DataProxy.DeleteGroupByKey(key); if (ret) { this.DeleteSummaryRow(_SummaryView.FocusedRowHandle);//删除Summary资料行 row = this.GetFocusedRow(); if (row == null) { return; } //获取下一条记录的数据 _CurrentBusiness = _DataProxy.GetGroupDataByKey(row[TUserGroup.GroupCode].ToString()); if (tcBusiness.SelectedTabPage == this.tpDetail) { //显示下一条记录的数据 this.DoBindingSummaryEditor(_CurrentBusiness.Tables[BusinessDataSetIndex.Groups]); //显示主表记录详细资料 _DataProxy.ShowUsers(lbSelectedUser, _CurrentBusiness.Tables[BusinessDataSetIndex.GroupUsers]); _DataProxy.ShowUsers(lbAvailableUser, _CurrentBusiness.Tables[BusinessDataSetIndex.GroupAvailableUser]); _DataProxy.ShowGroupAutority(_CurrentBusiness.Tables[BusinessDataSetIndex.GroupAuthorities]); } base.DoDelete(sender); Msg.ShowInformation("删除成功!"); } else { Msg.ShowError("删除发生错误!"); } } catch (Exception e) { Msg.ShowException(e); } }