/// <summary> /// 打开对应的业务类型(方法) /// </summary> /// <param name="pro"></param> public void ShowNewAction(_Profession pro) { switch (pro.CommandName.Trim()) { case "1": //项目工程操作 APP.FileType = "项目工程"; this.NewProjects(pro); break; case "2": //单项工程操作 //this.NewEngineering(pro); break; case "3": //单位工程 this.NewUnitProject(pro); break; case "4": //XML数据导入 case "5": ShowOpenAction(); //this.NewProjectsByXML(); break; case "6": //打开文件对话框 ShowOpenAction(); break; } }
/// <summary> /// 打开文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Open_Click(object sender, EventArgs e) { //这里只创建Profession对象 if (this.m_Profession == null) { this.m_Profession = new _Profession(); } this.m_Profession.Files = new _Files(); this.m_Profession.CommandName = "6"; //设置工作目录 this.DialogResult = DialogResult.OK; }
/// <summary> /// 创建新的项目向导(直接处理项目操作) /// </summary> private void NewProjects(_Profession pro) { ///初始化项目工作流(返回工作流对象) NewProjectsInfo form = new NewProjectsInfo(); form.Profession = pro; DialogResult result = form.ShowDialog(this.MdiParent); if (result == DialogResult.OK) { //新项目操作界面 this.OpenNewBussinessForm(form.CurrentBusiness); } }
/// <summary> /// 创建新的单位工程向导(非集合容器业务直接创建) /// </summary> /// <param name="pro"></param> private void NewUnitProject(_Profession pro) { //单位工程的创建不限类别操作 NewUnitProjectForm f = new NewUnitProjectForm(); f.IsContainer = false; f.Profession = pro; DialogResult result = f.ShowDialog(this.MdiParent); if (result == DialogResult.OK) { this.OpenNewBussinessForm(f.CurrentBusiness); } }
/// <summary> /// 添加单位工程 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Create_Unit_Click(object sender, EventArgs e) { //这里只创建Profession对象 if (this.m_Profession == null) { this.m_Profession = new _Profession(); } this.m_Profession.Files = new _Files(); this.m_Profession.CommandName = "3"; //设置工作目录 APP.Application.Global.WorkFolder = new System.IO.DirectoryInfo(this.buttonEdit1.Text.Trim()); this.m_Profession.Files.ExtName = _Files.CUnitProjectExName; this.m_Profession.Files.DirName = this.buttonEdit1.Text.Trim(); this.m_Profession.Files.FileName = textEdit2.Text.Trim(); this.DialogResult = DialogResult.OK; }
/// <summary> /// 确定创建新业务(新业务类型 此处仅告诉系统我门要做什么) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton1_Click(object sender, EventArgs e) { if (this.GetSelectItem == null) { return; } string cName = this.GetSelectItem["CmdName"].ToString(); //这里只创建Profession对象 if (this.m_Profession == null) { this.m_Profession = new _Profession(); } this.m_Profession.Files = new _Files(); this.m_Profession.CommandName = cName; //设置工作目录 APP.Application.Global.WorkFolder = new System.IO.DirectoryInfo(this.buttonEdit1.Text.Trim()); switch (this.m_Profession.CommandName.Trim()) { case "1": //创建项目的 Profession //APP.Operation.Init(CAppType.PROJECT); //准备加入的元素 //APP.BObjects = _BObjects.CreateInstance(EBObjectType.PROJECT); //初始化工作 this.m_Profession.Files.ExtName = _Files.ProjectExName; this.m_Profession.Files.DirName = this.buttonEdit1.Text.Trim(); this.m_Profession.Files.FileName = textEdit2.Text.Trim(); //设置文件属性 //APP.General.CurrentProject.Files = files; break; case "2": //单项工程 //APP.BObjects = _BObjects.CreateInstance(EBObjectType.Engineering); APP.WorkFlows.Init(EWorkFlowType.Engineering); this.m_Profession.Files.ExtName = _Files.EngineeringExName; this.m_Profession.Files.DirName = this.buttonEdit1.Text.Trim(); this.m_Profession.Files.FileName = textEdit2.Text.Trim(); break; case "3": //创建单位工程的Profession //APP.Operation.Init(CAppType.UnitProject); this.m_Profession.Files.ExtName = _Files.CUnitProjectExName; this.m_Profession.Files.DirName = this.buttonEdit1.Text.Trim(); this.m_Profession.Files.FileName = textEdit2.Text.Trim(); break; case "4": case "5": //通过XML创建项目 APP.WorkFlows.Init(EWorkFlowType.PROJECT);; this.m_Profession.Files.ExtName = _Files.CUnitProjectExName; this.m_Profession.Files.DirName = this.buttonEdit1.Text.Trim(); this.m_Profession.Files.FileName = textEdit2.Text.Trim(); break; } //文件名默认与项目名称同名 此处暂时取消验证 /*if (this.m_Profession.Files.Verification()) * { * //如果文件存在 提示 * MessageBox.Show(this, _Prompt.文件已经存在, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); * } * else * { * //同意提交 * this.DialogResult = DialogResult.OK; * }*/ this.DialogResult = DialogResult.OK; }