public bool Add(ERM.MDL.T_Projects model_Projects, ERM.MDL.T_Item itemMDL) { this.Insert(model_Projects); BLL.T_Item_BLL itemBLL = new ERM.BLL.T_Item_BLL(); itemBLL.Add(itemMDL); return(true); }
public bool Update(ERM.MDL.T_Projects model_Projects, ERM.MDL.T_Item itemMDL) { BLL.T_Item_BLL itemBLL = new ERM.BLL.T_Item_BLL(); itemMDL.ItemID = model_Projects.ItemID; itemBLL.Update(itemMDL); this.Update(model_Projects); return(true); }
/// <summary> /// 复制 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Click(object sender, EventArgs e) { frm2PDFProgressMsg fmessage = new frm2PDFProgressMsg(); fmessage.Text = "工程复制中..."; try { string sourceNO = string.Empty; string sourceName = string.Empty; string targeNO = string.Empty; string targeName = string.Empty; T_Projects sourcePorj; T_Projects targePorj; (cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString(); if (cbx_Source.Items.Count == 1 || cbx_Trage.Items.Count == 1) { TXMessageBoxExtensions.Info("提示:请选择需要复制的工程!"); cbx_Source.Focus(); return; } else if ((cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString() == "--请选择") { TXMessageBoxExtensions.Info("提示:请选择复制的工程!"); cbx_Source.Focus(); return; } else if ((cbx_Trage.SelectedItem as System.Data.DataRowView)[0].ToString() == "--请选择") { TXMessageBoxExtensions.Info("提示:请选择复制的目的工程!"); cbx_Trage.Focus(); return; } else { sourceNO = (cbx_Source.SelectedItem as System.Data.DataRowView)[1].ToString(); //要编辑的主键 sourceName = (cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString(); //要编辑的主键 targeNO = (cbx_Trage.SelectedItem as System.Data.DataRowView)[1].ToString(); //要编辑的主键 targeName = (cbx_Trage.SelectedItem as System.Data.DataRowView)[0].ToString(); //要编辑的主键 //根据工程编号查询工程类别 sourcePorj = projectBLL.Find(sourceNO); targePorj = projectBLL.Find(targeNO); if (sourcePorj.ProjectCategory != targePorj.ProjectCategory) { TXMessageBoxExtensions.Info("复制的工程类别必须一致!"); return; } if (sourceNO == targeNO) { TXMessageBoxExtensions.Info("提示:同一工程不能复制!"); return; } } if (TXMessageBoxExtensions.Question("提示:确定将工程\n编号:" + sourceNO + " 名称:" + sourceName + "\n复制到工程\n编号:" + targeNO + " 名称:" + targeName + "\n【温馨提示:复制之后工程信息将无法恢复!请慎重!!!】") == DialogResult.OK) { status_flg = true; btn_Copy.Enabled = false; btn_Colse.Enabled = false; fmessage = new frm2PDFProgressMsg(); fmessage.Text = "工程复制中..."; fmessage.progressBar1.Maximum = 4; fmessage.label2.Text = "正在删除工程编号:" + targeNO + "信息..."; fmessage.progressBar1.Value = 1; fmessage.Show(); Application.DoEvents(); //删除目的工程下信息 BLL.BLLMore bllMore = new BLL.BLLMore(); bllMore.DeleteUnitByProjectNO(targeNO); bllMore.DeleteFileListByProjectNO(targeNO); bllMore.DeleteCellFileByProjectNO(targeNO); bllMore.DeleteArchiveByProjectNO(targeNO); bllMore.DeleteGdFileByProjectNO(targeNO);//删除归档类别 #region add deleteProject bllMore.DeleteTrafficByProjectNO(targeNO); bllMore.DeleteRoadLampByProjectNO(targeNO); bllMore.DeleteBrigeByProjectNO(targeNO); bllMore.DeletePointByPorjectNo(targeNO); #endregion MyCommon.DeleteAndCreateEmptyDirectory(Globals.ProjectPathParent + targeNO); //将源工程信息Copy到目的工程 fmessage.label2.Text = "正在更新工程编号:" + targeNO + "信息..."; fmessage.progressBar1.Value = 2; Application.DoEvents(); BLL.T_Projects_BLL Proj_bll = new ERM.BLL.T_Projects_BLL(); ERM.MDL.T_Projects targe_proj_MDL = Proj_bll.Find(targeNO); ERM.MDL.T_Projects source_proj_MDL = Proj_bll.Find(sourceNO); targe_proj_MDL.address = source_proj_MDL.address; targe_proj_MDL.area1 = source_proj_MDL.area1; targe_proj_MDL.area2 = source_proj_MDL.area2; targe_proj_MDL.begindate = source_proj_MDL.begindate; targe_proj_MDL.bgyfmj = source_proj_MDL.bgyfmj; targe_proj_MDL.bjdate = source_proj_MDL.bjdate; targe_proj_MDL.category = source_proj_MDL.category; targe_proj_MDL.cfmj = source_proj_MDL.cfmj; targe_proj_MDL.createdate = source_proj_MDL.createdate; targe_proj_MDL.district = source_proj_MDL.district; targe_proj_MDL.dxsmj = source_proj_MDL.dxsmj; targe_proj_MDL.enddate = source_proj_MDL.enddate; targe_proj_MDL.floors1 = source_proj_MDL.floors1; targe_proj_MDL.floors2 = source_proj_MDL.floors2; targe_proj_MDL.ghcode = source_proj_MDL.ghcode; targe_proj_MDL.high = source_proj_MDL.high; targe_proj_MDL.hjqk = source_proj_MDL.hjqk; targe_proj_MDL.jldwshr = source_proj_MDL.jldwshr; targe_proj_MDL.jsdwshr = source_proj_MDL.jsdwshr; targe_proj_MDL.passwd = source_proj_MDL.passwd; targe_proj_MDL.price1 = source_proj_MDL.price1; targe_proj_MDL.price2 = source_proj_MDL.price2; targe_proj_MDL.projecttype = source_proj_MDL.projecttype; targe_proj_MDL.qtyfmj = source_proj_MDL.qtyfmj; targe_proj_MDL.sgbzz = source_proj_MDL.sgbzz; targe_proj_MDL.sgcode = source_proj_MDL.sgcode; targe_proj_MDL.stru = source_proj_MDL.stru; targe_proj_MDL.syyfmj = source_proj_MDL.syyfmj; targe_proj_MDL.tbr = source_proj_MDL.tbr; targe_proj_MDL.tempid = source_proj_MDL.tempid; targe_proj_MDL.ts1 = source_proj_MDL.ts1; targe_proj_MDL.ts2 = source_proj_MDL.ts2; targe_proj_MDL.ts3 = source_proj_MDL.ts3; targe_proj_MDL.ts4 = source_proj_MDL.ts4; targe_proj_MDL.tstotal = source_proj_MDL.tstotal; targe_proj_MDL.ydpzcode = source_proj_MDL.ydpzcode; targe_proj_MDL.ydxkcode = source_proj_MDL.ydxkcode; targe_proj_MDL.zjy = source_proj_MDL.zjy; targe_proj_MDL.zygz = source_proj_MDL.zygz; targe_proj_MDL.zzmj = source_proj_MDL.zzmj; targe_proj_MDL.ztcw = source_proj_MDL.ztcw; targe_proj_MDL.dstcw = source_proj_MDL.dstcw; targe_proj_MDL.dxtcw = source_proj_MDL.dxtcw; targe_proj_MDL.kzsfcd = source_proj_MDL.kzsfcd; targe_proj_MDL.ts5 = source_proj_MDL.ts5; targe_proj_MDL.XMJL = source_proj_MDL.XMJL; targe_proj_MDL.yjdw = source_proj_MDL.yjdw; targe_proj_MDL.XCJL = source_proj_MDL.XCJL; Proj_bll.Update(targe_proj_MDL); //坐标信息 IList <T_Point> t_point_source = new T_Point_BLL().GetList(sourceNO); foreach (var item in t_point_source) { item.ID = Guid.NewGuid().ToString(); item.ProjectNo = targeNO; new T_Point_BLL().Insert(item); } //电子文件 bllMore.CopyFileAndEFileList(sourceNO, targeNO); BLL.T_Archive_BLL archive_bll = new ERM.BLL.T_Archive_BLL(); //案卷信息 BLL.T_FileList_BLL filelist_bll = new ERM.BLL.T_FileList_BLL(); //文件表 BLL.T_CellAndEFile_BLL cellAndEfile = new ERM.BLL.T_CellAndEFile_BLL(); //电子文件 //单位 BLL.T_Units_BLL units_bll = new ERM.BLL.T_Units_BLL(); //施工单位 IList <MDL.T_Units> IUnits = units_bll.FindByProjectNO(sourceNO); if (IUnits != null && IUnits.Count > 0) { foreach (MDL.T_Units units in IUnits) { units.UnitID = Guid.NewGuid().ToString(); units.ProjectNO = targeNO; units_bll.Add(units);//保存 } } //扩展信息 switch (sourcePorj.ProjectCategory) { case "Traffic": T_Traffic_BLL trafficBll = new T_Traffic_BLL(); T_Traffic traffic = trafficBll.QueryTraffic_ByProjID(sourceNO); if (traffic != null) { traffic.ID = Guid.NewGuid().ToString(); traffic.ProjectID = targeNO; trafficBll.Insert(traffic); } break; case "RoadLamp": T_Project_RoadLamp_BLL roadLampBll = new T_Project_RoadLamp_BLL(); T_Project_RoadLamp roadLamp = roadLampBll.QueryRoadLamp_ByProjID(sourceNO); if (roadLamp != null) { roadLamp.ProjectID = targeNO; roadLamp.ID = Guid.NewGuid().ToString(); roadLampBll.Insert(roadLamp); } break; case "Brige": T_Project_Brige_BLL brigeBll = new T_Project_Brige_BLL(); T_Project_Brige brige = brigeBll.QueryBrige_ByProjID(sourceNO); if (brige != null) { brige.ID = Guid.NewGuid().ToString(); brige.ProjectID = targeNO; brigeBll.Insert(brige); } break; } fmessage.progressBar1.Value = 3; Application.DoEvents(); //迁移文件夹 string mprojectPath = Application.StartupPath + "\\Project\\" + sourceNO; string tprojectPath = Application.StartupPath + "\\Project\\" + targeNO; string[] DirectoryList = new string[] { "MPDF", "ODOC", "PDF" }; if (System.IO.Directory.Exists(tprojectPath)) { MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, false); MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, true); } else { MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, true); } string tempText = fmessage.label2.Text; char[] tempChar = tempText.ToCharArray(); int tempIndex = 0; foreach (string dic in DirectoryList) { MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath + "\\" + dic, true); fmessage.label2.Text = ""; if (System.IO.Directory.Exists(mprojectPath)) { if (System.IO.Directory.Exists(mprojectPath + "\\" + dic)) { string[] files = System.IO.Directory.GetFiles(mprojectPath + "\\" + dic); foreach (string filename in files) { fmessage.label2.Text += tempChar[tempIndex]; Application.DoEvents(); tempIndex++; if (tempIndex >= tempChar.Length) { tempIndex = 0; fmessage.label2.Text = ""; } System.IO.FileInfo fileinfo = new System.IO.FileInfo(filename); if (System.IO.File.Exists(filename)) { System.IO.File.Copy(filename, tprojectPath + "\\" + dic + "\\" + fileinfo.Name, true); } } } } } fmessage.progressBar1.Value = 4; Application.DoEvents(); fmessage.Close(); btn_Copy.Enabled = true; btn_Colse.Enabled = true; TXMessageBoxExtensions.Info("提示:复制成功!"); BindGridViewData(); } } catch (Exception ex) { if (fmessage != null) { fmessage.Close(); } TXMessageBoxExtensions.Info("提示:复制失败!"); MyCommon.WriteLog("复制工程错误:" + ex.Message); btn_Copy.Enabled = true; btn_Colse.Enabled = true; } }
public ProjectItemUnits(string openedProjectNo) { this._openedProjectNo = openedProjectNo; ERM.MDL.T_Projects projectInfo = projectsData.Find(_openedProjectNo); Hashtable projectDetail = new Hashtable(); //2010-03-29 因为导入数据存在NULL的情况 加个判断 projectDetail.Add("address", projectInfo.address == null ? "" : projectInfo.address); projectDetail.Add("area1", projectInfo.area1 == null ? "" : projectInfo.area1); projectDetail.Add("area2", projectInfo.area2 == null ? "" : projectInfo.area2); projectDetail.Add("district", projectInfo.district == null ? "" : projectInfo.district); projectDetail.Add("category", projectInfo.category == null ? "" : projectInfo.category); projectDetail.Add("begindate", (projectInfo.begindate == null || projectInfo.begindate == "") ? "" : DateTime.Parse(projectInfo.begindate).ToString("yyyy-MM-dd")); projectDetail.Add("bjdate", projectInfo.bjdate == null ? "" : projectInfo.bjdate); projectDetail.Add("enddate", (projectInfo.enddate == null || projectInfo.enddate == "") ? "" : DateTime.Parse(projectInfo.enddate).ToString("yyyy-MM-dd")); projectDetail.Add("floors1", projectInfo.floors1 == null ? "" : projectInfo.floors1); projectDetail.Add("floors2", projectInfo.floors2 == null ? "" : projectInfo.floors2); projectDetail.Add("ghcode", projectInfo.ghcode == null ? "" : projectInfo.ghcode); projectDetail.Add("passwd", projectInfo.passwd == null ? "" : projectInfo.passwd); projectDetail.Add("price1", projectInfo.price1 == null ? 0 : projectInfo.price1); projectDetail.Add("price2", projectInfo.price2 == null ? 0 : projectInfo.price2); projectDetail.Add("high", projectInfo.high == null ? "" : projectInfo.high); projectDetail.Add("projectname", projectInfo.projectname == null ? "" : projectInfo.projectname); projectDetail.Add("ProjectNO", projectInfo.ProjectNO == null ? "" : projectInfo.ProjectNO); projectDetail.Add("projecttype", projectInfo.projecttype == null ? "" : projectInfo.projecttype); projectDetail.Add("sgcode", projectInfo.sgcode == null ? "" : projectInfo.sgcode); projectDetail.Add("ydpzcode", projectInfo.ydpzcode == null ? "" : projectInfo.ydpzcode); projectDetail.Add("ydxkcode", projectInfo.ydxkcode == null ? "" : projectInfo.ydxkcode); projectDetail.Add("stru", projectInfo.stru == null ? "" : projectInfo.stru); projectDetail.Add("tempid", projectInfo.tempid == null ? 0 : projectInfo.tempid); projectDetail.Add("hjqk", projectInfo.hjqk == null ? "" : projectInfo.hjqk); projectDetail.Add("zzmj", projectInfo.zzmj == null ? "" : projectInfo.zzmj); projectDetail.Add("bgyfmj", projectInfo.bgyfmj == null ? "" : projectInfo.bgyfmj); projectDetail.Add("syyfmj", projectInfo.syyfmj == null ? "" : projectInfo.syyfmj); projectDetail.Add("cfmj", projectInfo.cfmj == null ? "" : projectInfo.cfmj); projectDetail.Add("dxsmj", projectInfo.dxsmj == null ? "" : projectInfo.dxsmj); projectDetail.Add("qtyfmj", projectInfo.qtyfmj == null ? "" : projectInfo.qtyfmj); projectDetail.Add("ts1", projectInfo.ts1 == null ? "" : projectInfo.ts1); projectDetail.Add("ts2", projectInfo.ts2 == null ? "" : projectInfo.ts2); projectDetail.Add("ts3", projectInfo.ts3 == null ? "" : projectInfo.ts3); projectDetail.Add("ts4", projectInfo.ts4 == null ? "" : projectInfo.ts4); projectDetail.Add("ts5", projectInfo.ts5 == null ? "" : projectInfo.ts5); projectDetail.Add("tstotal", projectInfo.tstotal == null ? "" : projectInfo.tstotal); projectDetail.Add("zygz", projectInfo.zygz == null ? "" : projectInfo.zygz); projectDetail.Add("zjy", projectInfo.zjy == null ? "" : projectInfo.zjy); projectDetail.Add("sgbzz", projectInfo.sgbzz == null ? "" : projectInfo.sgbzz); projectDetail.Add("tbr", projectInfo.tbr == null ? "" : projectInfo.tbr); projectDetail.Add("jsdwshr", projectInfo.jsdwshr == null ? "" : projectInfo.jsdwshr); projectDetail.Add("jldwshr", projectInfo.jldwshr == null ? "" : projectInfo.jldwshr); projectDetail.Add("createdate", projectInfo.createdate == null ? "" : projectInfo.createdate); projectDetail.Add("ajdh", projectInfo.ajdh == null ? "" : projectInfo.ajdh); projectDetail.Add("kzsfcd", projectInfo.kzsfcd == null ? "" : projectInfo.kzsfcd); projectDetail.Add("ztcw", projectInfo.ztcw == null ? "" : projectInfo.ztcw); projectDetail.Add("dstcw", projectInfo.dstcw == null ? "" : projectInfo.dstcw); projectDetail.Add("dxtcw", projectInfo.dxtcw == null ? "" : projectInfo.dxtcw); DataView dv; MDL.T_Units mdl_unit = new ERM.MDL.T_Units(); mdl_unit.ProjectNO = this._openedProjectNo; mdl_unit.unittype = "unit1"; //dv = unitData.GetList("ProjectNO='" + this._openedProjectNo + "' and unittype='unit1'").Tables[0].DefaultView; dv = unitData.GetList(mdl_unit).Tables[0].DefaultView; if (dv.Count <= 1) { if (dv.Count == 0) { projectDetail.Add("jsdw_mc", ""); projectDetail.Add("jsdw_xmfzr", ""); projectDetail.Add("jsdw_xmzyjsfzr", ""); } else { projectDetail.Add("jsdw_mc", dv[0]["dwmc"].ToString()); projectDetail.Add("jsdw_xmfzr", dv[0]["fzr"].ToString()); projectDetail.Add("jsdw_xmzyjsfzr", dv[0]["zlfzr"].ToString()); } } else { string[] jsdwmc = new string[dv.Count]; //单位名称 string[] jsdwxmfzr = new string[dv.Count]; //项目负责人 for (int i = 0; i < dv.Count; i++) { jsdwmc[i] = dv[i]["dwmc"].ToString(); jsdwxmfzr[i] = dv[i]["fzr"].ToString(); } projectDetail.Add("jsdw_mc", jsdwmc); projectDetail.Add("jsdw_xmfzr", jsdwxmfzr); } //dv = unitData.GetList("ProjectNO='" + this._openedProjectNo + "' and unittype='unit2'").Tables[0].DefaultView; mdl_unit.unittype = "unit2"; dv = unitData.GetList(mdl_unit).Tables[0].DefaultView; if (dv.Count <= 1) { if (dv.Count == 0) { projectDetail.Add("kcdw_mc", ""); projectDetail.Add("kcdw_xmfzr", ""); projectDetail.Add("kcdw_jsfzr", ""); } else { projectDetail.Add("kcdw_mc", dv[0]["dwmc"].ToString()); projectDetail.Add("kcdw_xmfzr", dv[0]["fzr"].ToString()); projectDetail.Add("kcdw_jsfzr", dv[0]["xmjl"].ToString()); } } else { string[] kcdwmc = new string[dv.Count]; //单位名称 string[] kcdwxmfzr = new string[dv.Count]; //项目负责人 string[] kcdwjsfzr = new string[dv.Count]; //技术负责人 for (int i = 0; i < dv.Count; i++) { kcdwmc[i] = dv[i]["dwmc"].ToString(); kcdwxmfzr[i] = dv[i]["fzr"].ToString(); kcdwjsfzr[i] = dv[i]["xmjl"].ToString(); } projectDetail.Add("kcdw_mc", kcdwmc); projectDetail.Add("kcdw_xmfzr", kcdwxmfzr); projectDetail.Add("kcdw_jsfzr", kcdwjsfzr); } //dv = unitData.GetList("ProjectNO='" + this._openedProjectNo + "' and unittype='unit3'").Tables[0].DefaultView; mdl_unit.unittype = "unit3"; dv = unitData.GetList(mdl_unit).Tables[0].DefaultView; if (dv.Count <= 1) { if (dv.Count == 0) { projectDetail.Add("sjdw_mc", ""); projectDetail.Add("sjdw_xmfzr", ""); projectDetail.Add("sjdw_jsfzr", ""); } else { projectDetail.Add("sjdw_mc", dv[0]["dwmc"].ToString()); projectDetail.Add("sjdw_xmfzr", dv[0]["fzr"].ToString()); projectDetail.Add("sjdw_jsfzr", dv[0]["xmjl"].ToString()); } } else { string[] sjdwmc = new string[dv.Count]; //单位名称 string[] sjdwxmfzr = new string[dv.Count]; //项目负责人 string[] sjdwjsfzr = new string[dv.Count]; //技术负责人 for (int i = 0; i < dv.Count; i++) { sjdwmc[i] = dv[i]["dwmc"].ToString(); sjdwxmfzr[i] = dv[i]["fzr"].ToString(); sjdwjsfzr[i] = dv[i]["xmjl"].ToString(); } projectDetail.Add("sjdw_mc", sjdwmc); projectDetail.Add("sjdw_xmfzr", sjdwxmfzr); projectDetail.Add("sjdw_jsfzr", sjdwjsfzr); } //dv = unitData.GetList("ProjectNO='" + this._openedProjectNo + "' and unittype='unit4'").Tables[0].DefaultView; mdl_unit.unittype = "unit4"; dv = unitData.GetList(mdl_unit).Tables[0].DefaultView; if (dv.Count <= 1) { if (dv.Count == 0) { projectDetail.Add("sgdw_mc", ""); projectDetail.Add("sgdw_xmfzr", ""); projectDetail.Add("sgdw_jsfzr", ""); projectDetail.Add("sgdw_xmzyzljcy", ""); projectDetail.Add("sgdw_zlfzr", ""); projectDetail.Add("sgdw_jccsfzr", ""); projectDetail.Add("sgdw_syxfzr", ""); projectDetail.Add("sgdw_tsfzr", ""); } else { projectDetail.Add("sgdw_mc", dv[0]["dwmc"].ToString()); projectDetail.Add("sgdw_xmfzr", dv[0]["xmjl"].ToString()); projectDetail.Add("sgdw_jsfzr", dv[0]["dwmc"].ToString()); projectDetail.Add("sgdw_xmzyzljcy", dv[0]["xmzyzljcy"].ToString()); projectDetail.Add("sgdw_zlfzr", dv[0]["zlfzr"].ToString()); projectDetail.Add("sgdw_jccsfzr", dv[0]["jccsfzr"].ToString()); projectDetail.Add("sgdw_syxfzr", dv[0]["syxfzr"].ToString()); projectDetail.Add("sgdw_tsfzr", dv[0]["tsfzr"].ToString()); } } else { string[] sgdwmc = new string[dv.Count]; //单位名称 string[] sgdwxmfzr = new string[dv.Count]; //项目经理 string[] sgdwjsfzr = new string[dv.Count]; //技术负责人 for (int i = 0; i < dv.Count; i++) { sgdwmc[i] = dv[i]["dwmc"].ToString(); sgdwxmfzr[i] = dv[i]["xmjl"].ToString(); sgdwjsfzr[i] = dv[i]["dwmc"].ToString(); } projectDetail.Add("sgdw_mc", sgdwmc); projectDetail.Add("sgdw_xmfzr", sgdwxmfzr); projectDetail.Add("sgdw_jsfzr", sgdwjsfzr); } //dv = unitData.GetList("ProjectNO='" + this._openedProjectNo + "' and unittype='unit5'").Tables[0].DefaultView; mdl_unit.unittype = "unit5"; dv = unitData.GetList(mdl_unit).Tables[0].DefaultView; if (dv.Count <= 1) { if (dv.Count == 0) { projectDetail.Add("sgtdw_mc", ""); projectDetail.Add("sgtdw_xmfzr", ""); } else { projectDetail.Add("sgtdw_mc", dv[0]["dwmc"].ToString()); projectDetail.Add("sgtdw_xmfzr", dv[0]["fzr"].ToString()); } } else { string[] sgtdwmc = new string[dv.Count]; //单位名称 string[] sgtdwxmfzr = new string[dv.Count]; //项目负责人 for (int i = 0; i < dv.Count; i++) { sgtdwmc[i] = dv[i]["dwmc"].ToString(); sgtdwxmfzr[i] = dv[i]["fzr"].ToString(); } projectDetail.Add("sgtdw_mc", sgtdwmc); projectDetail.Add("sgtdw_xmfzr", sgtdwxmfzr); } //dv = unitData.GetList("ProjectNO='" + this._openedProjectNo + "' and unittype='unit6'").Tables[0].DefaultView; mdl_unit.unittype = "unit6"; dv = unitData.GetList(mdl_unit).Tables[0].DefaultView; if (dv.Count <= 1) { if (dv.Count == 0) { projectDetail.Add("jldw_mc", ""); projectDetail.Add("jldw_jlgcs", ""); projectDetail.Add("jldw_zjlgcs", ""); } else { projectDetail.Add("jldw_mc", dv[0]["dwmc"].ToString()); projectDetail.Add("jldw_xmfzr", dv[0]["fzr"].ToString()); projectDetail.Add("jldw_xmzj", dv[0]["xmjl"].ToString()); projectDetail.Add("jldw_xcjl", dv[0]["xcjl"].ToString()); } } else { string[] jldwmc = new string[dv.Count]; //单位名称 string[] jldwxmfzr = new string[dv.Count]; //项目负责人 string[] jldwxmzj = new string[dv.Count]; //项目总监 string[] jldwxcjl = new string[dv.Count]; //现场监理 for (int i = 0; i < dv.Count; i++) { jldwmc[i] = dv[i]["dwmc"].ToString(); jldwxmfzr[i] = dv[i]["fzr"].ToString(); jldwxmzj[i] = dv[i]["xmjl"].ToString(); jldwxcjl[i] = dv[i]["xcjl"].ToString(); } projectDetail.Add("jldw_mc", jldwmc); projectDetail.Add("jldw_xmfzr", jldwxmfzr); projectDetail.Add("jldw_xmzj", jldwxmzj); projectDetail.Add("jldw_xcjl", jldwxmzj); } //dv = unitData.GetList("ProjectNO='" + this._openedProjectNo + "' and unittype='unit7'").Tables[0].DefaultView; mdl_unit.unittype = "unit7"; dv = unitData.GetList(mdl_unit).Tables[0].DefaultView; if (dv.Count <= 1) { if (dv.Count == 0) { projectDetail.Add("jddw_mc", ""); projectDetail.Add("jddw_jdy", ""); } else { projectDetail.Add("jddw_mc", dv[0]["dwmc"].ToString()); projectDetail.Add("jddw_jdy", dv[0]["fzr"].ToString()); } } else { string[] jddwmc = new string[dv.Count]; //单位名称 string[] jddwjdy = new string[dv.Count]; //监督员 for (int i = 0; i < dv.Count; i++) { jddwmc[i] = dv[i]["dwmc"].ToString(); jddwjdy[i] = dv[i]["fzr"].ToString(); } projectDetail.Add("jddw_mc", jddwmc); projectDetail.Add("jddw_jdy", jddwjdy); } //dv = unitData.GetList("ProjectNO='" + this._openedProjectNo + "' and unittype='unit8'").Tables[0].DefaultView; mdl_unit.unittype = "unit8"; dv = unitData.GetList(mdl_unit).Tables[0].DefaultView; if (dv.Count <= 1) { if (dv.Count == 0) { projectDetail.Add("fbdw_mc", ""); projectDetail.Add("fbdw_xmfzr", ""); projectDetail.Add("fbdw_jsfzr", ""); } else { projectDetail.Add("fbdw_mc", dv[0]["dwmc"].ToString()); projectDetail.Add("fbdw_xmfzr", dv[0]["xmjl"].ToString()); projectDetail.Add("fbdw_jsfzr", dv[0]["fzr"].ToString()); } } else { string[] fbdwmc = new string[dv.Count]; //单位名称 string[] fbdwjsfzr = new string[dv.Count]; //技术负责人 string[] fbdwxmjl = new string[dv.Count]; //项目经理 for (int i = 0; i < dv.Count; i++) { fbdwmc[i] = dv[i]["dwmc"].ToString(); fbdwjsfzr[i] = dv[i]["fzr"].ToString(); fbdwxmjl[i] = dv[i]["xmjl"].ToString(); } projectDetail.Add("fbdw_mc", fbdwmc); projectDetail.Add("fbdw_xmfzr", fbdwxmjl); projectDetail.Add("fbdw_jsfzr", fbdwjsfzr); } //dv = unitData.GetList("ProjectNO='" + this._openedProjectNo + "' and unittype='unit9'").Tables[0].DefaultView; mdl_unit.unittype = "unit9"; dv = unitData.GetList(mdl_unit).Tables[0].DefaultView; if (dv.Count <= 1) { if (dv.Count == 0) { projectDetail.Add("zcbdw_mc", ""); projectDetail.Add("zcbdw_xmfzr", ""); projectDetail.Add("zcbdw_fzr", ""); projectDetail.Add("zcbdw_xmzyzljcy", ""); projectDetail.Add("zcbdw_zlfzr", ""); } else { projectDetail.Add("zcbdw_mc", dv[0]["dwmc"].ToString()); projectDetail.Add("zcbdw_xmfzr", dv[0]["xmjl"].ToString()); projectDetail.Add("zcbdw_fzr", dv[0]["fzr"].ToString()); projectDetail.Add("zcbdw_xmzyzljcy", dv[0]["xmzyzljcy"].ToString()); projectDetail.Add("zcbdw_zlfzr", dv[0]["zlfzr"].ToString()); } } else { string[] zcbdwmc = new string[dv.Count]; //单位名称 string[] zcbdwfzr = new string[dv.Count]; //总承包负责人 string[] zcbdwxmjl = new string[dv.Count]; //项目经理 for (int i = 0; i < dv.Count; i++) { zcbdwmc[i] = dv[i]["dwmc"].ToString(); zcbdwfzr[i] = dv[i]["fzr"].ToString(); zcbdwxmjl[i] = dv[i]["xmjl"].ToString(); } projectDetail.Add("zcbdw_mc", zcbdwmc); projectDetail.Add("zcbdw_xmfzr", zcbdwxmjl); projectDetail.Add("zcbdw_fzr", zcbdwfzr); } //dv = unitData.GetList("ProjectNO='" + this._openedProjectNo + "' and unittype='unit10'").Tables[0].DefaultView; mdl_unit.unittype = "unit10"; dv = unitData.GetList(mdl_unit).Tables[0].DefaultView; if (dv.Count <= 1) { if (dv.Count == 0) { projectDetail.Add("azdw_mc", ""); projectDetail.Add("azdw_xmfzr", ""); projectDetail.Add("azdw_azfzr", ""); } else { projectDetail.Add("azdw_mc", dv[0]["dwmc"].ToString()); projectDetail.Add("azdw_xmfzr", dv[0]["xmjl"].ToString()); projectDetail.Add("azdw_azfzr", dv[0]["fzr"].ToString()); } } else { string[] azdwmc = new string[dv.Count]; //单位名称 string[] azdwazfzr = new string[dv.Count]; //安装负责人 string[] azdwxmjl = new string[dv.Count]; //项目经理 for (int i = 0; i < dv.Count; i++) { azdwmc[i] = dv[i]["dwmc"].ToString(); azdwazfzr[i] = dv[i]["fzr"].ToString(); azdwxmjl[i] = dv[i]["xmjl"].ToString(); } projectDetail.Add("azdw_mc", azdwmc); projectDetail.Add("azdw_xmfzr", azdwxmjl); projectDetail.Add("azdw_azfzr", azdwazfzr); } mdl_unit.unittype = "unit14"; dv = unitData.GetList(mdl_unit).Tables[0].DefaultView; if (dv.Count <= 1) { if (dv.Count == 0) { projectDetail.Add("cldw_mc", ""); projectDetail.Add("cldw_xmfzr", ""); projectDetail.Add("cldw_azfzr", ""); } else { projectDetail.Add("cldw_mc", dv[0]["dwmc"].ToString()); projectDetail.Add("cldw_xmfzr", dv[0]["xmjl"].ToString()); projectDetail.Add("cldw_azfzr", dv[0]["fzr"].ToString()); } } else { string[] cldwmc = new string[dv.Count]; //单位名称 string[] cldwazfzr = new string[dv.Count]; //安装负责人 string[] cldwxmjl = new string[dv.Count]; //项目经理 for (int i = 0; i < dv.Count; i++) { cldwmc[i] = dv[i]["dwmc"].ToString(); cldwazfzr[i] = dv[i]["fzr"].ToString(); cldwxmjl[i] = dv[i]["xmjl"].ToString(); } projectDetail.Add("azdw_mc", cldwmc); projectDetail.Add("azdw_xmfzr", cldwxmjl); projectDetail.Add("azdw_azfzr", cldwazfzr); } ///项目信息 ERM.MDL.T_Item ItemInfo = itemData.Find(projectInfo.ItemID); projectDetail.Add("ItemID", ItemInfo.ItemID == null ? "" : ItemInfo.ItemID); //ID projectDetail.Add("constructionprojectname", ItemInfo.ConStructionProjectName == null ? "" : ItemInfo.ConStructionProjectName); //项目名称 projectDetail.Add("respective", ItemInfo.Respective == null ? "" : ItemInfo.Respective); //区域 projectDetail.Add("constructionprojectadd", ItemInfo.ConstructionProjectAdd == null ? "" : ItemInfo.ConstructionProjectAdd); //项目地址 projectDetail.Add("projecttype_item", ItemInfo.ProjectType == null ? "" : ItemInfo.ProjectType); //建筑性质 projectDetail.Add("usesoiareasum", ItemInfo.UseSoiAreaSum == null ? "" : ItemInfo.UseSoiAreaSum); //总用地面积 projectDetail.Add("constructionareasum", ItemInfo.ConstructionAreaSum == null ? "" : ItemInfo.ConstructionAreaSum); //总建筑面积 projectDetail.Add("constructionscale", ItemInfo.ConstructionScale == null ? "" : ItemInfo.ConstructionScale); projectDetail.Add("projectcost", ItemInfo.ProjectCost == null ? "" : ItemInfo.ProjectCost); //总结算 projectDetail.Add("projectsettlement", ItemInfo.ProjectSettlement == null ? "" : ItemInfo.ProjectSettlement); //总预算 projectDetail.Add("usesoitype", ItemInfo.UseSoiType == null ? "" : ItemInfo.UseSoiType); projectDetail.Add("collectiontype", ItemInfo.CollectionType == null ? "" : ItemInfo.CollectionType); projectDetail.Add("originalsoitype", ItemInfo.OriginalSoiType == null ? "" : ItemInfo.OriginalSoiType); projectDetail.Add("usesoiarea", ItemInfo.UseSoiArea == null ? "" : ItemInfo.UseSoiArea); projectDetail.Add("startdate", ItemInfo.StartDate == null ? "" : ItemInfo.StartDate); projectDetail.Add("finishdate", ItemInfo.FinishDate == null ? "" : ItemInfo.FinishDate); projectDetail.Add("approvedate", ItemInfo.Approvedate == null ? "" : ItemInfo.Approvedate); projectDetail.Add("createunit", ItemInfo.CreateUnit == null ? "" : ItemInfo.CreateUnit); //建设单位 projectDetail.Add("itemfzr", ItemInfo.ItemFzr == null ? "" : ItemInfo.ItemFzr); //项目负责人 projectDetail.Add("allcost", ItemInfo.AllCost == null ? "" : ItemInfo.AllCost); //总地价 projectDetail.Add("volumefar", ItemInfo.VolumeFar == null ? "" : ItemInfo.VolumeFar); //容积率 projectDetail.Add("greenfar", ItemInfo.GreenFar == null ? "" : ItemInfo.GreenFar); //绿化率 projectDetail.Add("buildingdensity", ItemInfo.BuildingDensity == null ? "" : ItemInfo.BuildingDensity); projectDetail.Add("ds", ItemInfo.ds == null ? "" : ItemInfo.ds); projectDetail.Add("pzdw", ItemInfo.pzdw == null ? "" : ItemInfo.pzdw); projectDetail.Add("pzh", ItemInfo.pzh == null ? "" : ItemInfo.pzh); #region add projectDetail.Add("zcd", ItemInfo.zcd == null ? "" : ItemInfo.zcd); projectDetail.Add("start_x", projectInfo.Start_X == null ? "" : projectInfo.Start_X); projectDetail.Add("start_y", projectInfo.Start_X == null ? "" : projectInfo.Start_X); projectDetail.Add("end_x", projectInfo.End_X == null ? "" : projectInfo.End_X); projectDetail.Add("end_y", projectInfo.End_Y == null ? "" : projectInfo.End_Y); projectDetail.Add("shr", projectInfo.shr == null ? "" : projectInfo.shr); projectDetail.Add("zlr", projectInfo.zlr == null ? "" : projectInfo.zlr); projectDetail.Add("zlrq", projectInfo.zlrq == null ? "" : projectInfo.zlrq); #region brige if (projectInfo.ProjectCategory.ToLower() == "brige") { T_Project_Brige brige = brigeData.QueryBrige_ByProjID(this._openedProjectNo); projectDetail.Add("acjgxs", brige.ACJGXS == null ? "" : brige.ACJGXS); projectDetail.Add("dz", brige.DZ == null ? "" : brige.DZ); projectDetail.Add("jcxs", brige.JCXS == null ? "" : brige.JCXS); projectDetail.Add("jk", brige.JK == null ? "" : brige.JK); projectDetail.Add("kj", brige.KJ == null ? "" : brige.KJ); projectDetail.Add("level", brige.Level == null ? "" : brige.Level); projectDetail.Add("longs", brige.Longs == null ? "" : brige.Longs); projectDetail.Add("mcxs", brige.MCXS == null ? "" : brige.MCXS); projectDetail.Add("projectid", brige.ProjectID == null ? "" : brige.ProjectID); projectDetail.Add("remark", brige.Remark == null ? "" : brige.Remark); projectDetail.Add("sbgz", brige.SBGZ == null ? "" : brige.SBGZ); projectDetail.Add("ssf", brige.SSF == null ? "" : brige.SSF); projectDetail.Add("sturucttype", brige.StuructType == null ? "" : brige.StuructType); projectDetail.Add("width", brige.Width == null ? "" : brige.Width); projectDetail.Add("xbgz", brige.XBGZ == null ? "" : brige.XBGZ); projectDetail.Add("hz", brige.HZ == null ? "" : brige.HZ); projectDetail.Add("gcys", brige.GCYS == null ? "" : brige.GCYS); projectDetail.Add("gcjs", brige.GCJS == null ? "" : brige.GCJS); } #endregion #region roadLamp if (projectInfo.ProjectCategory.ToLower() == "roadlamp") { T_Project_RoadLamp roadLamp = roladLampData.QueryRoadLamp_ByProjID(this._openedProjectNo); projectDetail.Add("dggd", roadLamp.DGGD == null ? "" : roadLamp.DGGD); projectDetail.Add("dgjjl", roadLamp.DGJJL == null ? "" : roadLamp.DGJJL); projectDetail.Add("dgzs", roadLamp.DGZS == null ? "" : roadLamp.DGZS); projectDetail.Add("djbc", roadLamp.DJBC == null ? "" : roadLamp.DJBC); projectDetail.Add("djzl", roadLamp.DJZL == null ? "" : roadLamp.DJZL); projectDetail.Add("dlcd", roadLamp.DLCD == null ? "" : roadLamp.DLCD); projectDetail.Add("dlgg", roadLamp.DLGG == null ? "" : roadLamp.DLGG); projectDetail.Add("ggdgd", roadLamp.GGDGD == null ? "" : roadLamp.GGDGD); projectDetail.Add("ggds", roadLamp.GGDS == null ? "" : roadLamp.GGDS); projectDetail.Add("gl", roadLamp.GL == null ? "" : roadLamp.GL); projectDetail.Add("gylx", roadLamp.GYLX == null ? "" : roadLamp.GYLX); projectDetail.Add("jxj", roadLamp.JXJ == null ? "" : roadLamp.JXJ); projectDetail.Add("ldxs_mt", roadLamp.LDXS_MT == null ? "" : roadLamp.LDXS_MT); projectDetail.Add("ldxs_st", roadLamp.LDXS_ST == null ? "" : roadLamp.LDXS_ST); projectDetail.Add("remark", roadLamp.Remark == null ? "" : roadLamp.Remark); projectDetail.Add("xbxh", roadLamp.XBXH == null ? "" : roadLamp.XBXH); projectDetail.Add("gcys", roadLamp.GCYS == null ? "" : roadLamp.GCYS); } #endregion #region traffic if (projectInfo.ProjectCategory.ToLower() == "traffic") { T_Traffic traffic = trafficData.QueryTraffic_ByProjID(this._openedProjectNo); projectDetail.Add("hz", traffic.HZ == null ? "" : traffic.HZ); projectDetail.Add("jcxs", traffic.JCXS == null ? "" : traffic.JCXS); projectDetail.Add("kj", traffic.KJ == null ? "" : traffic.KJ); projectDetail.Add("ks", traffic.KS == null ? "" : traffic.KS); projectDetail.Add("longcount", traffic.LongCount == null ? "" : traffic.LongCount); projectDetail.Add("mcxs", traffic.MCXS == null ? "" : traffic.MCXS); projectDetail.Add("pwdj", traffic.PWDJ == null ? "" : traffic.PWDJ); projectDetail.Add("remark", traffic.Remark == null ? "" : traffic.Remark); projectDetail.Add("road_level", traffic.Road_Level == null ? "" : traffic.Road_Level); projectDetail.Add("width", traffic.Width == null ? "" : traffic.Width); projectDetail.Add("zpws", traffic.ZPWS == null ? "" : traffic.ZPWS); projectDetail.Add("gcys", traffic.GCYS == null ? "" : traffic.GCYS); projectDetail.Add("gcjs", traffic.GCJS == null ? "" : traffic.GCJS); projectDetail.Add("startx", traffic.STARTX == null ? "" : traffic.STARTX); projectDetail.Add("starty", traffic.STARTY == null ? "" : traffic.STARTY); projectDetail.Add("endx", traffic.ENDX == null ? "" : traffic.ENDX); projectDetail.Add("endy", traffic.ENDY == null ? "" : traffic.ENDY); IList <T_Traffic_Detail> detailList = new BLL.T_Traffic_Detail_BLL().QueryTraffic_ByProjID(traffic.ID); ERM.BLL.T_Dict_BLL dicData = new ERM.BLL.T_Dict_BLL(); IList <T_Dict> dictList = dicData.FindByKeyWord("TrafficType"); PropertyInfo[] properties = typeof(T_Traffic_Detail).GetProperties(); foreach (var item in detailList) { foreach (var dic in dictList) { if (dic.ValueName == item.Types) { for (int i = 0; i < properties.Length; i++) { string propertyID = properties[i].Name; PropertyInfo pinfo = typeof(T_Traffic_Detail).GetProperty(propertyID); string val = pinfo.GetValue(item, null) == null ? "" : pinfo.GetValue(item, null).ToString(); if (!string.IsNullOrEmpty(val)) { string key = item.Types.ToLower() + "_" + propertyID.ToLower(); if (!projectDetail.ContainsKey(key)) { projectDetail.Add(key, val); } } } } } } } #endregion #endregion this._projectDetail = projectDetail; }//构造函数完成
/// <summary> /// 获得数据列表 /// </summary> public List <ERM.MDL.T_Projects> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List <ERM.MDL.T_Projects> modelList = new List <ERM.MDL.T_Projects>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { ERM.MDL.T_Projects model; for (int n = 0; n < rowsCount; n++) { model = new ERM.MDL.T_Projects(); model.address = ds.Tables[0].Rows[n]["address"].ToString(); if (ds.Tables[0].Rows[n]["area1"].ToString() != "") { model.area1 = decimal.Parse(ds.Tables[0].Rows[n]["area1"].ToString()); } if (ds.Tables[0].Rows[n]["area2"].ToString() != "") { model.area2 = decimal.Parse(ds.Tables[0].Rows[n]["area2"].ToString()); } if (ds.Tables[0].Rows[n]["begindate"].ToString() != "") { model.begindate = DateTime.Parse(ds.Tables[0].Rows[n]["begindate"].ToString()); } model.bgyfmj = ds.Tables[0].Rows[n]["bgyfmj"].ToString(); if (ds.Tables[0].Rows[n]["bjdate"].ToString() != "") { model.bjdate = DateTime.Parse(ds.Tables[0].Rows[n]["bjdate"].ToString()); } model.category = ds.Tables[0].Rows[n]["category"].ToString(); model.cfmj = ds.Tables[0].Rows[n]["cfmj"].ToString(); if (ds.Tables[0].Rows[n]["createdate"].ToString() != "") { model.createdate = DateTime.Parse(ds.Tables[0].Rows[n]["createdate"].ToString()); } model.district = ds.Tables[0].Rows[n]["district"].ToString(); model.dxsmj = ds.Tables[0].Rows[n]["dxsmj"].ToString(); if (ds.Tables[0].Rows[n]["enddate"].ToString() != "") { model.enddate = DateTime.Parse(ds.Tables[0].Rows[n]["enddate"].ToString()); } if (ds.Tables[0].Rows[n]["floors1"].ToString() != "") { model.floors1 = int.Parse(ds.Tables[0].Rows[n]["floors1"].ToString()); } if (ds.Tables[0].Rows[n]["floors2"].ToString() != "") { model.floors2 = int.Parse(ds.Tables[0].Rows[n]["floors2"].ToString()); } model.ghcode = ds.Tables[0].Rows[n]["ghcode"].ToString(); if (ds.Tables[0].Rows[n]["high"].ToString() != "") { model.high = decimal.Parse(ds.Tables[0].Rows[n]["high"].ToString()); } model.hjqk = ds.Tables[0].Rows[n]["hjqk"].ToString(); model.jldwshr = ds.Tables[0].Rows[n]["jldwshr"].ToString(); model.jsdwshr = ds.Tables[0].Rows[n]["jsdwshr"].ToString(); model.passwd = ds.Tables[0].Rows[n]["passwd"].ToString(); if (ds.Tables[0].Rows[n]["price1"].ToString() != "") { model.price1 = decimal.Parse(ds.Tables[0].Rows[n]["price1"].ToString()); } if (ds.Tables[0].Rows[n]["price2"].ToString() != "") { model.price2 = decimal.Parse(ds.Tables[0].Rows[n]["price2"].ToString()); } model.projectname = ds.Tables[0].Rows[n]["projectname"].ToString(); model.projectno = ds.Tables[0].Rows[n]["projectno"].ToString(); model.projecttype = ds.Tables[0].Rows[n]["projecttype"].ToString(); model.qtyfmj = ds.Tables[0].Rows[n]["qtyfmj"].ToString(); model.sgbzz = ds.Tables[0].Rows[n]["sgbzz"].ToString(); model.sgcode = ds.Tables[0].Rows[n]["sgcode"].ToString(); model.stru = ds.Tables[0].Rows[n]["stru"].ToString(); model.syyfmj = ds.Tables[0].Rows[n]["syyfmj"].ToString(); model.tbr = ds.Tables[0].Rows[n]["tbr"].ToString(); if (ds.Tables[0].Rows[n]["tempid"].ToString() != "") { model.tempid = int.Parse(ds.Tables[0].Rows[n]["tempid"].ToString()); } model.ts1 = ds.Tables[0].Rows[n]["ts1"].ToString(); model.ts2 = ds.Tables[0].Rows[n]["ts2"].ToString(); model.ts3 = ds.Tables[0].Rows[n]["ts3"].ToString(); model.ts4 = ds.Tables[0].Rows[n]["ts4"].ToString(); model.tstotal = ds.Tables[0].Rows[n]["tstotal"].ToString(); model.ydpzcode = ds.Tables[0].Rows[n]["ydpzcode"].ToString(); model.ydxkcode = ds.Tables[0].Rows[n]["ydxkcode"].ToString(); model.zjy = ds.Tables[0].Rows[n]["zjy"].ToString(); model.zygz = ds.Tables[0].Rows[n]["zygz"].ToString(); model.zzmj = ds.Tables[0].Rows[n]["zzmj"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(ERM.MDL.T_Projects model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(ERM.MDL.T_Projects model) { dal.Add(model); }