mModule newModule(string parentid) { mModule obj = new mModule(); obj.Modu_ID = obj.CreateID(); obj.ParentID = parentid; obj.visiableFlag = true; if (parentid == "0") obj.ModuName = "新系统"; else obj.ModuName = "新模块"; sqlmap.Create<mModule>(obj); _BindingList.Add(obj); treeList1.SetFocusedNode(treeList1.FindNodeByKeyID(obj.Modu_ID)); return obj; }
public void OpenModule(mModule obj) { object instance = null;//模块接口 this.Cursor = Cursors.WaitCursor; try { object result = null; if (obj.MethodParam == null || string.IsNullOrEmpty(obj.MethodName)) result = MainHelper.Execute(obj.AssemblyFileName, obj.ModuTypes, obj.MethodName, null, null, ref instance); else { result = Execute(obj.AssemblyFileName, obj.ModuTypes, obj.MethodName, obj.MethodParam.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries), null, ref instance); } if (result is UserControl) { instance = showControl(result as UserControl, obj.Modu_ID); } if (instance is Form) { Form fb = instance as Form; fb.Text = obj.ModuName; Dictionary<string, object> dic = new Dictionary<string, object>(); dic.Add("Modu_ID", obj.Modu_ID); fb.Tag = dic; } this.Cursor = Cursors.Default; } catch (Exception err) { this.Cursor = Cursors.Default; MsgBox.ShowException(err); } }
void treeViewOperator_AfterDelete(mModule newobj) { if (AfterDelete != null) AfterDelete(treeList1, newobj); }
void treeViewOperator_AfterEdit(mModule newobj) { if (AfterAdd != null) AfterEdit(treeList1, newobj); }
public void OpenModule(mModule obj) { object instance = null;//模块接口 //this.WindowState = FormWindowState.Minimized; try { object result = null; if (obj.MethodParam == null || string.IsNullOrEmpty(obj.MethodName)) { result = MainHelper.Execute(obj.AssemblyFileName, obj.ModuTypes, obj.MethodName, null, this, ref instance); } else { result = MainHelper.Execute(obj.AssemblyFileName, obj.ModuTypes, obj.MethodName, obj.MethodParam.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)); } if (result is UserControl) { instance = showControl(result as UserControl, obj.Modu_ID, obj.ModuName); } if (instance is Form) { Form fb = instance as Form; fb.Visible = false; fb.Text = obj.ModuName; fb.Size = new Size(800, 600); fb.StartPosition = FormStartPosition.CenterScreen; fb.ShowDialog(); } this.Cursor = Cursors.Default; } catch (Exception err) { this.Cursor = Cursors.Default; MsgBox.ShowException(err); } finally { //this.WindowState = FormWindowState.Normal; } }
void treeViewOperator_CreatingObject(mModule newobj) { newobj.visiableFlag = true; }
protected override void OnShown(EventArgs e) { base.OnShown(e); MainHelper.MainForm = this; InitSkins(); MethodInvoker m = delegate() { mModule module = new mModule(); module.ModuTypes = "Ebada.Scgl.Gis.frmMapM"; module.ModuName = "地理信息"; module.AssemblyFileName = "Ebada.Scgl.Gis.dll"; OpenModule(module); }; login(); Application.DoEvents(); try { BeginInvoke(m); } catch { } }
void treeViewOperator_CreatingObject(mModule newobj) { newobj.visiableFlag = true; newobj.Description = xtdm; newobj.ActivityFlag = true; }
/// <summary> /// /// </summary> /// <param name="assemblyFileName"></param> /// <param name="moduTypes"></param> /// <param name="methodName"></param> /// <param name="moduName"></param> /// <returns></returns> public static object CreatNewMoldeIns(string assemblyFileName, string moduTypes, string methodName, string moduName, mModule obj) { object fromCtrl; Assembly assembly = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + assemblyFileName); Type tp = assembly.GetType(moduTypes); //MethodInfo method = tp.GetMethod(methodName); //if (methodName == "")////窗体的构造函数不需要参数 fromCtrl = Activator.CreateInstance(tp); //else//窗体的构造函数需要参数 // fromCtrl = Activator.CreateInstance(tp, methodName); object instance = null; if (obj == null || obj.MethodParam == null || string.IsNullOrEmpty(obj.MethodName)) { } else { fromCtrl = Execute(obj.AssemblyFileName, obj.ModuTypes, obj.MethodName, obj.MethodParam.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries), null, ref instance); } if (fromCtrl is UserControl) { UserControl uc = fromCtrl as UserControl; uc.Name = moduName; } else if (fromCtrl is Form) { Form fm = fromCtrl as Form; fm.Name = moduName; } //if (method != null) //{ // object[] objArray = new object[0]; // method.Invoke(fromCtrl, objArray); //} //else //{ // ((Form)fromCtrl).ShowDialog(); //} return fromCtrl; }
public void OpenModule(mModule obj) { //检查模块是否已经打开 if (openFormList.ContainsKey(obj.Modu_ID)) { openFormList[obj.Modu_ID].Activate(); return; } object instance = null;//模块接口 barEditItem1.Visibility = BarItemVisibility.Always; this.Cursor = Cursors.WaitCursor; try { object result = null; if (obj.MethodParam == null || string.IsNullOrEmpty(obj.MethodName) ) result = MainHelper.Execute(obj.AssemblyFileName, obj.ModuTypes, obj.MethodName, null, this, ref instance); else { result = Execute(obj.AssemblyFileName, obj.ModuTypes, obj.MethodName, obj.MethodParam.Split(",".ToCharArray(),StringSplitOptions.RemoveEmptyEntries), this, ref instance); } if (result is UserControl) { instance = showControl(result as UserControl, obj.Modu_ID); } if (instance is Form) { Form fb = instance as Form; openFormList.Add(obj.Modu_ID, fb); fb.Text = obj.ModuName; fb.FormClosed += frmMain_ChildFormClosed; Dictionary<string, object> dic = new Dictionary<string, object>(); dic.Add("Modu_ID", obj.Modu_ID); fb.Tag = dic; } this.Cursor = Cursors.Default; } catch (Exception err) { this.Cursor = Cursors.Default; MsgBox.ShowException(err); } finally { barEditItem1.Visibility = BarItemVisibility.Never; } }
private void IniWFData(string parentid) { List<mModule> list2 = new List<mModule>(); IList<WF_WorkFlowClass> wfcli = MainHelper.PlatformSqlMap.GetList<WF_WorkFlowClass>("SelectWF_WorkFlowClassList", "where clLevel='0' order by Caption"); foreach (WF_WorkFlowClass wfc in wfcli) { mModule md = new mModule(); md.Modu_ID = wfc.WFClassId; md.ModuName = wfc.Caption; md.ParentID = parentid; md.ModuTypes = "hide"; md.Description = "工作流"; list2.Add(md); IniWFTData(wfc.WFClassId,ref list2); ReWFData(wfc.WFClassId, ref list2); } SqlQueryObject obj3 = new SqlQueryObject(SqlQueryType.Update, "InsertWFmModule", list2.ToArray()); try { List<SqlQueryObject> list3 = new List<SqlQueryObject>(); list3.Add(obj3); MainHelper.PlatformSqlMap.ExecuteTransationUpdate(list3); } catch (Exception exception) { MainHelper.ShowWarningMessageBox(exception.Message); } }
private void ReWFData(string WFClassId,ref List<mModule> list2) { IList<WF_WorkFlowClass> wfcli = MainHelper.PlatformSqlMap.GetList<WF_WorkFlowClass>("SelectWF_WorkFlowClassList", "where FatherId='" + WFClassId + "' order by Caption"); foreach (WF_WorkFlowClass wfc in wfcli) { mModule md = new mModule(); md.Modu_ID = wfc.WFClassId; md.ModuName = wfc.Caption; md.ParentID = WFClassId; md.ModuTypes = "hide"; md.Description = "工作流"; list2.Add(md); IniWFTData(wfc.WFClassId, ref list2); ReWFData(wfc.WFClassId, ref list2); } }
private void IniWFTData(string WFClassId,ref List<mModule> list2) { IList<WF_WorkFlow> wfli = MainHelper.PlatformSqlMap.GetList<WF_WorkFlow>("SelectWF_WorkFlowList", "where WFClassId='" + WFClassId + "' order by FlowCaption"); foreach (WF_WorkFlow wf in wfli) { mModule md = new mModule(); md.Modu_ID = wf.WorkFlowId; md.ModuName = wf.FlowCaption; md.ModuTypes = "hide"; md.ParentID = WFClassId; md.Description = "工作流"; list2.Add(md); object obj = MainHelper.PlatformSqlMap.GetObject("SelectWF_WorkTaskPowerList", " where PowerName='全程跟踪' and WorkFlowId='" + wf.WorkFlowId + "' and WorkTaskId='" + wf.WorkFlowId + "'"); if (obj != null) { md = new mModule(); md.Modu_ID = ((WF_WorkTaskPower)obj).Powerid; md.ModuName = "全程跟踪"; md.ModuTypes = "hide"; md.ParentID = wf.WorkFlowId; md.Description = "全程跟踪"; list2.Add(md); } //IList<WF_WorkTask> wftli = MainHelper.PlatformSqlMap.GetList<WF_WorkTask>("SelectWF_WorkTaskList", "where WorkFlowId='" + wf.WorkFlowId + "' and OperRule='1' order by TaskTypeId"); IList<WF_WorkTask> wftli = MainHelper.PlatformSqlMap.GetList<WF_WorkTask>("SelectWF_WorkTaskList", "where WorkFlowId='" + wf.WorkFlowId + "' and TaskTypeId!='2' order by TaskTypeId"); foreach (WF_WorkTask wft in wftli) { md = new mModule(); md.Modu_ID = wft.WorkTaskId; md.ModuName = wft.TaskCaption; md.ParentID = wf.WorkFlowId; md.ModuTypes = "hide"; md.Description = "工作流"; list2.Add(md); } } }
private void IniWFTData(string WFClassId,ref List<mModule> list2) { IList<WF_WorkFlow> wfli = MainHelper.PlatformSqlMap.GetList<WF_WorkFlow>("SelectWF_WorkFlowList", "where WFClassId='" + WFClassId+"'"); foreach (WF_WorkFlow wf in wfli) { mModule md = new mModule(); md.Modu_ID = wf.WorkFlowId; md.ModuName = wf.FlowCaption; md.ModuTypes = "hide"; md.ParentID = WFClassId; md.Description = "工作流"; list2.Add(md); IList<WF_WorkTask> wftli = MainHelper.PlatformSqlMap.GetList<WF_WorkTask>("SelectWF_WorkTaskList", "where WorkFlowId='" + wf.WorkFlowId + "'"); foreach (WF_WorkTask wft in wftli) { md = new mModule(); md.Modu_ID = wft.WorkTaskId; md.ModuName = wft.TaskCaption; md.ParentID = wf.WorkFlowId; md.ModuTypes = "hide"; md.Description = "工作流"; list2.Add(md); } } }
public void OpenModule(mModule obj) { //检查模块是否已经打开 if (openFormList.ContainsKey(obj.Modu_ID)) { openFormList[obj.Modu_ID].Activate(); BeginInvoke(new MethodInvoker(endProgress)); return; } object instance = null;//模块接口 this.Cursor = Cursors.WaitCursor; try { object result = MainHelper.Execute(obj.AssemblyFileName, obj.ModuTypes, obj.MethodName, null, this, ref instance); if (result is UserControl) { instance = showControl(result as UserControl); } if (instance is FormBase) { FormBase fb = instance as FormBase; openFormList.Add(obj.Modu_ID, instance as FormBase); ((FormBase)instance).Text = obj.ModuName; ((FormBase)instance).FormClosed += frmMain_ChildFormClosed; ((FormBase)instance).Tag = obj.Modu_ID; } this.Cursor = Cursors.Default; } catch (Exception err) { this.Cursor = Cursors.Default; BeginInvoke(new MethodInvoker(endProgress)); MainHelper.ShowException(err); } BeginInvoke(new MethodInvoker(endProgress)); }