/// <summary> /// 开启一个业务操作(项目管理) /// </summary> private void openProjects(_Business p_bus, bool ISTBS) { //项目窗体创建 CWellComeProject form = new CWellComeProject(); form.ModelChange += new ModelChangeHandler(form_ModelChange); //业务对象 form.CurrentBusiness = p_bus; //指定项目对象 form.FormBorderStyle = FormBorderStyle.None; form.Dock = DockStyle.Fill;//设置样式是否填充整个PANEL //设置为非顶级控件 form.TopLevel = false; //显示窗体 form.Visible = true; //超创建项目 form.MdiParent = MdiParent; if (ISTBS) { // DialogResult d= MsgBox.Show("导入成功,是否计算所有项目?", MessageBoxButtons.OKCancel); // if(d==DialogResult.OK) BackgroundWorker ProjWorker = new BackgroundWorker(); ProjWorker.WorkerReportsProgress = true; ProjWorker.DoWork += new DoWorkEventHandler(ProjWorker_DoWork); ProjWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ProjWorker_RunWorkerCompleted); ProjWorker.RunWorkerAsync(p_bus); ProgressFrom p = new ProgressFrom(ProjWorker); p.ShowDialog(); //(p_bus as _Pr_Business).CalculateForXml(); } }
/// <summary> /// 通过xml创建项目 /// </summary> /// <param name="p_files"></param> /// <returns></returns> private static CResult openProjectByxml(_Files p_files, ApplicationForm from) { CResult result = new CResult(); //初始化一个新的项目业务 _Business bus = APP.WorkFlows.Init(EWorkFlowType.PROJECT); //读取业务文件 //CResult result = bus.LoadByXml(p_files); //准备工作 XmlProjWorker projWorker = new XmlProjWorker(bus); projWorker.FileName = p_files.FullName; projWorker.form = from; projWorker.Load(); projWorker.Begin(); /*_ImportXML xml = new _ImportXML(bus); * xml.RevertXmlObject += new RevertXmlObject(xml_RevertXmlObject); * xml.FileName = p_files.FullName; * BackgroundWorker XmlProjWorker = new BackgroundWorker(); * XmlProjProgressAction form = new XmlProjProgressAction(XmlProjWorker); * XmlProjWorker.WorkerReportsProgress = true; * XmlProjWorker.DoWork += new DoWorkEventHandler(XmlProjWorker_DoWork); * XmlProjWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(XmlProjWorker_RunWorkerCompleted); * * XmlObject = new object[2] { XmlProjWorker ,1}; * object param = new object[] { from, p_files, bus, xml, form }; * XmlProjWorker.RunWorkerAsync(param); * * form.ShowDialog();*/ return(result); }
public InsertYTLBSummaryForm(_Business p_Business, _UnitProject p_Activitie) { this.CurrentBusiness = p_Business; this.Activitie = p_Activitie; m_Methods_YTLBSummary = new _Methods_YTLBSummary(p_Activitie); InitializeComponent(); }
public InventoryGraphAnalysis(_Business p_Business, _UnitProject p_Activitie, ABaseForm p_AParentForm) { this.CurrentBusiness = p_Business; this.Activitie = p_Activitie; this.AParentForm = p_AParentForm; m_Methods_Subheadings = new _Methods_Subheadings(this.Activitie); InitializeComponent(); }
/// <summary> /// 构造 /// </summary> /// <param name="p_Business">当前业务</param> /// <param name="p_Activitie">当前单位工程</param> /// <param name="p_AParentForm">父级窗体</param> public StandardConversionForm(_Business p_Business, _UnitProject p_Activitie, ABaseForm p_AParentForm) { this.CurrentBusiness = p_Business; this.Activitie = p_Activitie; this.AParentForm = p_AParentForm; m_Methods_Subheadings = new _Methods_Subheadings(this.Activitie); m_Methods_StandardConversion = new _Methods_StandardConversion(this.Activitie); InitializeComponent(); }
public AreaQuantityUnit(_Business p_Business, _UnitProject p_Activitie, ABaseForm p_AParentForm, string p_FormName) { this.CurrentBusiness = p_Business; this.Activitie = p_Activitie; this.AParentForm = p_AParentForm; m_Methods_Subheadings = new _Methods_Subheadings(this.Activitie); this.Text = p_FormName; InitializeComponent(); }
/// <summary> /// 构造 /// </summary> /// <param name="p_Business">当前业务</param> /// <param name="p_Activitie">当前单位工程</param> /// <param name="p_AParentForm">父级窗体</param> public SubheadingsQuantityUnit(_Business p_Business, _UnitProject p_Activitie, ABaseForm p_AParentForm) { this.CurrentBusiness = p_Business; this.Activitie = p_Activitie; this.AParentForm = p_AParentForm; m_Methods_Subheadings = new _Methods_Subheadings(this.Activitie); m_Methods_Quantity = new _Methods_Quantity(this.Activitie); m_Methods_YTLBSummary = new _Methods_YTLBSummary(this.Activitie); InitializeComponent(); }
/// <summary> /// 开启一个新的业务操作窗口(可能是项目或者是单项工程) /// </summary> /// <param name="p_bus"></param> public void OpenNewBussinessForm(_Business p_bus, bool ISTBS) { switch (p_bus.WorkFlowType) { case EWorkFlowType.PROJECT: //开启项目业务 this.openProjects(p_bus, ISTBS); break; case EWorkFlowType.UnitProject: //开启新的单位工程业务 this.openUnitProjects(p_bus); break; } }
/// <summary> /// 打开单位工程的操作 /// </summary> /// <param name="p_files"></param> /// <returns></returns> private static void openUnitProject(_Files p_files, ApplicationForm from) { _Business bus = APP.WorkFlows.Init(EWorkFlowType.UnitProject); object param = new object[] { from, p_files, bus }; BackgroundWorker UnitWorker = new BackgroundWorker(); UnitWorker.WorkerReportsProgress = true; UnitWorker.DoWork += new DoWorkEventHandler(UnitWorker_DoWork); UnitWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(UnitWorker_RunWorkerCompleted); UnitWorker.RunWorkerAsync(param); ProgressFrom form = new ProgressFrom(UnitWorker); form.ShowDialog(); }
/// <summary> /// 非容器类型提交 /// </summary> private void doNotContainerClick() { //创建工作流了单个单位工程 this.m_CurrentBusiness = APP.WorkFlows.Init(EWorkFlowType.UnitProject); _UnitProject info = this.UnitProject; (this.m_CurrentBusiness as _Un_Business).Create(info); this.m_CurrentBusiness.Current.Files = this.Profession.Files; this.m_CurrentBusiness.Current.Files.FileName = info.Name; (this.m_CurrentBusiness as _Un_Business).EndCreate(); //info.Files = this.Profession.Files; //info.Files.FileName = info.Property.Basis.Name; //APP.WorkFlows.NotContainer.Create(this.UnitProject); }
static void XmlProjWorker_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker XmlProjWorker = sender as BackgroundWorker; object[] param = e.Argument as object[]; ApplicationForm form = param[0] as ApplicationForm; _Files file = param[1] as _Files; _Business bus = param[2] as _Business; _ImportXML xml = param[3] as _ImportXML; XmlProjProgressAction pf = param[4] as XmlProjProgressAction; xml.Load(); object p = new object[] { true, xml.Count }; XmlProjWorker.ReportProgress(0, p); bus.Current = xml.Import(); e.Result = new object[] { form, file, bus }; }
/// <summary> /// 根据文件对象打开文件业务 /// </summary> /// <param name="p_Info"></param> /*public bool OpenProject(FileInfo p_Info) * { * //如果文件存在 * if (p_Info.Exists) * { * CResult r = APP.Methods.Open(p_Info.FullName); * //创建文件对象 * if (r.Success) * { * _Business bus = r.Value as _Business; * if (this.Validation(bus)) * { * //开启新业务窗体 * this.ActionFace.OpenNewBussinessForm(bus); * return true; * } * else * { * return false; * } * } * else * { * MessageBox.Show(this, r.ErrorInformation, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); * return false; * } * } * return false; * * }*/ /// <summary> /// 打开项目(打开方式) /// </summary> /*private void OpenProject() * { * System.Windows.Forms.DialogResult result = this.openFileDialog1.ShowDialog(); * * if (result == DialogResult.OK) * { * CResult r = APP.Methods.Open(this.openFileDialog1.FileName); * //创建文件对象 * if (r.Success) * { * _Business bus = r.Value as _Business; * if (this.Validation(bus)) * { * //开启新业务窗体 * this.ActionFace.OpenNewBussinessForm(bus); * } * } * else * { * MessageBox.Show(this, r.ErrorInformation, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); * } * } * }*/ /// <summary> /// 开启密码效验窗体 /// </summary> /// <returns></returns> public bool Validation(_Business p_bus) { //如果为null或者为空验证通过 if (p_bus.Current.PassWord != string.Empty) { CValidationPWD form = new CValidationPWD(); form.CurrentBusiness = p_bus; form.Source = p_bus.Current; DialogResult r = form.ShowDialog(); if (r == DialogResult.OK) { //验证通过 return(true); } return(false); } return(true); }
/// <summary> /// 开启一个新业务操作(单位工程) /// </summary> /// <param name="p_bus"></param> private void openUnitProjects(_Business p_bus) { //项目窗体创建 ProjectForm form = new ProjectForm(); form.ModelChange += new ModelChangeHandler(form_ModelChange); //业务对象 form.CurrentBusiness = p_bus; //指定项目对象 form.FormBorderStyle = FormBorderStyle.None; form.Dock = DockStyle.Fill;//设置样式是否填充整个PANEL //设置为非顶级控件 form.TopLevel = false; //显示窗体 form.Visible = true; //超创建项目 form.MdiParent = MdiParent; }
/// <summary> /// 打开项目的过程 /// </summary> private static void openProject(_Files p_files, ApplicationForm from) { //初始化一个新的项目业务 _Business bus = APP.WorkFlows.Init(EWorkFlowType.PROJECT); //打开一个业务文件 //bus.Open(p_files); //打开业务操作窗体 //from.ActionFace.OpenNewBussinessForm(bus); object param = new object[] { from, p_files, bus }; BackgroundWorker ProjWorker = new BackgroundWorker(); ProjWorker.WorkerReportsProgress = true; ProjWorker.DoWork += new DoWorkEventHandler(ProjWorker_DoWork); ProjWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ProjWorker_RunWorkerCompleted); ProjWorker.RunWorkerAsync(param); ProgressFrom form = new ProgressFrom(ProjWorker); form.ShowDialog(); }
static void ProjWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { object[] result = e.Result as object[]; if (result == null) { return; } ApplicationForm form = result[0] as ApplicationForm; _Business bus = result[1] as _Business; //效验函数 //if (form.Validation(bus)) //{ //this.DialogResult = DialogResult.Cancel; APP.Cache.HistoryCache.Add(new FileInfo(bus.Current.Files.FullName)); APP.Cache.HistoryCache.Save(); //开启业务窗体 form.ActionFace.OpenNewBussinessForm(bus); // } }
/// <summary> /// 单位工程处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void UnitWorker_DoWork(object sender, DoWorkEventArgs e) { try { BackgroundWorker ProjWorker = sender as BackgroundWorker; object[] param = e.Argument as object[]; ApplicationForm form = param[0] as ApplicationForm; _Files file = param[1] as _Files; _Business bus = param[2] as _Business; using (FileStream stream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read)) { //stream.Position = 0; GZipStream zip = new GZipStream(stream, CompressionMode.Decompress, true); { //zip.Seek(0, SeekOrigin.Begin); BinaryFormatter formater = new BinaryFormatter(); _FileHeader header = (_FileHeader)formater.Deserialize(zip); _StructSource ds = (_StructSource)formater.Deserialize(zip); //创建新的单位工程(单位工程业务体) _UnitProject unit = new _UnitProject(); unit.Files = file; unit.Ready(ds); //初始化新的临时对象(不参与序列化此对象每次使用需要呗初始化) /*obj.Property.Temporary = new _Temporary(); * //默认同步临时库对象 * obj.Property.Temporary.Libraries = obj.Property.DLibraries.Copy(); * obj.Property.Temporary.Libraries.Init(APP.Application); * obj.Application = APP.Application;*/ e.Result = new object[] { form, unit, bus }; } zip.Close(); } } catch (Exception) { MsgBox.Show(_Prompt.无法识别的打开文件, MessageBoxButtons.OK); } }
private void CreateZJF(_Business m_Currentbus, _Entity_SubInfo item, DataRow row, Calculator calculator) { if (calculator == null) { calculator = new Calculator(m_Currentbus, Parent); } _SubSegmentsSource sorce = null; GLODSOFT.QDJJ.BUSINESS._Methods_Fixed fix = null; if (item.SSLB == 0) { sorce = this.Parent.StructSource.ModelSubSegments; fix = new _Methods_Fixed(m_Currentbus, this.Parent, item); } else { sorce = this.Parent.StructSource.ModelMeasures; fix = new _Mothods_MFixed(m_Currentbus, this.Parent, item); } DataRow[] rows = sorce.Select(string.Format("PID={0} and LB='子目-增加费'", item.ID)); if (IsEsixt(rows, row["Code"].ToString())) { List <_Entity_SubInfo> list = new List <_Entity_SubInfo>(); _Entity_SubInfo info = new _Entity_SubInfo(); info.OLDXMBM = row["Code"].ToString(); info.XMBM = row["Code"].ToString(); info.XMMC = row["Name"].ToString(); info.LB = "子目-增加费"; info.GCL = 1; list.Add(info); fix.Create(list); calculator.Entities.Add(info); } fix.Begin(null); calculator.Entities.Add(item); }
static void XmlProjWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { object[] result = e.Result as object[]; ApplicationForm form = result[0] as ApplicationForm; _Files file = result[1] as _Files; _Business bus = result[2] as _Business; FileInfo FileName = new FileInfo(file.FileName); //处理文件名 string NewExists = _Files.ProjectExName; string p_filename = FileName.FullName.Replace(FileName.Extension, NewExists); file.init(p_filename); bus.Current.Files = file; //效验函数 if (form.Validation(bus)) { //this.DialogResult = DialogResult.Cancel; //开启业务窗体 GC.Collect(); form.ActionFace.OpenNewBussinessForm(bus); } }
/// <summary> /// 绑定当前项目树 /// </summary> public void DataBind(_Business business) { //current.Clone( //_List list = new _List(); //this.DataSource.Property.Fill(list); //this.bindingSource1.DataSource = list.Cast<_Directory>().OrderBy(info=>info.Sort); //this.treeList1.DataSource = this.bindingSource1; this.m_CurrBusiness = business; this.m_DataSource = business.Current; if (business.Current.IsDZBS && !APP.Jzbx_pwd) { this.Event_Import.Enabled = false; this.Event_New.Enabled = false; this.Event_Up.Enabled = false; this.Event_Down.Enabled = false; this.Event_Lock.Enabled = false; } this.bindingSource1.DataSource = this.m_DataSource.StructSource.ModelProject; this.bindingSource1.Sort = "Sort,Deep"; this.treeList1.DataSource = this.bindingSource1; }
public FixedFeatures(_Business p_bus) { this.CurrentBusiness = p_bus; InitializeComponent(); }
/// <summary> /// 打开项目具体操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void ProjWorker_DoWork(object sender, DoWorkEventArgs e) { _Files file = null; try { BackgroundWorker ProjWorker = sender as BackgroundWorker; object[] param = e.Argument as object[]; ApplicationForm form = param[0] as ApplicationForm; file = param[1] as _Files; _Business bus = param[2] as _Business; //打开一个业务文件 bus.Open(file); //打开业务操作窗体 e.Result = new object[] { form, bus }; } catch (Exception ex) { MsgBox.Show(_Prompt.无法识别的打开文件, MessageBoxButtons.OK); } finally { if (file != null) { file = null; } } /*BackgroundWorker ProjWorker = sender as BackgroundWorker; * object[] param = e.Argument as object[]; * ApplicationForm form = param[0] as ApplicationForm; * _Files file = param[1] as _Files; * _Business bus = param[2] as _Business; * _Projects proj = null; * _Engineering en = null; * using (FileStream stream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read)) * { * GZipStream zip = new GZipStream(stream, CompressionMode.Decompress, true); * { * BinaryFormatter formater = new BinaryFormatter(); * long lenth = stream.Length; * int percent = 0; * while (stream.Position != lenth) * { * * object obj = formater.Deserialize(zip); * //zip.Close(); * if (obj is _Projects) * { * proj = obj as _Projects; * proj.InSerializable(file); * ProjWorker.ReportProgress(++percent, proj); * } * if (proj != null) * { * if (obj is _Engineering) * { * en = obj as _Engineering; * en.InSerializable(proj); * ProjWorker.ReportProgress(++percent, en); * } * if (obj is _UnitProject) * { * _UnitProject un = obj as _UnitProject; * un.InSerializable(en); * ProjWorker.ReportProgress(++percent, un); * } * } * } * } * * } * * e.Result = new object[] { form, proj, bus };*/ }
/// <summary> /// 关联到项目 /// </summary> public void Build(_Business m_Currentbus) { if (this.m_DataSource.Rows.Count < 1) { return; } //增加之前先删除增加费 DataRow[] subsegments = this.m_Parent.StructSource.ModelSubSegments.Select(" LB='子目-增加费'"); DataRow[] measures = this.m_Parent.StructSource.ModelMeasures.Select(" LB='子目-增加费'"); using (var calculator = new Calculator(m_Currentbus, m_Parent)) { for (int i = 0; i < subsegments.Length; i++) { var entity = new _Entity_SubInfo(); _ObjectSource.GetObject(entity, subsegments[i]); calculator.Entities.Add(entity); subsegments[i].Delete(); } for (int i = 0; i < measures.Length; i++) { var entity = new _Entity_SubInfo(); _ObjectSource.GetObject(entity, measures[i]); calculator.Entities.Add(entity); measures[i].Delete(); } } this.m_Parent.StructSource.ModelIncreaseCosts.Clear(); DataRow[] checkedRows = this.m_DataSource.Select("Check=True"); DataRow[] subItems = this.m_Parent.StructSource.ModelSubSegments.Select("LB='子目'"); using (var calculator = new Calculator(m_Currentbus, Parent)) { foreach (DataRow subItem in subItems) { _Entity_SubInfo subInfo = new _Entity_SubInfo(); _ObjectSource.GetObject(subInfo, subItem); foreach (DataRow row in checkedRows) { //若定额范围在指定范围之内 if (GLODSOFT.QDJJ.BUSINESS._Methods.ExistsBH(row["Fixed"].ToString(), subInfo)) { DataRow[] rwoss = this.m_Parent.StructSource.ModelIncreaseCosts.Select(string.Format("ZMID={0}", subInfo.ID)); if (IsEsixtZJF(rwoss, row["Code"].ToString())) { _Entity_IncreaseCosts info1 = new _Entity_IncreaseCosts(); _Method_IncreaseCosts.SetInfo(row, info1); info1.EnID = subInfo.EnID; info1.UnID = subInfo.UnID; info1.ZMID = subInfo.ID; info1.QDID = subInfo.PID; this.m_Parent.StructSource.ModelIncreaseCosts.Add(info1); _Methods_IncreaseInfo minfo = new _Methods_IncreaseInfo(this.Parent, info1); minfo.CurrentBegin(subInfo);//计算当前行 } } } } foreach (DataRow row in checkedRows) { Create(m_Currentbus, GetLocation(Convert.ToInt32(row["ParentID"])), row, calculator); } } }
public CActionFunction(_Business business, _UnitProject project) { this.Business = business; this.Project = project; }
private void Create(_Business m_Currentbus, string Name, DataRow row, Calculator calculator) { if (calculator == null) { calculator = new Calculator(m_Currentbus, Parent); } var entities = new List <_Entity_SubInfo>(); DataRow[] rows = null; switch (Name) { case "分部分项": rows = this.Parent.StructSource.ModelSubSegments.Select("LB='清单'"); foreach (DataRow item in rows) { if (Convert.ToInt32(item["ZHHJ"]) == 0) { continue; } _Entity_SubInfo info = new _Entity_SubInfo(); _ObjectSource.GetObject(info, item); CreateZJF(m_Currentbus, info, row, calculator); } break; default: //分部分项的子目增加费添加 rows = this.Parent.StructSource.ModelSubSegments.Select("LB='清单'"); foreach (DataRow item in rows) { if (Convert.ToInt32(item["ZHHJ"]) == 0 && Name.IndexOf("系统调整") > -1) { continue; } if (item["XMMC"].Equals(Name)) { _Entity_SubInfo info = new _Entity_SubInfo(); _ObjectSource.GetObject(info, item); CreateZJF(m_Currentbus, info, row, calculator); } } rows = this.Parent.StructSource.ModelMeasures.Select("LB='清单'"); foreach (DataRow item in rows) { if (Convert.ToInt32(item["ZHHJ"]) == 0 && Name.IndexOf("系统调整") > -1) { continue; } if (item["XMMC"].Equals(Name)) { _Entity_SubInfo info = new _Entity_SubInfo(); _ObjectSource.GetObject(info, item); CreateZJF(m_Currentbus, info, row, calculator); } } break; } }
public CPActionData(_Business p_info) : base(p_info) { }
public CActionData(_Business p_Business) { m_Current = p_Business; }
public Preview(_UnitProject p_CUnitProject, _Business p_CurrentBusiness) { this.Activitie = p_CUnitProject; this.CurrentBusiness = p_CurrentBusiness; InitializeComponent(); }
public XmlProjWorker(_Business p_bus) { this.m_Business = p_bus; }
public FixedContent(_Business p_bus) { this.CurrentBusiness = p_bus; InitializeComponent(); }
public InventoryQuantityUnit(_Business p_bus) { InitializeComponent(); this.CurrentBusiness = p_bus; }