コード例 #1
0
 public static void SetMessageLevel(MethodID messageMethod = MethodID.MESS_METHOD_GENERAL_ID,
                                    LevelID messageLevel   = LevelID.MESS_LEVEL_GENERAL)
 {
     //Call the version 6 and 7 set message level first, if the file is 6 then the ZSetMessageLevel will not work, and we can still use MethodIDs for 7.
     DSS.ZSet("mlvl", "", (int)messageLevel);
     DSS.ZSetMessageLevel((int)messageMethod, (int)messageLevel);
 }
コード例 #2
0
        public int InsertBatch(IEnumerable <M> mList)
        {
            DC.Action = ActionEnum.Insert;
            var tm = DC.XC.GetTableModel(typeof(M));

            if (tm.HaveAutoIncrementPK)
            {
                return(DC.BDH.StepProcessSync(mList, 1, list =>
                {
                    DC.DPH.ResetParameter();
                    CreateMHandle(list);
                    PreExecuteHandle(UiMethodEnum.CreateBatch);
                    return DSS.ExecuteNonQuery <M>(list);
                }));
            }
            else
            {
                return(DC.BDH.StepProcessSync(mList, 100, list =>
                {
                    DC.DPH.ResetParameter();
                    CreateMHandle(list);
                    PreExecuteHandle(UiMethodEnum.CreateBatch);
                    return DSS.ExecuteNonQuery <M>(list);
                }));
            }
        }
コード例 #3
0
 public List <M> SelectList <M>()
     where M : class
 {
     SelectMHandle <M>();
     PreExecuteHandle(UiMethodEnum.QueryList);
     return(DSS.ExecuteReaderMultiRow <M>());
 }
コード例 #4
0
 public List <M> Top(int count)
 {
     DC.PageIndex = 0;
     DC.PageSize  = count;
     PreExecuteHandle(UiMethodEnum.Top);
     return(DSS.ExecuteReaderMultiRow <M>());
 }
コード例 #5
0
ファイル: QueryListSyncImpl.cs プロジェクト: hpc-dal/HPC.DAL
 public List <VM> QueryList <VM>()
     where VM : class
 {
     SelectMQ <M, VM>();
     PreExecuteHandle(UiMethodEnum.QueryList);
     return(DSS.ExecuteReaderMultiRow <VM>());
 }
コード例 #6
0
 public PagingResult <M> QueryPaging(int pageIndex, int pageSize)
 {
     DC.PageIndex = pageIndex;
     DC.PageSize  = pageSize;
     PreExecuteHandle(UiMethodEnum.QueryPaging);
     return(DSS.ExecuteReaderPaging <None, M>(false, null));
 }
コード例 #7
0
        void AssertExtractJulian(string date, int expectedJulian)
        {
            int j = DSS.DateToJulian(date);

            Assert.IsTrue(DSS.IsTimeDefined(j, 0));
            Assert.AreEqual(expectedJulian, j);
        }
コード例 #8
0
        public void BugInvalidDate()
        {
            int j = DSS.DateToJulian("22JUN2016 12:00");// this is NOT a valid date, because of the time.

            Console.WriteLine(j);
            Assert.IsFalse(DSS.IsTimeDefined(j, 0));// = -693786(NOT OK ?)
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: piripinui/powerflow
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                //Console.WriteLine("Starting OpenDSS...");
                filePath   = args[0];
                resultPath = args[1];

                SimpleHTTPServer myServer = new SimpleHTTPServer(filePath, 3001);
                Console.WriteLine("Server is running on this port: " + myServer.Port.ToString());

                try
                {
                    dss = new DSS();
                    if (!(dss.Start(0)))
                    {
                        Console.WriteLine("OpenDSS failed to start");
                    }
                    else
                    {
                        //Console.WriteLine("OpenDSS started successfully");
                        DSSText = dss.Text;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            else
            {
                Console.WriteLine("Error: DSS file parameter is required (e.g. \"powerflow.exe myfile.dss <result_dir>\").");
            }
        }
コード例 #10
0
ファイル: Form1.cs プロジェクト: tshort/OpenDSS
 private void button1_Click(object sender, EventArgs e)
 {
     DSSObj = new DSS();
     if (DSSObj.Start(0))
     {
       MessageBox.Show("OpenDSS Started OK");
     };
 }
コード例 #11
0
 public PagingResult <VM> QueryPaging <VM>(int pageIndex, int pageSize)
     where VM : class
 {
     DC.PageIndex = pageIndex;
     DC.PageSize  = pageSize;
     PreExecuteHandle(UiMethodEnum.QueryPaging);
     return(DSS.ExecuteReaderPaging <M, VM>(false, null));
 }
コード例 #12
0
ファイル: Form1.cs プロジェクト: willeforce/OpenDSS
 private void button1_Click(object sender, EventArgs e)
 {
     DSSObj = new DSS();
     if (DSSObj.Start(0))
     {
         MessageBox.Show("OpenDSS Started OK");
     }
     ;
 }
コード例 #13
0
 public int Create(M m)
 {
     DC.Action = ActionEnum.Insert;
     CreateMHandle(new List <M> {
         m
     });
     PreExecuteHandle(UiMethodEnum.Create);
     return(DSS.ExecuteNonQuery());
 }
コード例 #14
0
 public List <VM> Top <VM>(int count)
     where VM : class
 {
     DC.PageIndex = 0;
     DC.PageSize  = count;
     SelectMQ <M, VM>();
     PreExecuteHandle(UiMethodEnum.Top);
     return(DSS.ExecuteReaderMultiRow <VM>());
 }
コード例 #15
0
 public List <M> Top <M>(int count)
     where M : class
 {
     SelectMHandle <M>();
     DC.PageIndex = 0;
     DC.PageSize  = count;
     PreExecuteHandle(UiMethodEnum.Top);
     return(DSS.ExecuteReaderMultiRow <M>());
 }
コード例 #16
0
 public PagingResult <M> QueryPaging <M>(int pageIndex, int pageSize)
     where M : class
 {
     DC.PageIndex = pageIndex;
     DC.PageSize  = pageSize;
     SelectMHandle <M>();
     PreExecuteHandle(UiMethodEnum.QueryPaging);
     return(DSS.ExecuteReaderPaging <None, M>(false, null));
 }
コード例 #17
0
        public int Count <F>(Expression <Func <F> > propertyFunc)
        {
            DC.Action  = ActionEnum.Select;
            DC.Compare = CompareXEnum.None;
            DC.Func    = FuncEnum.Count;
            var dic = DC.XE.FuncTExpression(propertyFunc);

            DC.DPH.AddParameter(dic);
            PreExecuteHandle(UiMethodEnum.Count);
            return(DSS.ExecuteScalar <int>());
        }
コード例 #18
0
 public int CreateBatch(IEnumerable <M> mList)
 {
     DC.Action = ActionEnum.Insert;
     return(DC.BDH.StepProcessSync(mList, 100, list =>
     {
         DC.DPH.ResetParameter();
         CreateMHandle(list);
         PreExecuteHandle(UiMethodEnum.CreateBatch);
         return DSS.ExecuteNonQuery();
     }));
 }
コード例 #19
0
ファイル: Classter.cs プロジェクト: dzdota/StatisticAnalys
 static public void ChangeDSS(string typeD)
 {
     for (int i = 0; i < dSSstruct.Length; i++)
     {
         if (dSSstruct[i].Name == typeD)
         {
             dSS = dSSstruct[i].func;
             aby = dSSstruct[i].aby;
         }
     }
 }
コード例 #20
0
ファイル: QueryOneSyncImpl.cs プロジェクト: hpc-dal/HPC.DAL
 public T QueryOne <T>()
 {
     DC.Method = UiMethodEnum.QueryOne;
     if (typeof(T).IsSingleColumn())
     {
         return(DSS.ExecuteReaderSingleColumn <T>().FirstOrDefault());
     }
     else
     {
         return(DSS.ExecuteReaderMultiRow <T>().FirstOrDefault());
     }
 }
コード例 #21
0
        public void TestCatalogFileV7()
        {
            long[] ifltab = new long[250];
            DSS.ZOpen(ref ifltab, TestUtility.BasePath + "sample7.dss");
            int numberPaths = DSS.ZCatalogFile(ref ifltab, null, 1, null);

            Assert.IsTrue(numberPaths == 595);
            string fn = "test_sample7.dsscat.txt";

            numberPaths = DSS.ZCatalogFile(ref ifltab, fn, 1, null);
            Assert.IsTrue(numberPaths == 595);
        }
コード例 #22
0
 public List <T> SelectList <T>()
 {
     DC.Method = UiMethodEnum.QueryList;
     if (typeof(T).IsSingleColumn())
     {
         return(DSS.ExecuteReaderSingleColumn <T>());
     }
     else
     {
         return(DSS.ExecuteReaderMultiRow <T>());
     }
 }
コード例 #23
0
 public int Count()
 {
     DC.Action  = ActionEnum.Select;
     DC.Option  = OptionEnum.Column;
     DC.Compare = CompareXEnum.None;
     DC.Func    = FuncEnum.Count;
     DC.DPH.AddParameter(DC.DPH.SelectColumnDic(new List <DicParam> {
         DC.DPH.CountDic(default(Type), "*", string.Empty)
     }));
     PreExecuteHandle(UiMethodEnum.Count);
     return(DSS.ExecuteScalar <int>());
 }
コード例 #24
0
ファイル: SumSyncImpl.cs プロジェクト: hpc-dal/HPC.DAL
        public F?Sum <F>(Expression <Func <F?> > propertyFunc)
            where F : struct
        {
            DC.Action  = ActionEnum.Select;
            DC.Option  = OptionEnum.Column;
            DC.Compare = CompareXEnum.None;
            DC.Func    = FuncEnum.SumNullable;
            var dic = DC.XE.FuncTExpression(propertyFunc);

            DC.DPH.AddParameter(dic);
            PreExecuteHandle(UiMethodEnum.Sum);
            return(DSS.ExecuteScalar <F>());
        }
コード例 #25
0
 private void starDSS_Click(object sender, EventArgs e)
 {
     DSSobj = new DSS();
     if (!(DSSobj.Start(0)))
     {
         MessageBox.Show("DSS failed to start");
     }
     else
     {
         MessageBox.Show("DSS started sucessfully");
         DSSText = DSSobj.Text;
     }
 }
コード例 #26
0
        public bool IsExist()
        {
            DC.Action  = ActionEnum.Select;
            DC.Option  = OptionEnum.Column;
            DC.Compare = CompareXEnum.None;
            DC.Func    = FuncEnum.Count;
            DC.DPH.AddParameter(DC.DPH.SelectColumnDic(new List <DicParam> {
                DC.DPH.CountDic(typeof(M), "*")
            }));
            PreExecuteHandle(UiMethodEnum.IsExist);
            var count = DSS.ExecuteScalar <long>();

            return(count > 0);
        }
コード例 #27
0
 public Eletroposto(string FileName)
 {
     this.DSSobj = new DSS();
     if (!this.DSSobj.Start(0))
     {
         this.IsStarted = false;
     }
     else
     {
         this.IsStarted = true;
         this.FileName  = FileName;
         this.DSSText   = this.DSSobj.Text;
     }
 }
コード例 #28
0
        // inicializa serv DSS
        private void InicializaServDSS()
        {
            //Inicializa o servidor COM
            _DSSObj = new DSS();

            // Inicializa servidor COM
            _DSSObj.Start(0);

            // configuracoes gerais OpenDSS
            _DSSObj.AllowForms = _paramGerais._parGUI._allowForms;

            // interface texto
            _DSSText = _DSSObj.Text;
        }
コード例 #29
0
        void ExtractYMD(string date, int expectedY, int expectedM, int expectedD)
        {
            Console.WriteLine(date);
            int year = 0, month = 0, day = 0;
            int status = DSS.DateToYearMonthDay(date, ref year, ref month, ref day);

            Console.WriteLine(year);
            Console.WriteLine(month);
            Console.WriteLine(day);
            Assert.AreEqual(0, status);
            Assert.AreEqual(expectedY, year);
            Assert.AreEqual(expectedM, month);
            Assert.AreEqual(expectedD, day);
        }
コード例 #30
0
        public void TestCatalogV6Continued()
        {
            long[] ifltab = new long[250];
            DSS.ZOpen(ref ifltab, TestUtility.BasePath + "sample6_ras.dss");
            ZStructCatalogWrapper catStruct = DSS.zStructCatalogNew();
            int numberPaths = DSS.ZCatalog(ref ifltab, "/*/*/*Flow*/*/*/*/", ref catStruct, 1);

            Assert.IsTrue(numberPaths == 172);
            Assert.IsTrue(catStruct.PathNameList[0] == "/AMERICAN/FOLSOM/FLOW-RES IN/01JAN2006/1DAY/OBS/");
            Assert.IsTrue(catStruct.PathNameList[1] == "/AMERICAN/FOLSOM/FLOW-RES OUT/01JAN2006/1DAY/OBS/");
            Assert.IsTrue(catStruct.PathNameList[2] == "/EF RUSSIAN/COYOTE/FLOW-RES IN/01MAR2006/1HOUR/SMOOTH/");
            Assert.IsTrue(catStruct.PathNameList[3] == "/EF RUSSIAN/COYOTE/FLOW-RES OUT/01MAR2006/1HOUR//");
            Assert.IsTrue(catStruct.PathNameList[4] == "/FISHKILL CREEK/BEACON NY/FREQ-FLOW///USGS/");
            DSS.ZClose(ifltab);
        }
コード例 #31
0
 public List <T> SelectList <T>(Expression <Func <T> > columnMapFunc)
 {
     if (typeof(T).IsSingleColumn())
     {
         SingleColumnHandle(columnMapFunc);
         PreExecuteHandle(UiMethodEnum.QueryList);
         return(DSS.ExecuteReaderSingleColumn <T>());
     }
     else
     {
         SelectMHandle(columnMapFunc);
         PreExecuteHandle(UiMethodEnum.QueryList);
         return(DSS.ExecuteReaderMultiRow <T>());
     }
 }
コード例 #32
0
ファイル: DemoOpenDSSUI.cs プロジェクト: tshort/OpenDSS
 private void starDSS_Click( object sender, EventArgs e )
 {
     DSSobj = new DSS();
      if ( !( DSSobj.Start( 0 ) ) )
      {
     MessageBox.Show( "DSS failed to start" );
      }
      else
      {
     MessageBox.Show( "DSS started sucessfully" );
     DSSText = DSSobj.Text;
      }
 }
コード例 #33
0
 /// <summary>
 /// Constructor using a provided TSA client.
 /// </summary>
 /// <remarks>
 /// <para>
 /// When this constructor is used, the application configuration isn't used.
 /// </para>
 /// <para>
 /// The eHealth TSA requires the StsBinding as provided by the eH-I codeplex project.
 /// </para>
 /// </remarks>
 /// <example>
 /// <code language="C#">
 /// tsa = new TSA.DSS.TimeStampAuthorityClient(new StsBinding(), new EndpointAddress("https://wwwacc.ehealth.fgov.be/timestampauthority_1_5/timestampauthority"));
 /// tsa.Endpoint.Behaviors.Remove&lt;ClientCredentials&gt;();
 /// tsa.Endpoint.Behaviors.Add(new OptClientCredentials());
 /// tsa.ClientCredentials.ClientCertificate.Certificate = certificate;
 /// var tsProvider = new EHealthTimestampProvider(tsa);
 /// </code>
 /// </example>
 /// <param name="client">The pre-configured instance of the TSA client.</param>
 public EHealthTimestampProvider(DSS.TimeStampAuthorityClient client)
     : base(client)
 {
     Profile = "urn:ehealth:profiles:timestamping:2.1-cert";
 }
コード例 #34
0
 /// <summary>
 /// Constructor using a provided TSA client.
 /// </summary>
 /// <remarks>
 /// <para>
 /// When this constructor is used, the application configuration isn't used.
 /// </para>
 /// <para>
 /// The exact configuration requirements depend on the TSA and should be obtained from them.
 /// </para>
 /// </remarks>
 /// <example>
 /// <code language="C#">
 /// var tsa = new TSA.DSS.TimeStampAuthorityClient(new BasicHttpBinding(), new EndpointAddress("http://www.ca.com/TSA"));
 /// tsa.ClientCredentials.ClientCertificate.Certificate = certificate;
 /// var tsProvider = new DssTimestampProvider(tsa);
 /// </code>
 /// </example>
 /// <param name="client">The pre-configured instance of the TSA client.</param>
 public DssTimestampProvider(DSS.TimeStampAuthorityClient client)
 {
     this.client = client;
 }