private void ToolBar_BtnDeleteClick(object sender, EventArgs e) { this.EditState = DefineConstantValue.EditStateEnum.OE_Delete; Model.General.ReturnValueInfo msg = new Model.General.ReturnValueInfo(); Model.Base.DataBaseCommandInfo com = new Model.Base.DataBaseCommandInfo(); Model.Base.DataBaseCommandKeyInfo comkey = new Model.Base.DataBaseCommandKeyInfo(); Sys_UserMaster_usm_Info Info = new Sys_UserMaster_usm_Info(); try { comkey.KeyValue = iRecordID; if (comkey.KeyValue != string.Empty && comkey.KeyValue != "0") { Info.usm_iRecordID = Convert.ToInt32(comkey.KeyValue); _sysUserMasterBL.Save(Info, Common.DefineConstantValue.EditStateEnum.OE_Delete); SetOpenToolBar(); Handel(Common.DefineConstantValue.GetReocrdEnum.GR_Next); if (Info.usm_iRecordID == int.Parse(iRecordID)) { Handel(DefineConstantValue.GetReocrdEnum.GR_Previous); } if (Info.usm_iRecordID == int.Parse(iRecordID)) { SetOpenToolBar(); ToolBar.BtnPreviousEnabled = false; ToolBar.BtnLastEnabled = false; ToolBar.BtnFirstEnabled = false; ToolBar.BtnNextEnabled = false; ToolBar.BtnModifyEnabled = false; ToolBar.BtnDeleteEnabled = false; ToolBar.BtnSearchEnabled = false; } } } catch (Exception Ex) { ShowErrorMessage(Ex); } }
private void ToolBar_BtnCancelClick(object sender, EventArgs e) { this.EditState = DefineConstantValue.EditStateEnum.OE_ReaOnly; Model.Base.DataBaseCommandKeyInfo comkey = new Model.Base.DataBaseCommandKeyInfo(); Sys_UserMaster_usm_Info Info = new Sys_UserMaster_usm_Info(); try { comkey.KeyValue = iRecordID; if (comkey.KeyValue != string.Empty && comkey.KeyValue != "0") { Info.usm_iRecordID = Convert.ToInt32(comkey.KeyValue); Model.IModel.IModelObject result = _sysUserMasterBL.DisplayRecord(Info); Info = result as Sys_UserMaster_usm_Info; ShowInfo(Info); SetOpenToolBar(); SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly); } else { Handel(DefineConstantValue.GetReocrdEnum.GR_Last); } } catch (Exception Ex) { ShowErrorMessage(Ex); } }
private void Handel(Common.DefineConstantValue.GetReocrdEnum type) { Model.General.ReturnValueInfo msg = new Model.General.ReturnValueInfo(); Model.Base.DataBaseCommandInfo com = new Model.Base.DataBaseCommandInfo(); Model.Base.DataBaseCommandKeyInfo comkey = new Model.Base.DataBaseCommandKeyInfo(); comkey.KeyValue = iRecordID; com.KeyInfoList.Add(comkey); Sys_UserMaster_usm_Info info = null; switch (type) { case Common.DefineConstantValue.GetReocrdEnum.GR_First: try { info = _sysUserMasterBL.GetRecord_First(); if (info.usm_iRecordID != 0) { ShowInfo(info); SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly); } else { ToolBar.BtnModifyEnabled = false; ToolBar.BtnDeleteEnabled = false; ToolBar.BtnLastEnabled = false; ToolBar.BtnNextEnabled = false; ToolBar.BtnSearchEnabled = false; txtcName.Text = string.Empty; //txtcNumber.Text = string.Empty; txtcRemark.Text = string.Empty; lvwMaster.Items.Clear(); SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly); } } catch (Exception Ex) { ShowErrorMessage(Ex); } break; case Common.DefineConstantValue.GetReocrdEnum.GR_Next: try { info = _sysUserMasterBL.GetRecord_Next(com); if (info == null) { Handel(DefineConstantValue.GetReocrdEnum.GR_Last); //info = _sysUserMasterBL.GetRecord_Last(); ToolBar.BtnLastEnabled = false; ToolBar.BtnNextEnabled = false; } else { info = _sysUserMasterBL.GetRecord_Next(com); } ShowInfo(info); SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly); } catch (Exception Ex) { ShowErrorMessage(Ex); } break; case Common.DefineConstantValue.GetReocrdEnum.GR_Previous: try { info = _sysUserMasterBL.GetRecord_Previous(com); if (info == null) { info = _sysUserMasterBL.GetRecord_First(); ToolBar.BtnFirstEnabled = false; ToolBar.BtnPreviousEnabled = false; } else { info = _sysUserMasterBL.GetRecord_Previous(com); } ShowInfo(info); SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly); } catch (Exception Ex) { ShowErrorMessage(Ex); } break; case Common.DefineConstantValue.GetReocrdEnum.GR_Last: try { info = _sysUserMasterBL.GetRecord_Last(); if (info.usm_iRecordID != 0) { ShowInfo(info); SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly); } else { ToolBar.BtnFirstEnabled = false; ToolBar.BtnPreviousEnabled = false; ToolBar.BtnModifyEnabled = false; ToolBar.BtnDeleteEnabled = false; ToolBar.BtnLastEnabled = false; ToolBar.BtnNextEnabled = false; ToolBar.BtnSearchEnabled = false; txtcName.Text = string.Empty; //txtcNumber.Text = string.Empty; txtcRemark.Text = string.Empty; lvwMaster.Items.Clear(); SetTxtBox(DefineConstantValue.EditStateEnum.OE_ReaOnly); } } catch (Exception Ex) { ShowErrorMessage(Ex); } break; } }
private void ToolBar_BtnDeleteClick(object sender, EventArgs e) { Model.General.ReturnValueInfo returnValue = new Model.General.ReturnValueInfo(); CodeMaster_cmt_Info info = new CodeMaster_cmt_Info(); Model.Base.DataBaseCommandInfo com = new Model.Base.DataBaseCommandInfo(); info.cmt_iRecordID = _CmtInfo.cmt_iRecordID; returnValue = _ICodeMasterBL.Save(info, DefineConstantValue.EditStateEnum.OE_Delete); if (returnValue.boolValue) { com.CommandType = Model.Base.DataBaseCommandType.Next; Model.Base.DataBaseCommandKeyInfo comKey = new Model.Base.DataBaseCommandKeyInfo(); comKey.KeyValue = info.cmt_iRecordID.ToString(); com.KeyInfoList.Add(comKey); try { _CmtInfo = _ICodeMasterBL.GetRecord_Next(com); } catch (Exception Ex) { ShowErrorMessage(Ex); } if (_CmtInfo == null) { com.CommandType = Model.Base.DataBaseCommandType.Previous; try { _CmtInfo = _ICodeMasterBL.GetRecord_Previous(com); } catch (Exception Ex) { ShowErrorMessage(Ex); } ShowData(_CmtInfo); this.EditState = DefineConstantValue.EditStateEnum.OE_ReaOnly; SetControlStatus(DefineConstantValue.EditStateEnum.OE_ReaOnly); SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Last); if (_CmtInfo == null) { cboKey1.Text = string.Empty; SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Null); } } } }
private void HandelResult_PreviousOrNext(DefineConstantValue.GetReocrdEnum recordState) { CodeMaster_cmt_Info info = new CodeMaster_cmt_Info(); try { Model.Base.DataBaseCommandInfo com = new Model.Base.DataBaseCommandInfo(); switch (recordState) { case DefineConstantValue.GetReocrdEnum.GR_Next: com.CommandType = Model.Base.DataBaseCommandType.Next; break; case DefineConstantValue.GetReocrdEnum.GR_Previous: com.CommandType = Model.Base.DataBaseCommandType.Previous; break; default: break; } Model.Base.DataBaseCommandKeyInfo comKey = new Model.Base.DataBaseCommandKeyInfo(); info = _CmtInfo; comKey.KeyValue = _CmtInfo.cmt_iRecordID.ToString(); com.KeyInfoList.Add(comKey); switch (recordState) { case DefineConstantValue.GetReocrdEnum.GR_Next: _CmtInfo = _ICodeMasterBL.GetRecord_Next(com); if (_CmtInfo != null) { SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Middle); } else { SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Last); _CmtInfo = info; } break; case DefineConstantValue.GetReocrdEnum.GR_Previous: _CmtInfo = _ICodeMasterBL.GetRecord_Previous(com); if (_CmtInfo != null) { SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Middle); } else { SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_First); _CmtInfo = info; } break; default: break; } //顯視數據處理 ShowData(_CmtInfo); } catch (Exception Ex) { ShowErrorMessage(Ex); } }
private void SysToolBar_BtnDeleteClick(object sender, EventArgs e) { this.EditState = DefineConstantValue.EditStateEnum.OE_Delete; Model.General.ReturnValueInfo msg = new Model.General.ReturnValueInfo(); Model.Base.DataBaseCommandInfo com = new Model.Base.DataBaseCommandInfo(); Model.Base.DataBaseCommandKeyInfo comkey = new Model.Base.DataBaseCommandKeyInfo(); Sys_FormMaster_fom_Info Info = new Sys_FormMaster_fom_Info(); try { comkey.KeyValue = _iRecordID; Info.fom_iParentID = int.Parse(_iRecordID); if (_ISysFormMasterBL.SearchRecords(Info).Count > 0) { msg.messageText = "该表单含有子表单,请先删除子表单!"; ShowInformationMessage(msg.messageText); SetOpenToolBar(); } else { if (comkey.KeyValue != string.Empty && comkey.KeyValue != "0") { Info.fom_iRecordID = Convert.ToInt32(comkey.KeyValue); _ISysFormMasterBL.Save(Info, Common.DefineConstantValue.EditStateEnum.OE_Delete); SetOpenToolBar(); //Handel(Common.DefineConstantValue.GetReocrdEnum.GR_Next); Bind(); BindTreeView(); } } } catch (Exception Ex) { ShowErrorMessage(Ex); } }