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); }
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); })); } }
public List <M> SelectList <M>() where M : class { SelectMHandle <M>(); PreExecuteHandle(UiMethodEnum.QueryList); return(DSS.ExecuteReaderMultiRow <M>()); }
public List <M> Top(int count) { DC.PageIndex = 0; DC.PageSize = count; PreExecuteHandle(UiMethodEnum.Top); return(DSS.ExecuteReaderMultiRow <M>()); }
public List <VM> QueryList <VM>() where VM : class { SelectMQ <M, VM>(); PreExecuteHandle(UiMethodEnum.QueryList); return(DSS.ExecuteReaderMultiRow <VM>()); }
public PagingResult <M> QueryPaging(int pageIndex, int pageSize) { DC.PageIndex = pageIndex; DC.PageSize = pageSize; PreExecuteHandle(UiMethodEnum.QueryPaging); return(DSS.ExecuteReaderPaging <None, M>(false, null)); }
void AssertExtractJulian(string date, int expectedJulian) { int j = DSS.DateToJulian(date); Assert.IsTrue(DSS.IsTimeDefined(j, 0)); Assert.AreEqual(expectedJulian, j); }
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 ?) }
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>\")."); } }
private void button1_Click(object sender, EventArgs e) { DSSObj = new DSS(); if (DSSObj.Start(0)) { MessageBox.Show("OpenDSS Started OK"); }; }
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)); }
private void button1_Click(object sender, EventArgs e) { DSSObj = new DSS(); if (DSSObj.Start(0)) { MessageBox.Show("OpenDSS Started OK"); } ; }
public int Create(M m) { DC.Action = ActionEnum.Insert; CreateMHandle(new List <M> { m }); PreExecuteHandle(UiMethodEnum.Create); return(DSS.ExecuteNonQuery()); }
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>()); }
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>()); }
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)); }
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>()); }
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(); })); }
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; } } }
public T QueryOne <T>() { DC.Method = UiMethodEnum.QueryOne; if (typeof(T).IsSingleColumn()) { return(DSS.ExecuteReaderSingleColumn <T>().FirstOrDefault()); } else { return(DSS.ExecuteReaderMultiRow <T>().FirstOrDefault()); } }
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); }
public List <T> SelectList <T>() { DC.Method = UiMethodEnum.QueryList; if (typeof(T).IsSingleColumn()) { return(DSS.ExecuteReaderSingleColumn <T>()); } else { return(DSS.ExecuteReaderMultiRow <T>()); } }
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>()); }
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>()); }
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; } }
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); }
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; } }
// 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; }
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); }
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); }
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>()); } }
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; } }
/// <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<ClientCredentials>(); /// 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"; }
/// <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; }