/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.cjplp GetModel(string Exp_NoOri) { StringBuilder strSql = new StringBuilder(); strSql.Append( "select MapCode,StormSystem_ID,Exp_NoOri,Type,X,Y,High,WellDeep,Offset,Feature,Subsid,Model,WellPipes,WellShape,WellSize,WellMaterial,WaterDeep,MudDeep,Inlet_Type,OutfallType,ReceiveWater,Flap,Flap_Diameter,Flap_TopEle,Flap_BotEle,Flap_Material,Address,PointPosition,DataSource,Visibility,Sdate,Mdate,Manhole_Type,status,Note,FileName,Uploadtime,Exp_No,ExpNoTime from cjplp "); strSql.Append(" where Exp_NoOri=@Exp_NoOri "); MySqlParameter[] parameters = { new MySqlParameter("@Exp_NoOri", MySqlDbType.VarChar, 255) }; parameters[0].Value = Exp_NoOri; Maticsoft.Model.cjplp model = new Maticsoft.Model.cjplp(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
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; }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Maticsoft.Model.cjplp model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into cjplp("); strSql.Append( "MapCode,StormSystem_ID,Exp_NoOri,Type,X,Y,High,WellDeep,Offset,Feature,Subsid,Model,WellPipes,WellShape,WellSize,WellMaterial,WaterDeep,MudDeep,Inlet_Type,OutfallType,ReceiveWater,Flap,Flap_Diameter,Flap_TopEle,Flap_BotEle,Flap_Material,Address,PointPosition,DataSource,Visibility,Sdate,Mdate,Manhole_Type,status,Note,FileName,Uploadtime,Exp_No,ExpNoTime)"); strSql.Append(" values ("); strSql.Append( "@MapCode,@StormSystem_ID,@Exp_NoOri,@Type,@X,@Y,@High,@WellDeep,@Offset,@Feature,@Subsid,@Model,@WellPipes,@WellShape,@WellSize,@WellMaterial,@WaterDeep,@MudDeep,@Inlet_Type,@OutfallType,@ReceiveWater,@Flap,@Flap_Diameter,@Flap_TopEle,@Flap_BotEle,@Flap_Material,@Address,@PointPosition,@DataSource,@Visibility,@Sdate,@Mdate,@Manhole_Type,@status,@Note,@FileName,@Uploadtime,@Exp_No,@ExpNoTime)"); MySqlParameter[] parameters = { new MySqlParameter("@MapCode", MySqlDbType.VarChar, 50), new MySqlParameter("@StormSystem_ID", MySqlDbType.VarChar, 100), new MySqlParameter("@Exp_NoOri", MySqlDbType.VarChar, 255), new MySqlParameter("@Type", MySqlDbType.VarChar, 10), new MySqlParameter("@X", MySqlDbType.Decimal, 10), new MySqlParameter("@Y", MySqlDbType.Decimal, 10), new MySqlParameter("@High", MySqlDbType.Decimal, 10), new MySqlParameter("@WellDeep", MySqlDbType.Decimal, 7), new MySqlParameter("@Offset", MySqlDbType.VarChar, 255), new MySqlParameter("@Feature", MySqlDbType.VarChar, 255), new MySqlParameter("@Subsid", MySqlDbType.VarChar, 255), new MySqlParameter("@Model", MySqlDbType.VarChar, 255), new MySqlParameter("@WellPipes", MySqlDbType.Int32, 10), new MySqlParameter("@WellShape", MySqlDbType.VarChar, 50), new MySqlParameter("@WellSize", MySqlDbType.VarChar, 150), new MySqlParameter("@WellMaterial", MySqlDbType.VarChar, 255), new MySqlParameter("@WaterDeep", MySqlDbType.Decimal, 10), new MySqlParameter("@MudDeep", MySqlDbType.Decimal, 10), new MySqlParameter("@Inlet_Type", MySqlDbType.VarChar, 10), new MySqlParameter("@OutfallType", MySqlDbType.VarChar, 10), new MySqlParameter("@ReceiveWater", MySqlDbType.VarChar, 255), new MySqlParameter("@Flap", MySqlDbType.VarChar, 10), new MySqlParameter("@Flap_Diameter", MySqlDbType.Decimal, 10), new MySqlParameter("@Flap_TopEle", MySqlDbType.Decimal, 10), new MySqlParameter("@Flap_BotEle", MySqlDbType.Decimal, 10), new MySqlParameter("@Flap_Material", MySqlDbType.VarChar, 255), new MySqlParameter("@Address", MySqlDbType.VarChar, 255), new MySqlParameter("@PointPosition", MySqlDbType.Int32, 10), new MySqlParameter("@DataSource", MySqlDbType.VarChar, 10), new MySqlParameter("@Visibility", MySqlDbType.VarChar, 50), new MySqlParameter("@Sdate", MySqlDbType.VarChar, 255), new MySqlParameter("@Mdate", MySqlDbType.VarChar, 255), new MySqlParameter("@Manhole_Type", MySqlDbType.VarChar, 10), new MySqlParameter("@status", MySqlDbType.VarChar, 10), new MySqlParameter("@Note", MySqlDbType.VarChar, 255), new MySqlParameter("@FileName", MySqlDbType.VarChar, 255), new MySqlParameter("@Uploadtime", MySqlDbType.VarChar, 255), new MySqlParameter("@Exp_No", MySqlDbType.VarChar, 100), new MySqlParameter("@ExpNoTime", MySqlDbType.VarChar, 255) }; parameters[0].Value = model.MapCode; parameters[1].Value = model.StormSystem_ID; parameters[2].Value = model.Exp_NoOri; parameters[3].Value = model.Type; parameters[4].Value = model.X; parameters[5].Value = model.Y; parameters[6].Value = model.High; parameters[7].Value = model.WellDeep; parameters[8].Value = model.Offset; parameters[9].Value = model.Feature; parameters[10].Value = model.Subsid; parameters[11].Value = model.Model; parameters[12].Value = model.WellPipes; parameters[13].Value = model.WellShape; parameters[14].Value = model.WellSize; parameters[15].Value = model.WellMaterial; parameters[16].Value = model.WaterDeep; parameters[17].Value = model.MudDeep; parameters[18].Value = model.Inlet_Type; parameters[19].Value = model.OutfallType; parameters[20].Value = model.ReceiveWater; parameters[21].Value = model.Flap; parameters[22].Value = model.Flap_Diameter; parameters[23].Value = model.Flap_TopEle; parameters[24].Value = model.Flap_BotEle; parameters[25].Value = model.Flap_Material; parameters[26].Value = model.Address; parameters[27].Value = model.PointPosition; parameters[28].Value = model.DataSource; parameters[29].Value = model.Visibility; parameters[30].Value = model.Sdate; parameters[31].Value = model.Mdate; parameters[32].Value = model.Manhole_Type; parameters[33].Value = model.status; parameters[34].Value = model.Note; parameters[35].Value = model.FileName; parameters[36].Value = model.Uploadtime; parameters[37].Value = model.Exp_No; parameters[38].Value = model.ExpNoTime; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.cjplp DataRowToModel(DataRow row) { Maticsoft.Model.cjplp model = new Maticsoft.Model.cjplp(); if (row != null) { if (row["MapCode"] != null) { model.MapCode = row["MapCode"].ToString(); } if (row["StormSystem_ID"] != null) { model.StormSystem_ID = row["StormSystem_ID"].ToString(); } if (row["Exp_NoOri"] != null) { model.Exp_NoOri = row["Exp_NoOri"].ToString(); } if (row["Type"] != null) { model.Type = row["Type"].ToString(); } if (row["X"] != null && row["X"].ToString() != "") { model.X = decimal.Parse(row["X"].ToString()); } if (row["Y"] != null && row["Y"].ToString() != "") { model.Y = decimal.Parse(row["Y"].ToString()); } if (row["High"] != null && row["High"].ToString() != "") { model.High = decimal.Parse(row["High"].ToString()); } if (row["WellDeep"] != null && row["WellDeep"].ToString() != "") { model.WellDeep = decimal.Parse(row["WellDeep"].ToString()); } if (row["Offset"] != null) { model.Offset = row["Offset"].ToString(); } if (row["Feature"] != null) { model.Feature = row["Feature"].ToString(); } if (row["Subsid"] != null) { model.Subsid = row["Subsid"].ToString(); } if (row["Model"] != null) { model.Model = row["Model"].ToString(); } if (row["WellPipes"] != null && row["WellPipes"].ToString() != "") { model.WellPipes = int.Parse(row["WellPipes"].ToString()); } if (row["WellShape"] != null) { model.WellShape = row["WellShape"].ToString(); } if (row["WellSize"] != null) { model.WellSize = row["WellSize"].ToString(); } if (row["WellMaterial"] != null) { model.WellMaterial = row["WellMaterial"].ToString(); } if (row["WaterDeep"] != null && row["WaterDeep"].ToString() != "") { model.WaterDeep = decimal.Parse(row["WaterDeep"].ToString()); } if (row["MudDeep"] != null && row["MudDeep"].ToString() != "") { model.MudDeep = decimal.Parse(row["MudDeep"].ToString()); } if (row["Inlet_Type"] != null) { model.Inlet_Type = row["Inlet_Type"].ToString(); } if (row["OutfallType"] != null) { model.OutfallType = row["OutfallType"].ToString(); } if (row["ReceiveWater"] != null) { model.ReceiveWater = row["ReceiveWater"].ToString(); } if (row["Flap"] != null) { model.Flap = row["Flap"].ToString(); } if (row["Flap_Diameter"] != null && row["Flap_Diameter"].ToString() != "") { model.Flap_Diameter = decimal.Parse(row["Flap_Diameter"].ToString()); } if (row["Flap_TopEle"] != null && row["Flap_TopEle"].ToString() != "") { model.Flap_TopEle = decimal.Parse(row["Flap_TopEle"].ToString()); } if (row["Flap_BotEle"] != null && row["Flap_BotEle"].ToString() != "") { model.Flap_BotEle = decimal.Parse(row["Flap_BotEle"].ToString()); } if (row["Flap_Material"] != null) { model.Flap_Material = row["Flap_Material"].ToString(); } if (row["Address"] != null) { model.Address = row["Address"].ToString(); } if (row["PointPosition"] != null && row["PointPosition"].ToString() != "") { model.PointPosition = int.Parse(row["PointPosition"].ToString()); } if (row["DataSource"] != null) { model.DataSource = row["DataSource"].ToString(); } if (row["Visibility"] != null) { model.Visibility = row["Visibility"].ToString(); } if (row["Sdate"] != null) { model.Sdate = row["Sdate"].ToString(); } if (row["Mdate"] != null) { model.Mdate = row["Mdate"].ToString(); } if (row["Manhole_Type"] != null) { model.Manhole_Type = row["Manhole_Type"].ToString(); } if (row["status"] != null) { model.status = row["status"].ToString(); } if (row["Note"] != null) { model.Note = row["Note"].ToString(); } if (row["FileName"] != null) { model.FileName = row["FileName"].ToString(); } if (row["Uploadtime"] != null) { model.Uploadtime = row["Uploadtime"].ToString(); } if (row["Exp_No"] != null) { model.Exp_No = row["Exp_No"].ToString(); } if (row["ExpNoTime"] != null) { model.ExpNoTime = row["ExpNoTime"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.cjplp model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update cjplp set "); strSql.Append("MapCode=@MapCode,"); strSql.Append("StormSystem_ID=@StormSystem_ID,"); strSql.Append("Type=@Type,"); strSql.Append("X=@X,"); strSql.Append("Y=@Y,"); strSql.Append("High=@High,"); strSql.Append("WellDeep=@WellDeep,"); strSql.Append("Offset=@Offset,"); strSql.Append("Feature=@Feature,"); strSql.Append("Subsid=@Subsid,"); strSql.Append("Model=@Model,"); strSql.Append("WellPipes=@WellPipes,"); strSql.Append("WellShape=@WellShape,"); strSql.Append("WellSize=@WellSize,"); strSql.Append("WellMaterial=@WellMaterial,"); strSql.Append("WaterDeep=@WaterDeep,"); strSql.Append("MudDeep=@MudDeep,"); strSql.Append("Inlet_Type=@Inlet_Type,"); strSql.Append("OutfallType=@OutfallType,"); strSql.Append("ReceiveWater=@ReceiveWater,"); strSql.Append("Flap=@Flap,"); strSql.Append("Flap_Diameter=@Flap_Diameter,"); strSql.Append("Flap_TopEle=@Flap_TopEle,"); strSql.Append("Flap_BotEle=@Flap_BotEle,"); strSql.Append("Flap_Material=@Flap_Material,"); strSql.Append("Address=@Address,"); strSql.Append("PointPosition=@PointPosition,"); strSql.Append("DataSource=@DataSource,"); strSql.Append("Visibility=@Visibility,"); strSql.Append("Sdate=@Sdate,"); strSql.Append("Mdate=@Mdate,"); strSql.Append("Manhole_Type=@Manhole_Type,"); strSql.Append("status=@status,"); strSql.Append("Note=@Note,"); strSql.Append("FileName=@FileName,"); strSql.Append("Uploadtime=@Uploadtime,"); strSql.Append("Exp_No=@Exp_No,"); strSql.Append("ExpNoTime=@ExpNoTime"); strSql.Append(" where Exp_NoOri=@Exp_NoOri "); MySqlParameter[] parameters = { new MySqlParameter("@MapCode", MySqlDbType.VarChar, 50), new MySqlParameter("@StormSystem_ID", MySqlDbType.VarChar, 100), new MySqlParameter("@Type", MySqlDbType.VarChar, 10), new MySqlParameter("@X", MySqlDbType.Decimal, 10), new MySqlParameter("@Y", MySqlDbType.Decimal, 10), new MySqlParameter("@High", MySqlDbType.Decimal, 10), new MySqlParameter("@WellDeep", MySqlDbType.Decimal, 7), new MySqlParameter("@Offset", MySqlDbType.VarChar, 255), new MySqlParameter("@Feature", MySqlDbType.VarChar, 255), new MySqlParameter("@Subsid", MySqlDbType.VarChar, 255), new MySqlParameter("@Model", MySqlDbType.VarChar, 255), new MySqlParameter("@WellPipes", MySqlDbType.Int32, 10), new MySqlParameter("@WellShape", MySqlDbType.VarChar, 50), new MySqlParameter("@WellSize", MySqlDbType.VarChar, 150), new MySqlParameter("@WellMaterial", MySqlDbType.VarChar, 255), new MySqlParameter("@WaterDeep", MySqlDbType.Decimal, 10), new MySqlParameter("@MudDeep", MySqlDbType.Decimal, 10), new MySqlParameter("@Inlet_Type", MySqlDbType.VarChar, 10), new MySqlParameter("@OutfallType", MySqlDbType.VarChar, 10), new MySqlParameter("@ReceiveWater", MySqlDbType.VarChar, 255), new MySqlParameter("@Flap", MySqlDbType.VarChar, 10), new MySqlParameter("@Flap_Diameter", MySqlDbType.Decimal, 10), new MySqlParameter("@Flap_TopEle", MySqlDbType.Decimal, 10), new MySqlParameter("@Flap_BotEle", MySqlDbType.Decimal, 10), new MySqlParameter("@Flap_Material", MySqlDbType.VarChar, 255), new MySqlParameter("@Address", MySqlDbType.VarChar, 255), new MySqlParameter("@PointPosition", MySqlDbType.Int32, 10), new MySqlParameter("@DataSource", MySqlDbType.VarChar, 10), new MySqlParameter("@Visibility", MySqlDbType.VarChar, 50), new MySqlParameter("@Sdate", MySqlDbType.VarChar, 255), new MySqlParameter("@Mdate", MySqlDbType.VarChar, 255), new MySqlParameter("@Manhole_Type", MySqlDbType.VarChar, 10), new MySqlParameter("@status", MySqlDbType.VarChar, 10), new MySqlParameter("@Note", MySqlDbType.VarChar, 255), new MySqlParameter("@FileName", MySqlDbType.VarChar, 255), new MySqlParameter("@Uploadtime", MySqlDbType.VarChar, 255), new MySqlParameter("@Exp_No", MySqlDbType.VarChar, 100), new MySqlParameter("@ExpNoTime", MySqlDbType.VarChar, 255), new MySqlParameter("@Exp_NoOri", MySqlDbType.VarChar, 255) }; parameters[0].Value = model.MapCode; parameters[1].Value = model.StormSystem_ID; parameters[2].Value = model.Type; parameters[3].Value = model.X; parameters[4].Value = model.Y; parameters[5].Value = model.High; parameters[6].Value = model.WellDeep; parameters[7].Value = model.Offset; parameters[8].Value = model.Feature; parameters[9].Value = model.Subsid; parameters[10].Value = model.Model; parameters[11].Value = model.WellPipes; parameters[12].Value = model.WellShape; parameters[13].Value = model.WellSize; parameters[14].Value = model.WellMaterial; parameters[15].Value = model.WaterDeep; parameters[16].Value = model.MudDeep; parameters[17].Value = model.Inlet_Type; parameters[18].Value = model.OutfallType; parameters[19].Value = model.ReceiveWater; parameters[20].Value = model.Flap; parameters[21].Value = model.Flap_Diameter; parameters[22].Value = model.Flap_TopEle; parameters[23].Value = model.Flap_BotEle; parameters[24].Value = model.Flap_Material; parameters[25].Value = model.Address; parameters[26].Value = model.PointPosition; parameters[27].Value = model.DataSource; parameters[28].Value = model.Visibility; parameters[29].Value = model.Sdate; parameters[30].Value = model.Mdate; parameters[31].Value = model.Manhole_Type; parameters[32].Value = model.status; parameters[33].Value = model.Note; parameters[34].Value = model.FileName; parameters[35].Value = model.Uploadtime; parameters[36].Value = model.Exp_No; parameters[37].Value = model.ExpNoTime; parameters[38].Value = model.Exp_NoOri; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
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"); }
/// <summary> /// 线编码 /// </summary> private void CjpllCode() { //try //{ Maticsoft.BLL.cjplp cjplpBLL = new Maticsoft.BLL.cjplp(); #region 线表编码 //街道的编码 streetno streetnoBLL = new streetno(); List <Maticsoft.Model.streetno> streetnoModeList = streetnoBLL.GetModelList("shortname is not NULL"); //顺序编码表 recordtable recordtableModel = new recordtable(); Maticsoft.BLL.recordtable recordtableBll = new Maticsoft.BLL.recordtable(); //获取待拆分的线表数据 cjpll cjpllBLL = new cjpll(); List <Maticsoft.Model.cjpll> cjpllModelList = cjpllBLL.GetModelList(""); for (int i = 0; i < cjpllModelList.Count; i++) { for (int j = 0; j < streetnoModeList.Count; j++) { if (!String.IsNullOrEmpty(cjpllModelList[i].Exp_No0) && !String.IsNullOrEmpty(cjpllModelList[i].Exp_No1) && !String.IsNullOrEmpty(cjpllModelList[i].Type) && !String.IsNullOrEmpty(cjpllModelList[i].Sdate) && cjpllModelList[i].FileName.Contains(streetnoModeList[j].shortname)) { cjplp exp_No0Model = cjplpBLL.GetModel(cjpllModelList[i].Exp_No0); cjplp exp_No1Model = cjplpBLL.GetModel(cjpllModelList[i].Exp_No1); if (exp_No0Model != null && exp_No1Model != null && !string.IsNullOrEmpty(exp_No0Model.Exp_No) && !string.IsNullOrEmpty(exp_No1Model.Exp_No)) { // string tmp = "type like '" + cjpllModelList[i].Type.Substring(0, 2) + // "%' and Lno like '" + // cjpllModelList[i].Type.Substring(0, 2) + // cjpllModelList[i].Sdate.Substring(0, 4) + // streetnoModeList[j].strnolast5 + "__" + // exp_No0Model.Exp_No.Substring(13) + // exp_No1Model.Exp_No.Substring(13) + "'"; //查询街道编码不为空的列 List <recordtable> recordtablesModelList = recordtableBll.GetModelList("type like '" + cjpllModelList[i].Type.Substring(0, 2) + "%' and Lno like '" + cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + "__" + exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13) + "'"); //1.填充起点、终点编码 cjpllModelList[i].S_Point = exp_No0Model.Exp_No; cjpllModelList[i].E_Point = exp_No1Model.Exp_No; //2.计算管线编码 if (recordtablesModelList.Count == 0) { //计算管线编号 cjpllModelList[i].Lno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + "01" + exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13); //2.插入记录表 recordtableModel.type = cjpllModelList[i].Type.Substring(0, 2); recordtableModel.year = cjpllModelList[i].Sdate.Substring(0, 4); recordtableModel.strnolast5 = streetnoModeList[j].strnolast5; recordtableModel.inteno = 1; recordtableModel.serino = Convert.ToInt32(exp_No0Model.Exp_No.Substring(13)) + Convert.ToInt32(exp_No1Model.Exp_No.Substring(13)); recordtableModel.typeYear = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4); recordtableModel.typeYearStrnolast5 = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5; recordtableModel.typeYearStrnolast5Inteno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + "01"; recordtableModel.inteserino = exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13); recordtableModel.Lno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + "01" + exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13); recordtableBll.Add(recordtableModel); // Console.WriteLine("线线线添加" + recordtableModel.Lno); } else { List <int> seriaList = new List <int>(); for (int k = 0; k < recordtablesModelList.Count; k++) { seriaList.Add(Convert.ToInt16(recordtablesModelList[k].Lno.Substring(11, 2))); } //计算管线编号 cjpllModelList[i].Lno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + seriaList.Max().ToString().PadLeft(2, '0') + exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13); //2.插入记录表 recordtableModel.inteno = seriaList.Max(); recordtableModel.typeYearStrnolast5Inteno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + seriaList.Max().ToString().PadLeft(2, '0'); recordtableModel.Lno = cjpllModelList[i].Type.Substring(0, 2) + cjpllModelList[i].Sdate.Substring(0, 4) + streetnoModeList[j].strnolast5 + seriaList.Max().ToString().PadLeft(2, '0') + exp_No0Model.Exp_No.Substring(13) + exp_No1Model.Exp_No.Substring(13); recordtableBll.Update(recordtableModel); // Console.WriteLine("线线线更新" + recordtableModel.Lno); } //3.计算管线长度 if (!String.IsNullOrEmpty(exp_No0Model.X.ToString()) && !String.IsNullOrEmpty(exp_No0Model.Y.ToString()) && !String.IsNullOrEmpty(exp_No1Model.X.ToString()) && !String.IsNullOrEmpty(exp_No1Model.Y.ToString())) { cjpllModelList[i].PipeLength = (decimal)calculatePipeLength(exp_No0Model, exp_No1Model); } cjpllModelList[i].LnoTime = DateTime.Now.ToString() + "." + DateTime.Now.Millisecond.ToString(); //更新管线计算内容 cjpllBLL.Update(cjpllModelList[i]); break; } } } } #endregion //} //catch (Exception e) //{ // Console.WriteLine(e); // throw; //} }