private bool SaverTodb(List <USSheetData> list) { if (list == null || list.Count <= 0) { return(false); } QuickInsert icm = new QuickInsert(); PipeRev rev = new PipeRev(); LoadCmd lcmd = new LoadCmd(); lcmd.SetReceiver(rev); lcmd.Execute(); string pname = ""; try { foreach (USSheetData data in list) { CUSInfo info = new CUSInfo(); info.PipeID = GetPipeID(data.PipeName, rev.ListPipe); info.JobID = data.JobID; info.DetectDate = data.CheckDate; info.DetectDep = data.CheckDept; info.Detect_Person = data.CheckPerson; info.Contacts = data.CheckContact; info.Detect_Method = GetCheckMethod(data.CheckMethod); info.Detect_Dir = GetCheckDir(data.CheckDirect); info.Pipe_Stop = data.Pipe_Stop; info.Func_Defect = GetFuncDef(data.Func_Defect); info.Func_Class = GetClass(data.Func_Class); info.Strcut_Defect = GetStructDef(data.Struct_Defect); info.Struct_Class = GetClass(data.Struct_Class); if (IsDouble(data.Repire_Index)) { info.Repair_Index = Convert.ToDouble(data.Repire_Index); } else { info.Repair_Index = 0; } if (IsDouble(data.Matain_Index)) { info.Matain_Index = Convert.ToDouble(data.Matain_Index); } else { info.Matain_Index = 0; } info.Problem = data.Problem; info.Video_Filename = data.Video_Filename; info.ReportDept = data.RecordDept; info.ReportDate = data.RecordTime; info.DataIsFull = data.DataFull; info.LoseReason = data.LoseReson; info.Remark = data.Remark; rev.ListUS.Add(info); pname = data.PipeName; } } catch (Exception e) { Console.WriteLine("PipeName : {0} in exception{1}", pname, e.Message); } rev.ListPipe.Clear(); rev.ListPipeExt.Clear(); icm.SetReceiver(rev); icm.Execute(); return(true); }
private static void ConfigMainCommands() { cmdArray.AddCommand(c => { //выводит список выбранных клиентов c.Name = "current"; c.Execute = (CommandData[] arguments) => { foreach (Client cli in data.selected) { Console.WriteLine(cli); } }; }); cmdArray.AddCommand(c => { //запрашивает у сервера клинтов по имени и или группе и выбирает их CommandDataPattern pattern = new CommandDataPattern() .AddOption('n', true) .AddOption('g', true); ICommand cmd = new ClientsCmd(data, pattern); c.Name = "clients"; c.Execute = (CommandData[] arguments) => { cmd.Execute(arguments[0]); }; }); cmdArray.AddCommand(c => { //завершает работу програмы c.Name = "exit"; c.Execute = (CommandData[] arguments) => { if (!data.server.IsClosed()) { data.server.Close(); } data.execute = false; }; }); cmdArray.AddCommand(c => { //записывает в консоль руководство по команде ICommand cmd = new HelpCmd(data, CommandDataPattern.EmptyPattern); c.Name = "help"; c.Execute = (CommandData[] arguments) => { cmd.Execute(arguments[0]); }; }); cmdArray.AddCommand(c => { CommandDataPattern pattern = new CommandDataPattern() .AddOption('c', true); ICommand cmd = new StressCmd(data, pattern); c.Name = "stress"; c.Execute = (CommandData[] arguments) => { cmd.Execute(arguments[0]); }; }); cmdArray.AddCommand(c => { CommandDataPattern pattern = new CommandDataPattern() .AddOption('r', true) .AddOption('m', true) .AddOption('d', true) .AddOption('a', true) .AddOption('l', true) .AddOption('x', true) .AddOption('c', true); ICommand cmd = new LoadCmd(data, pattern); c.Name = "load"; c.Execute = (CommandData[] arguments) => { cmd.Execute(arguments[0]); }; }); cmdArray.AddCommand(c => { ICommand cmd = new PerformCmd(data, CommandDataPattern.EmptyPattern); c.Name = "perform"; c.Execute = (CommandData[] arguments) => { cmd.Execute(arguments[0]); }; }); }
private bool SaverTodb(List <PipeSheetData> list) { //get the juncinfo. then if (list == null || list.Count <= 0) { return(false); } QuickInsert icm = new QuickInsert(); PipeRev rev = new PipeRev(); rev.ListPipe = new List <CPipeInfo>(); rev.ListPipeExt = new List <CPipeExtInfo>(); LoadCmd lcmd = new LoadCmd(); JuncRev junrev = new JuncRev(); lcmd.SetReceiver(junrev); lcmd.Execute(); string pname = ""; try { foreach (PipeSheetData data in list) { CPipeInfo info = new CPipeInfo(); CPipeExtInfo extinfo = new CPipeExtInfo(); extinfo.Lane_Way = data.RoadName; info.PipeName = data.PipeName; info.Pipe_Category = GetCategory(data.PipeCategory); info.Pipe_Len = 0;//default int inid = CheckID(data.InCode, junrev.ListJunc); int outid = CheckID(data.OutCode, junrev.ListJunc); info.In_JunID = inid; info.Out_JunID = outid; info.In_UpEle = data.In_UpEle; info.In_BottomEle = data.In_BottomEle; info.Out_UpEle = data.Out_UpEle; info.Out_BottomEle = data.Out_UpEle; info.Shape_Data1 = data.In_R; info.Shape_Data2 = data.Out_R; info.ShapeType = GetShapeType(data.ShapeType); info.ShapeData = data.ShapeData; info.Material = Getmaterial(data.Matrial); info.Roughness = data.Roughness; info.DataSource = GetDataSource(data.DataSource); info.Record_Date = data.DataTime; info.ReportDept = data.RecordDept; info.ReportDate = data.RecordTime; extinfo.DataIsFull = data.DataFull; extinfo.LoseReason = data.LoseReson; extinfo.Remark = data.Remark; rev.ListPipe.Add(info); rev.ListPipeExt.Add(extinfo); pname = data.PipeName; } } catch (Exception e) { Console.WriteLine("PipeName : {0} in exception{1}", pname, e.Message); } icm.SetReceiver(rev); icm.Execute(); return(true); }