public PipeAddCommand(PipeState state, Pipe pipe , Cover injunc , Cover outjunc) { mState = state; mPipe = pipe; mInJunc = injunc; mOutJunc = outjunc; }
/// <summary> /// 界面中 增加管道 /// </summary> /// <param name="pipe"></param> /// <param name="Start"></param> /// <param name="End"></param> public void AddPipe(Pipe pipe, Point Start, Point End) { Path path = new Path(); path.Stroke = pipe.GetColorBrush(); path.Data = DrawPipe(Start, End); path.StrokeThickness = App.StrokeThinkness * 2/3; path.SetValue(Canvas.ZIndexProperty, -1); path.ToolTip = pipe; context.Children.Add(path); listpath.Add(path); }
/// <summary> /// 界面中 添加管道, /// </summary> /// <param name="pipe"></param> /// <param name="line"></param> /// <returns>创建的path</returns> public Path AddPipe(Pipe pipe, VectorLine line) { Path path = new Path(); path.Stroke = pipe.GetColorBrush(); path.Data = DrawPipe(line.StartPoint , line.EndPoint); path.StrokeThickness = App.StrokeThinkness * 2 / 3; path.SetValue(Canvas.ZIndexProperty, -1); path.ToolTip = pipe; context.Children.Add(path); listpath.Add(path); return path; }
public override void DelPipeFromData(Pipe pipe) { rainpipes.DelRainPipe((RainPipe)pipe); DeleteDb(pipe); }
public override int AddPipe2Data(Pipe pipe , Cover injunc , Cover outjunc) { rainpipes.AddRainPipe((RainPipe)pipe); //插入后台数据库 return InsterDb(pipe , injunc , outjunc); }
public override void DelPipeFromData(Pipe pipe) { wastepipes.DelWastePipe((WastePipe)pipe); DeleteDb(pipe); }
public override int AddPipe2Data(Pipe pipe, Cover injunc, Cover outjunc) { wastepipes.AddWastePipe((WastePipe)pipe); //插入后台数据库 return InsterDb(pipe, injunc, outjunc); }
//从数据库以及缓存中删除数据 public virtual void DelPipeFromData(Pipe pipe) { }
//添加数据到缓存数据以及数据库 public virtual int AddPipe2Data(Pipe pipe, Cover injuc, Cover outjunc) { return 0; }
protected void DeleteDb(Pipe pipe) { if (pipe == null) return; DeleteCmd dcmd = new DeleteCmd(); PipeRev piperev = new PipeRev(); piperev.ListPipe = new List<DBCtrl.DBClass.CPipeInfo>(); piperev.ListPipe.Add(pipe.pipeInfo); dcmd.SetReceiver(piperev); dcmd.Execute(); }
protected int InsterDb(Pipe pipe , Cover injunc , Cover outjunc) { CPipeInfo pipeInfo = new CPipeInfo(); CPipeExtInfo pipeExtInfo = new CPipeExtInfo(); CUSInfo UsInfo = new CUSInfo(); pipeInfo.PipeName = pipe.Name; pipeInfo.In_JunID = injunc.juncInfo.ID; pipeInfo.Out_JunID = outjunc.juncInfo.ID; pipeInfo.Pipe_Category = pipe.pipeInfo.Pipe_Category; UsInfo.Struct_Class = 0; TPipeInfo tpipeinfo = new TPipeInfo(App._dbpath, App.PassWord); TPipeExtInfo tpipextinfo = new TPipeExtInfo(App._dbpath, App.PassWord); TUSInfo tusinfo = new TUSInfo(App._dbpath, App.PassWord); tpipeinfo.Insert_PipeInfo(ref pipeInfo); pipeExtInfo.PipeID = pipeInfo.ID; tpipextinfo.Insert_PipeExtInfo(ref pipeExtInfo); UsInfo.PipeID = pipeInfo.ID; tusinfo.Insert_USInfo(ref UsInfo); return pipeInfo.ID; }