private void ShowInfo(string Exp_No) { Maticsoft.BLL.cjplp bll = new Maticsoft.BLL.cjplp(); Maticsoft.Model.cjplp model = bll.GetModel(Exp_No); this.lblMapCode.Text = model.MapCode; this.lblStormSystem_ID.Text = model.StormSystem_ID; this.lblExp_No.Text = model.Exp_No; this.lblType.Text = model.Type; this.lblX.Text = model.X.ToString(); this.lblY.Text = model.Y.ToString(); this.lblHigh.Text = model.High.ToString(); this.lblWellDeep.Text = model.WellDeep.ToString(); this.lblOffset.Text = model.Offset; this.lblFeature.Text = model.Feature; this.lblSubsid.Text = model.Subsid; this.lblModel.Text = model.Model; this.lblWellPipes.Text = model.WellPipes; this.lblWellShape.Text = model.WellShape; this.lblWellSize.Text = model.WellSize; this.lblWellMaterial.Text = model.WellMaterial; this.lblWaterDeep.Text = model.WaterDeep.ToString(); this.lblMudDeep.Text = model.MudDeep.ToString(); this.lblInlet_Type.Text = model.Inlet_Type; this.lblOutfallType.Text = model.OutfallType; this.lblReceiveWater.Text = model.ReceiveWater; this.lblFlap.Text = model.Flap; this.lblFlap_Diameter.Text = model.Flap_Diameter.ToString(); this.lblFlap_TopEle.Text = model.Flap_TopEle.ToString(); this.lblFlap_BotEle.Text = model.Flap_BotEle.ToString(); this.lblFlap_Material.Text = model.Flap_Material; this.lblAddress.Text = model.Address; this.lblPointPosition.Text = model.PointPosition; this.lblDataSource.Text = model.DataSource; this.lblVisibility.Text = model.Visibility; this.lblSdate.Text = model.Sdate; this.lblMdate.Text = model.Mdate; this.lblManhole_Type.Text = model.Manhole_Type; this.lblstatus.Text = model.status; this.lblNote.Text = model.Note; }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtMapCode.Text.Trim().Length == 0) { strErr += "MapCode不能为空!\\n"; } if (this.txtStormSystem_ID.Text.Trim().Length == 0) { strErr += "StormSystem_ID不能为空!\\n"; } if (this.txtExp_No.Text.Trim().Length == 0) { strErr += "Exp_No不能为空!\\n"; } if (this.txtType.Text.Trim().Length == 0) { strErr += "Type不能为空!\\n"; } if (!PageValidate.IsDecimal(txtX.Text)) { strErr += "X格式错误!\\n"; } if (!PageValidate.IsDecimal(txtY.Text)) { strErr += "Y格式错误!\\n"; } if (!PageValidate.IsDecimal(txtHigh.Text)) { strErr += "High格式错误!\\n"; } if (!PageValidate.IsDecimal(txtWellDeep.Text)) { strErr += "WellDeep格式错误!\\n"; } if (this.txtOffset.Text.Trim().Length == 0) { strErr += "Offset不能为空!\\n"; } if (this.txtFeature.Text.Trim().Length == 0) { strErr += "Feature不能为空!\\n"; } if (this.txtSubsid.Text.Trim().Length == 0) { strErr += "Subsid不能为空!\\n"; } if (this.txtModel.Text.Trim().Length == 0) { strErr += "Model不能为空!\\n"; } if (this.txtWellPipes.Text.Trim().Length == 0) { strErr += "WellPipes不能为空!\\n"; } if (this.txtWellShape.Text.Trim().Length == 0) { strErr += "WellShape不能为空!\\n"; } if (this.txtWellSize.Text.Trim().Length == 0) { strErr += "WellSize不能为空!\\n"; } if (this.txtWellMaterial.Text.Trim().Length == 0) { strErr += "WellMaterial不能为空!\\n"; } if (!PageValidate.IsDecimal(txtWaterDeep.Text)) { strErr += "WaterDeep格式错误!\\n"; } if (!PageValidate.IsDecimal(txtMudDeep.Text)) { strErr += "MudDeep格式错误!\\n"; } if (this.txtInlet_Type.Text.Trim().Length == 0) { strErr += "Inlet_Type不能为空!\\n"; } if (this.txtOutfallType.Text.Trim().Length == 0) { strErr += "OutfallType不能为空!\\n"; } if (this.txtReceiveWater.Text.Trim().Length == 0) { strErr += "ReceiveWater不能为空!\\n"; } if (this.txtFlap.Text.Trim().Length == 0) { strErr += "Flap不能为空!\\n"; } if (!PageValidate.IsDecimal(txtFlap_Diameter.Text)) { strErr += "Flap_Diameter格式错误!\\n"; } if (!PageValidate.IsDecimal(txtFlap_TopEle.Text)) { strErr += "Flap_TopEle格式错误!\\n"; } if (!PageValidate.IsDecimal(txtFlap_BotEle.Text)) { strErr += "Flap_BotEle格式错误!\\n"; } if (this.txtFlap_Material.Text.Trim().Length == 0) { strErr += "Flap_Material不能为空!\\n"; } if (this.txtAddress.Text.Trim().Length == 0) { strErr += "Address不能为空!\\n"; } if (this.txtPointPosition.Text.Trim().Length == 0) { strErr += "PointPosition不能为空!\\n"; } if (this.txtDataSource.Text.Trim().Length == 0) { strErr += "DataSource不能为空!\\n"; } if (this.txtVisibility.Text.Trim().Length == 0) { strErr += "Visibility不能为空!\\n"; } if (this.txtSdate.Text.Trim().Length == 0) { strErr += "Sdate不能为空!\\n"; } if (this.txtMdate.Text.Trim().Length == 0) { strErr += "Mdate不能为空!\\n"; } if (this.txtManhole_Type.Text.Trim().Length == 0) { strErr += "Manhole_Type不能为空!\\n"; } if (this.txtstatus.Text.Trim().Length == 0) { strErr += "status不能为空!\\n"; } if (this.txtNote.Text.Trim().Length == 0) { strErr += "Note不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string MapCode = this.txtMapCode.Text; string StormSystem_ID = this.txtStormSystem_ID.Text; string Exp_No = this.txtExp_No.Text; string Type = this.txtType.Text; decimal X = decimal.Parse(this.txtX.Text); decimal Y = decimal.Parse(this.txtY.Text); decimal High = decimal.Parse(this.txtHigh.Text); decimal WellDeep = decimal.Parse(this.txtWellDeep.Text); string Offset = this.txtOffset.Text; string Feature = this.txtFeature.Text; string Subsid = this.txtSubsid.Text; string Model = this.txtModel.Text; string WellPipes = this.txtWellPipes.Text; string WellShape = this.txtWellShape.Text; string WellSize = this.txtWellSize.Text; string WellMaterial = this.txtWellMaterial.Text; decimal WaterDeep = decimal.Parse(this.txtWaterDeep.Text); decimal MudDeep = decimal.Parse(this.txtMudDeep.Text); string Inlet_Type = this.txtInlet_Type.Text; string OutfallType = this.txtOutfallType.Text; string ReceiveWater = this.txtReceiveWater.Text; string Flap = this.txtFlap.Text; decimal Flap_Diameter = decimal.Parse(this.txtFlap_Diameter.Text); decimal Flap_TopEle = decimal.Parse(this.txtFlap_TopEle.Text); decimal Flap_BotEle = decimal.Parse(this.txtFlap_BotEle.Text); string Flap_Material = this.txtFlap_Material.Text; string Address = this.txtAddress.Text; string PointPosition = this.txtPointPosition.Text; string DataSource = this.txtDataSource.Text; string Visibility = this.txtVisibility.Text; string Sdate = this.txtSdate.Text; string Mdate = this.txtMdate.Text; string Manhole_Type = this.txtManhole_Type.Text; string status = this.txtstatus.Text; string Note = this.txtNote.Text; Maticsoft.Model.cjplp model = new Maticsoft.Model.cjplp(); model.MapCode = MapCode; model.StormSystem_ID = StormSystem_ID; model.Exp_No = Exp_No; model.Type = Type; model.X = X; model.Y = Y; model.High = High; model.WellDeep = WellDeep; model.Offset = Offset; model.Feature = Feature; model.Subsid = Subsid; model.Model = Model; model.WellPipes = WellPipes; model.WellShape = WellShape; model.WellSize = WellSize; model.WellMaterial = WellMaterial; model.WaterDeep = WaterDeep; model.MudDeep = MudDeep; model.Inlet_Type = Inlet_Type; model.OutfallType = OutfallType; model.ReceiveWater = ReceiveWater; model.Flap = Flap; model.Flap_Diameter = Flap_Diameter; model.Flap_TopEle = Flap_TopEle; model.Flap_BotEle = Flap_BotEle; model.Flap_Material = Flap_Material; model.Address = Address; model.PointPosition = PointPosition; model.DataSource = DataSource; model.Visibility = Visibility; model.Sdate = Sdate; model.Mdate = Mdate; model.Manhole_Type = Manhole_Type; model.status = status; model.Note = Note; Maticsoft.BLL.cjplp bll = new Maticsoft.BLL.cjplp(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
public static void asynExportInfoTabl() { // List<string> list = new List<string>(); //点表 Maticsoft.BLL.cjplp cjplpBLL = new Maticsoft.BLL.cjplp(); List <Maticsoft.Model.cjplp> cjplpModelList = cjplpBLL.GetFileNames(); //线表 Maticsoft.BLL.cjpll cjpllBLL = new Maticsoft.BLL.cjpll(); List <Maticsoft.Model.cjpll> cjpllModelList = cjpllBLL.GetFileNames(); Maticsoft.BLL.exportinfo exportinfoBLL = new Maticsoft.BLL.exportinfo(); Maticsoft.Model.exportinfo exportinfoModel = new Maticsoft.Model.exportinfo(); List <Maticsoft.Model.exportinfo> exportinfosModelList = exportinfoBLL.GetModelList(""); if (cjplpModelList.Count > 0) { //第一种情况:对于数据库中有的,但是同步表中没有的,需要增加 var exp2 = cjplpModelList.Where(a => !exportinfosModelList.Exists(t => a.FileName.Contains(t.FileName))).ToList(); // Console.WriteLine("--查找student1集合中存在,而student2不存在的数据--"); foreach (var item in exp2) { // Console.WriteLine("{0} \t {1} \t {2}", item.name, item.subject, item.score); string[] tempArr = item.FileName.Split('-'); //导出配置表(exportinfo)中没有配置数据,则直接插入 exportinfoModel.Address = item.Address; exportinfoModel.Basin = tempArr.Length > 0 ? tempArr[0] : string.Empty; exportinfoModel.Strname = tempArr.Length > 1 ? tempArr[1] : string.Empty; exportinfoModel.Plot = tempArr.Length > 2 ? tempArr[2].Substring(0, tempArr[2].IndexOf("_")) : string.Empty; exportinfoModel.FileName = item.FileName; exportinfoBLL.Add(exportinfoModel); } } if (cjpllModelList.Count > 0) { //第一种情况:对于数据库中有的,但是同步表中没有的,需要增加 var exp2 = cjpllModelList.Where(a => !exportinfosModelList.Exists(t => a.FileName.Contains(t.FileName))).ToList(); // Console.WriteLine("--查找student1集合中存在,而student2不存在的数据--"); foreach (var item in exp2) { // Console.WriteLine("{0} \t {1} \t {2}", item.name, item.subject, item.score); string[] tempArr = item.FileName.Split('-'); //导出配置表(exportinfo)中没有配置数据,则直接插入 exportinfoModel.Address = item.Address; exportinfoModel.Basin = tempArr.Length > 0 ? tempArr[0] : string.Empty; exportinfoModel.Strname = tempArr.Length > 1 ? tempArr[1] : string.Empty; exportinfoModel.Plot = tempArr.Length > 2 ? tempArr[2].Substring(0, tempArr[2].IndexOf("_")) : string.Empty; exportinfoModel.FileName = item.FileName; exportinfoBLL.Add(exportinfoModel); } } if (exportinfosModelList.Count > 0) { //第二种情况:对于数据库中有的,但是同步表中没有的,需要增加 List <Maticsoft.Model.exportinfo> expPoint = exportinfosModelList.Where(a => !cjplpModelList.Exists(t => a.FileName.Contains(t.FileName))).ToList(); List <Maticsoft.Model.exportinfo> exLine = exportinfosModelList.Where(a => !cjpllModelList.Exists(t => a.FileName.Contains(t.FileName))).ToList(); // Console.WriteLine("--查找student1集合中存在,而student2不存在的数据--"); List <Maticsoft.Model.exportinfo> resultExportinfosList = expPoint.Union(exLine).ToList(); foreach (Maticsoft.Model.exportinfo item in resultExportinfosList) { exportinfoBLL.Delete(item.id); } } }
/// <summary> /// 上传点表 /// </summary> /// <returns></returns> private bool UpLoadPointSheet() { try { if (String.IsNullOrEmpty(this.textEditPointSheet.Text)) { MessageBox.Show("点表表单为空!请选择点表", "提示"); return(true); } DataSet dataSet = ExcelToDataSet(excelPath, this.textEditPointSheet.Text.Trim()); DataTable dataTable = dataSet.Tables[0]; //1.填充数据名称和数据上传时间字段 dataTable.Columns.Add("FileName", typeof(string)); dataTable.Columns.Add("Uploadtime", typeof(string)); for (int i = 0; i < dataTable.Rows.Count; i++) { dataTable.Rows[i]["FileName"] = Path.GetFileNameWithoutExtension(excelPath); dataTable.Rows[i]["Uploadtime"] = DateTime.Now.ToString(); } cjplp cjplpBLL = new cjplp(); List <Maticsoft.Model.cjplp> cjplpModelList = cjplpBLL.DataTableToList(dataTable); cjplpback cjplpBackBLL = new cjplpback(); List <Maticsoft.Model.cjplpback> cjplpBackModelList = cjplpBackBLL.DataTableToList(dataTable); exportinfo exportinfoBLL = new exportinfo(); Maticsoft.Model.exportinfo exportinfoModel = new Maticsoft.Model.exportinfo(); for (int i = 0; i < cjplpModelList.Count; i++) { List <Maticsoft.Model.exportinfo> exportinfosModelList = exportinfoBLL.GetModelList(""); //不重复的数据 if (!cjplpBLL.Exists(cjplpModelList[i].Exp_NoOri)) { //点表不重复的数据,直接插入 cjplpBLL.Add(cjplpModelList[i]); } else { //存在就更新点表中原有的数据,因为可能只修改了数据的属性 cjplpBLL.Update(cjplpModelList[i]); //备份的数据库中,不重复的数据,则插入,否则,则更新 if (!cjplpBackBLL.Exists(cjplpModelList[i].Exp_NoOri)) { cjplpBackBLL.Add(cjplpBackModelList[i]); } else { cjplpBackBLL.Update(cjplpBackModelList[i]); } } //导出配置表(exportinfo)中有配置数据,则对比 if (exportinfosModelList.Count > 0) { Int32 flag = 0; //导出表的配置 for (int j = 0; j < exportinfosModelList.Count; j++) { if (exportinfosModelList[j].Address != cjplpModelList[i].Address || !cjplpModelList[i].FileName.Contains(exportinfosModelList[j].Basin) || !cjplpModelList[i].FileName.Contains(exportinfosModelList[j].Strname) || !cjplpModelList[i].FileName.Contains(exportinfosModelList[j].Plot)) { flag++; } if (flag == exportinfosModelList.Count) { string[] tempArr = cjplpModelList[i].FileName.Split('-'); //导出配置表(exportinfo)中没有配置数据,则直接插入 exportinfoModel.Address = cjplpModelList[i].Address; exportinfoModel.Basin = tempArr.Length > 0 ? tempArr[0] : string.Empty; exportinfoModel.Strname = tempArr.Length > 1 ? tempArr[1] : string.Empty; exportinfoModel.Plot = tempArr.Length > 2 ? tempArr[2].Substring(0, tempArr[2].IndexOf("_")) : string.Empty; exportinfoModel.FileName = cjplpModelList[i].FileName; exportinfoBLL.Add(exportinfoModel); } } } else { string[] tempArr = cjplpModelList[i].FileName.Split('-'); //导出配置表(exportinfo)中没有配置数据,则直接插入 exportinfoModel.Address = cjplpModelList[i].Address; exportinfoModel.Basin = tempArr.Length > 0 ? tempArr[0] : string.Empty; exportinfoModel.Strname = tempArr.Length > 1 ? tempArr[1] : string.Empty; exportinfoModel.Plot = tempArr.Length > 2 ? tempArr[2].Substring(0, tempArr[2].IndexOf("_")) : string.Empty; exportinfoModel.FileName = cjplpModelList[i].FileName; exportinfoBLL.Add(exportinfoModel); } } } catch (Exception e) { Console.WriteLine(e); throw; } return(false); }
/// <summary> /// 同步编码记录表记录(RecordTable) /// </summary> public static void asynRecordTabl() { //顺序编码表 Maticsoft.BLL.recordtable recordtableBll = new Maticsoft.BLL.recordtable(); //1.获取编码过的点表数据 Maticsoft.BLL.cjplp cjplpBLL = new Maticsoft.BLL.cjplp(); List <cjplp> cjplpModelList = cjplpBLL.GetMaxCodeModelList(); for (int i = 0; i < cjplpModelList.Count; i++) { //编码不为空 if (!String.IsNullOrEmpty(cjplpModelList[i].Exp_No)) { // List<Maticsoft.Model.recordtable> recordtableModelList =recordtableBll.GetModelList("(Lno is null or trim(lno)=='') and type=" + // cjplpModelList[i].Type.Substring(0, 2)); List <Maticsoft.Model.recordtable> recordtableModelList = recordtableBll.GetModelList("type='" + cjplpModelList[i].Type.Substring(0, 2) + "'"); for (int j = 0; j < recordtableModelList.Count; j++) { //如果不相等,则更新recordtable,相同,则不做任何操作 if (recordtableModelList[j].Exp_No != cjplpModelList[i].Exp_No) { recordtableModelList[j].year = cjplpModelList[i].Exp_No.Substring(2, 4); recordtableModelList[j].strnolast5 = cjplpModelList[i].Exp_No.Substring(6, 5); recordtableModelList[j].inteno = Convert.ToInt32(cjplpModelList[i].Exp_No.Substring(11, 2)); recordtableModelList[j].serino = Convert.ToInt32(cjplpModelList[i].Exp_No.Substring(13, 5)); recordtableModelList[j].typeYear = cjplpModelList[i].Exp_No.Substring(0, 6); recordtableModelList[j].typeYearStrnolast5 = cjplpModelList[i].Exp_No.Substring(0, 11); recordtableModelList[j].typeYearStrnolast5Inteno = cjplpModelList[i].Exp_No.Substring(0, 13); recordtableModelList[j].inteserino = cjplpModelList[i].Exp_No.Substring(11, 7); recordtableModelList[j].Exp_No = cjplpModelList[i].Exp_No; recordtableBll.Update(recordtableModelList[j]); } } } } //2.获取编码过的线表数据 Maticsoft.BLL.cjpll cjpllBLL = new Maticsoft.BLL.cjpll(); List <Maticsoft.Model.cjpll> cjpllModelList = cjpllBLL.GetMaxCodeModelList(); for (int i = 0; i < cjpllModelList.Count; i++) { if (!String.IsNullOrEmpty(cjpllModelList[i].Lno)) { // List<Maticsoft.Model.recordtable> recordtableModelList = recordtableBll.GetModelList("(Exp_No is null or trim(Exp_No)=='') and type=" + // cjpllModelList[i].Type.Substring(0, 2)); List <Maticsoft.Model.recordtable> recordtableModelList = recordtableBll.GetModelList("type='" + cjpllModelList[i].Type.Substring(0, 2) + "'"); for (int j = 0; j < recordtableModelList.Count; j++) { //如果不相等,则更新recordtable,相同,则不做任何操作 if (recordtableModelList[j].Lno != cjpllModelList[i].Lno) { recordtableModelList[j].year = cjpllModelList[i].Lno.Substring(2, 4); recordtableModelList[j].strnolast5 = cjpllModelList[i].Lno.Substring(6, 5); recordtableModelList[j].inteno = Convert.ToInt32(cjpllModelList[i].Lno.Substring(11, 2)); recordtableModelList[j].serino = Convert.ToInt32(cjpllModelList[i].Lno.Substring(13, 10)); recordtableModelList[j].typeYear = cjpllModelList[i].Lno.Substring(0, 6); recordtableModelList[j].typeYearStrnolast5 = cjpllModelList[i].Lno.Substring(0, 11); recordtableModelList[j].typeYearStrnolast5Inteno = cjpllModelList[i].Lno.Substring(0, 13); recordtableModelList[j].inteserino = cjpllModelList[i].Lno.Substring(11, 12); recordtableModelList[j].Lno = cjpllModelList[i].Lno; recordtableBll.Update(recordtableModelList[j]); } } } } }