public MainService(HwndSource source)
        {
            Source = source;

            var backlightService = new BacklightService();

            var powerService = new PowerService();

            powerService.LidSwitchStatusChanged += OnLidSwitchStatusChanged;
            powerService.PowerStatusChanged     += OnPowerChangeStatusChanged;

            var hotkeyservice = new HotkeyService();

            hotkeyservice.HotKeyTriggered += OnHotkeyTriggered;

            var idleService = new IdleService();

            idleService.IdleStateChanged += OnIdleStateChanged;

            ServiceManager.RegisterService <IBacklightService>(backlightService);
            ServiceManager.RegisterService <IPowerService>(powerService);
            ServiceManager.RegisterService <IHotkeyService>(hotkeyservice);
            ServiceManager.RegisterService <IIdleService>(idleService);


            foreach (var registeredService in ServiceManager.RegisteredServices)
            {
                registeredService.Owner = this;
                registeredService.Start();
                Logger.Write($"{registeredService.GetType().Name} started.");
            }

            backlightService.Mode = powerService.AcPowerPluggedIn ? BacklightMode.Ac : BacklightMode.Battery;
        }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PowerService service = new PowerService();
        dgvData.Style.Add("display", "none");
        if (Request.QueryString["UserGroupID"] != null)
        {
            DataSet ds = service.UserGroup_GetList("USER_STR,USERID_STR", "GROUP_ID=" + Request.QueryString["UserGroupID"].ToString());
            if (ds != null && ds.Tables.Count > 0)
            {
                hidType.Value = "2";
                hidUser.Value = ds.Tables[0].Rows[0]["USER_STR"].ToString();
                hidUserID.Value = ds.Tables[0].Rows[0]["USERID_STR"].ToString();
            }
        }
        else
        {
            string strWhere;
            if (Request.QueryString["GroupID"] != null)
                strWhere = " GroupID=" + Request.QueryString["GroupID"].ToString();
            else
                strWhere = " Power_Accounts.DEPT_ID=" + Request.QueryString["DEPT_ID"].ToString();
            dgvData.DataSource = service.Get_AccountList(strWhere);
            dgvData.DataBind();

        }
    }
Beispiel #3
0
        public JsonResult read_ModelTreeRoles(string RoleId, int moduleId = 0)
        {
            var model = new PowerService().MenuTree
                        .Where(a => a.ModuleId == moduleId);

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public void TestPowerService()
        {
            DateTime      dt      = new DateTime(2019, 12, 24, 13, 44, 33);
            IPowerService ps      = new PowerService();
            var           results = ps.GetTrades(dt);

            Assert.IsNotNull(results);
        }
Beispiel #5
0
        // GET: DashBoard/Manager


        #region 角色功能操作

        public ActionResult RoleFunc()
        {
            // new PowerService().GetUserMenuTree()
            var ss = new PowerService();
            var mm = ss.GetTree();

            ViewBag.Tree = mm;
            return(View());
        }
Beispiel #6
0
        public void TestGetTradesError()
        {
            TestSetupHelpers.SetErrorMode();

            var ps   = new PowerService();
            var date = new DateTime(2017, 12, 13);

            Assert.Throws <PowerServiceException>(() => ps.GetTrades(date));
        }
Beispiel #7
0
        public void Initialize()
        {
            unitOfWorkMock.Setup(x => x.GetRepository <Power>())
            .Returns(powerRepositoryMock.Object)
            .Verifiable("should call GetRepository<> of UnitOfWork !!!");

            Mapper.Initialize(option => { option.AddProfile(new DataMappingsProfile()); });

            powerService = new PowerService(unitOfWorkMock.Object);
        }
        public void Gettrades_method_returns_one_hundred_and_eighty_days_of_historical_data()
        {
            var powerService = new PowerService();

            for (int i = 0; i < 180; i++)
            {
                var checkDate     = _tradesDate.AddDays(i * -1);
                var currentTrades = powerService.GetTrades(_tradesDate);
            }
        }
Beispiel #9
0
 public PowerController()
 {
     _powerService    = new PowerService();
     _requirement     = new PermissionRequirement();
     _currUserAccount = _requirement.CurrUserAccount;
     //_currUserRole = _requirement.CurrUserRole;
     _currUserIp       = _requirement.CurrUserIp;
     _userService      = new UserService();
     _apiModuleService = new ApiModuleService();
     _moduleService    = new ModuleService();
 }
Beispiel #10
0
        public void TestGetTrades()
        {
            TestSetupHelpers.SetTestMode();

            var ps   = new PowerService();
            var date = new DateTime(2017, 12, 13);

            var trades = ps.GetTrades(date);

            Assert.AreEqual(2, trades.Count());
        }
Beispiel #11
0
        public PartialViewResult getMenuTree(string RoleId, int moduleId = 0)
        {
            ///测试
            ///
            var model = new PowerService().GetRolesModuleMenuTree(RoleId, moduleId);

            ///
            ///var model = new PowerService().MenuTree.Where(a => a.ModuleId == moduleId);

            return(PartialView("PP/_menuTree", model));
        }
Beispiel #12
0
 static void Main(string[] args)
 {
     using (PowerService ps = new PowerService())
     {
         ps.startService();
         Console.WriteLine("Service Running ...");
         while (Console.ReadKey().Key != ConsoleKey.Escape)
         {
         }
         ps.stopService();
     }
 }
 public ValuesController()
 {
     Credential = new UserCredentials
     {
         TenantId      = "470cec91-5a0e-47c7-87a9-2fcaf82d5d90",
         SecretId      = "82(t[}]Ee+y&+GvT8[tjh+;U9[|x;",
         ApplicationId = "66bec1b2-4684-4a08-9f2b-b67216d4695a",
         Password      = "******",
         UserName      = "******"
     };
     service = new PowerService();
 }
        public void GetTradesAsync_method_returns_data_in_under_a_minute()
        {
            var powerService = new PowerService();
            var maxRunTime   = new TimeSpan(0, 0, 60);
            var stopWatch    = new System.Diagnostics.Stopwatch();

            stopWatch.Start();
            var currentTrades = (powerService.GetTradesAsync(_tradesDate)).Result;

            stopWatch.Stop();
            var runTime = stopWatch.Elapsed;

            Assert.GreaterOrEqual(maxRunTime, runTime);
        }
Beispiel #15
0
        public void TestPowerPeriodAggregation()
        {
            DateTime      dt      = new DateTime(2019, 12, 24, 13, 44, 33);
            IPowerService ps      = new PowerService();
            var           results = ps.GetTrades(dt);
            double        totalP1 = 0;

            foreach (var trade in results)
            {
                totalP1 += trade.Periods[0].Volume;
            }
            Aggregate aggregate  = new Aggregate();
            var       aggresults = aggregate.GetAggregatedVolumes(results);

            Assert.AreEqual(totalP1, aggresults[1]);
        }
Beispiel #16
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            ILogger         logger          = new Logger();
            IConfigSettings configSettings  = new ConfigSettings();
            IPowerService   powerService    = new PowerService();
            IFileGenerator  fileGenerator   = new CSVGenerator(configSettings);
            IPositonService positionService = new PositonService(logger, powerService, fileGenerator);

            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new srvPowerPosition(logger,
                                     configSettings,
                                     positionService)
            };
            ServiceBase.Run(ServicesToRun);
        }
Beispiel #17
0
        public void TestEndToEndError()
        {
            TestSetupHelpers.SetErrorMode();
            var ps          = new PowerService();
            var ppfw        = new PowerPositionFetcherWriter();
            var runSettings = TestSetupHelpers.GetSaveFileRunSettings();
            var date        = new DateTime(2017, 12, 13, 23, 52, 00);

            var now = DateTime.Now;

            ppfw.FetchTradesAndWriteToFile(ps, runSettings, date, new PowerTradeAggregator(), new FilenameCreator(),
                                           new FileWriter(), new Local23PeriodMapper());

            var expected = File.ReadAllLines(runSettings.Path + @"PowerPosition_20171213_" + now.ToString("HHmm") + ".csv");

            Assert.IsTrue(expected.Length <= 0);
        }
Beispiel #18
0
        public static void Main(string[] args)
        {
            GrpcEnvironment.SetLogger(new ConsoleLogger());
            Server server = new Server
            {
                Services =
                {
                    AuthService.BindService(new SpotAuthService()),
                    RobotIdService.BindService(new SpotRobotIdService()),
                    DirectoryService.BindService(new SpotDirectoryService()),
                    TimeSyncService.BindService(new SpotTimeSyncService()),
                    EstopService.BindService(new SpotEstopService()),
                    LeaseService.BindService(new SpotLeaseService()),
                    PowerService.BindService(new SpotPowerService()),
                    RobotStateService.BindService(new SpotRobotStateService()),
                    RobotCommandService.BindService(new SpotRobotCommandService()),
                    ImageService.BindService(new SpotImageService())
                },
                Ports = { new ServerPort(
                              "0.0.0.0",
                              Port,
                              new SslServerCredentials(
                                  new List <KeyCertificatePair>()
                    {
                        new KeyCertificatePair(
                            File.ReadAllText(@"server.crt"),
                            File.ReadAllText(@"server.key")
                            )
                    },
                                  File.ReadAllText(@"ca.crt"),
                                  false
                                  )
                              ) },
            };

            server.Start();

            Console.WriteLine("Virtual spot 001 is active on port " + Port);
            Console.WriteLine("Press any key to shutdown");
            Console.ReadKey();

            server.ShutdownAsync().Wait();
        }
Beispiel #19
0
        /// <summary>
        /// Fetch trades and generate CSV file for captured trades
        /// </summary>
        /// <param name="pTradeDate"></param>
        public static void RunTrades(DateTime pTradeDate)
        {
            try
            {
                string       FilePath      = string.Format("{0}PowerPosition_{1}.csv", ConfigurationManager.AppSettings["csvFilePath"], pTradeDate.ToString("yyyyMMdd_HHmm"));
                PowerService _powerService = new PowerService();

                List <PowerTrade> powerTrades = new List <PowerTrade>();
                powerTrades.AddRange(_powerService.GetTrades(pTradeDate));

                PowerTrade result = PowerTrade.Create(pTradeDate, 24);// creating 24 power period for 24 hrs trades

                foreach (var item in powerTrades)
                {
                    foreach (PowerPeriod power in item.Periods)
                    {
                        var pow = result.Periods.FirstOrDefault(x => x.Period == power.Period);
                        if (pow != null)
                        {
                            pow.Volume += power.Volume;
                        }
                    }
                }


                //Sample code for verifying the total result
                int _counter = 1;
                foreach (PowerTrade p in powerTrades)
                {
                    ExportTradeToCSV(p, FilePath.Replace(".csv", string.Format("_{0}.csv", _counter)), false);
                    _counter++;
                }



                ExportTradeToCSV(result, FilePath, false);
            }
            catch (Exception ex)
            {
                EventLogger.WriteEntry(string.Format("Trade capturing failed at {0}.\n Failure Reason : {1}", pTradeDate.ToString(), ex.Message));
            }
        }
        public void GetTrades_method__returns_same_trades_for_same_query_datetime()
        {
            var powerService      = new PowerService();
            var currentTrades     = powerService.GetTrades(_tradesDate);
            var matchTrades       = GetTestTrades();
            var matchTradeIndex   = 0;
            var currentTradecount = 0;

            //Assume ordering is always the same then trades queried for same date should be the exact same and in the same order
            foreach (PowerTrade currentTrade in currentTrades)
            {
                var currentTradeText = JsonConvert.SerializeObject(currentTrade);
                var matchTradeText   = JsonConvert.SerializeObject(matchTrades[matchTradeIndex]);
                Assert.AreEqual(currentTradeText, matchTradeText);
                matchTradeIndex++;
                currentTradecount++;
            }
            //confirm count is the same
            Assert.AreEqual(currentTradecount, matchTrades.Count);
        }
        protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus)
        {
            LogWriter.Info("Power Mode change detected");
            PowerStatus status = SystemInformation.PowerStatus;

            if (powerStatus == PowerBroadcastStatus.PowerStatusChange)
            {
                if (status.PowerLineStatus == PowerLineStatus.Online)
                {
                    PowerService.HandlePlugIn();
                }
                if (status.PowerLineStatus == PowerLineStatus.Offline)
                {
                    PowerService.HandlePlugOut();
                }
            }

            else if (powerStatus.HasFlag(PowerBroadcastStatus.ResumeSuspend))
            {
                LogWriter.Info("Resume suspended coming back from sleep");
            }

            else if (powerStatus.HasFlag(PowerBroadcastStatus.ResumeAutomatic))
            {
                LogWriter.Info("Resume suspended coming back from sleep automatic");
                MonitorService.Initialize();
            }

            else if (powerStatus.HasFlag(PowerBroadcastStatus.QuerySuspend))
            {
                MonitorService.Stop("Sleep");

                LogWriter.Info("Going in sleeping mode");
                LogWriter.Info("Query suspended going to sleep");
                //MonitorService.Stop("Sleep");
            }

            return(false);
        }
        private static void InitializeVariablesBulk(bool isLoggedIn)
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Add(VariableConstants.MonitorStartTime, DateTime.Now.ToString());
            dictionary.Add(VariableConstants.LastLoggedInTime, DateTime.Now.ToString());
            dictionary.Add(VariableConstants.TotalLoggedInSeconds, "0");
            dictionary.Add(VariableConstants.IsLoggedIn, isLoggedIn ? "True" : "False");
            dictionary.Add(VariableConstants.CpuTotal, "0.0");
            dictionary.Add(VariableConstants.CpuCount, "0");
            dictionary.Add(VariableConstants.IsOnBattery, PowerService.IsOnBattery().ToString());
            dictionary.Add(VariableConstants.TotalBatteryTime, "0");
            if (PowerService.IsOnBattery())
            {
                dictionary.Add(VariableConstants.LastBatteryOnTime, DateTime.Now.ToString());
            }
            else
            {
                dictionary.Add(VariableConstants.LastBatteryOnTime, "0");
            }

            XmlHelper.UpdateSettingInBulk(dictionary);
        }
        protected override void OnStart(string[] args)
        {
            var fileFolder                = ConfigurationManager.AppSettings["fileFolder"];
            var fileName                  = ConfigurationManager.AppSettings["fileName"];
            var fileDateFormat            = ConfigurationManager.AppSettings["fileDateFormat"];
            var fileSuffix                = ConfigurationManager.AppSettings["fileSuffix"];
            var delimiter                 = ConfigurationManager.AppSettings["delimiter"];
            var columnOneName             = ConfigurationManager.AppSettings["columnOneName"];
            var columnTwoName             = ConfigurationManager.AppSettings["columnTwoName"];
            var dataDateFormat            = ConfigurationManager.AppSettings["dataDateFormat"];
            var minuteInterval            = Convert.ToInt32(ConfigurationManager.AppSettings["minuteInterval"]);
            var timeoutSeconds            = Convert.ToInt32(ConfigurationManager.AppSettings["powerServiceTimeOutSeconds"]);
            var backFillFromSetting       = ConfigurationManager.AppSettings["backFillFrom"];
            var backFillOverWriteExisting = Convert.ToBoolean(ConfigurationManager.AppSettings["backFillOverWriteExisting"]);

            var timeout      = new TimeSpan(0, 0, timeoutSeconds);
            var powerService = new PowerService();
            var backFillTo   = DateTime.Now;

            //Create the folder if it does not exist
            if (!Directory.Exists(fileFolder))
            {
                Directory.CreateDirectory(fileFolder);
            }

            if (!string.IsNullOrWhiteSpace(backFillFromSetting))
            {
                var backFillFrom = Convert.ToDateTime(backFillFromSetting);
                //If any files have been missed due to unexpected error must have the ability to backfill in any expected files that are missing
                //do this first
                _csvWriter.WriteCsvMinuteIntervalHistorical(fileFolder, fileName, fileDateFormat, fileSuffix, delimiter,
                                                            columnOneName, columnTwoName, dataDateFormat,
                                                            minuteInterval, powerService, timeout, backFillFrom, backFillTo, backFillOverWriteExisting);
            }
            _csvWriter.StartCsvMinuteInterval(fileFolder, fileName, fileDateFormat, fileSuffix, delimiter, columnOneName, columnTwoName, dataDateFormat,
                                              minuteInterval, powerService, timeout);
        }
Beispiel #24
0
        private async Task Save()
        {
            await GithubService.GetCommits();

            await TwitterService.GetTwitterFav();

            await GithubService.GetGitHubStars();

            await GithubService.GetGitHubRepo();

            await TwitterService.GetTwitterFollowers();

            await TwitterService.GetTwitterFollowing();

            await TwitterService.GetNumberOfTweets();

            await GithubService.GetGitHubFollowers();

            await GithubService.GetGitHubFollowing();

            await DevToService.GetDevTo();

            var r   = new Random();
            var rnd = r.Next(2);

            if (rnd == 1)
            {
                await PowerService.GetElec();
            }
            else
            {
                await PowerService.GetGas();
            }

            UriHelper.NavigateTo("/metrics", true);
        }
Beispiel #25
0
        public IEnumerable <HourlyVolume> GetPowerTrades()
        {
            PowerService powerService = new PowerService();
            var          powerTrades  = powerService.GetTrades(DateTime.Today);

            var hourlyVolume = powerTrades.SelectMany(x => x.Periods).Select(y => new HourlyVolume
            {
                Hour   = y.Period.ToString(),
                Volume = Decimal.Parse(y.Volume.ToString())
            }).ToList();


            var totalVolumesByPeriod =
                from volume in hourlyVolume
                group volume by volume.Hour into volumeGroup
                select new HourlyVolume
            {
                Hour   = volumeGroup.Key,
                Volume = Math.Round(volumeGroup.Sum(x => x.Volume), 0)
            };


            return(totalVolumesByPeriod);
        }
Beispiel #26
0
 public Reading()
 {
     _log.Info("Creating the access to the reading service");
     _powerService = new PowerService();
 }
Beispiel #27
0
        /// <summary>
        /// Aggregate Power period volumes and extract to CSV file
        /// </summary>
        /// <parameter name></parameter>
        /// <returns></returns>
        private void PwrPositionAggCalc()
        {
            PwrServiceLog.WriteEventLog("");
            PwrServiceLog.WriteEventLog("$$$$$$ Power Trades Period Volume Aggregation Operation Starts. $$$$$$");

            double dblVol1 = 0.0, dblVol2 = 0.0, dblVol3 = 0.0, dblVol4 = 0.0, dblVol5 = 0.0, dblVol6 = 0.0, dblVol7 = 0.0, dblVol8 = 0.0,
                   dblVol9 = 0.0, dblVol10 = 0.0, dblVol11 = 0.0, dblVol12 = 0.0, dblVol13 = 0.0, dblVol14 = 0.0, dblVol15 = 0.0, dblVol16 = 0.0,
                   dblVol17 = 0.0, dblVol18 = 0.0, dblVol19 = 0.0, dblVol20 = 0.0, dblVol21 = 0.0, dblVol22 = 0.0, dblVol23 = 0.0, dblVol24 = 0.0;

            int    intCounter = 0, intTradePeriod = 0;
            string strExtractYear, strExtractMonth, strExtractDate, strEroorMsg, strFileLocation, strFileName, strPath;

            // DataTable Object Declaration
            DataTable tblPwrVolume = null;

            try
            {
                // Retrieving extract date from Application Configuration File
                PwrServiceLog.WriteEventLog("Retrieving extract date from Application Configuration File ");
                strExtractYear  = System.Configuration.ConfigurationManager.AppSettings["ExtractRunYear"];
                strExtractMonth = System.Configuration.ConfigurationManager.AppSettings["ExtractRunMonth"];
                strExtractDate  = System.Configuration.ConfigurationManager.AppSettings["ExtractRunDate"];

                DateTime dtExtractDate = new DateTime(Int32.Parse(strExtractYear), Int32.Parse(strExtractMonth), Int32.Parse(strExtractDate));
                PwrServiceLog.WriteEventLog("Service running for extract Date: " + dtExtractDate.ToString());

                // initialize object for Power Service
                PowerService pwrService = new PowerService();
                PwrServiceLog.WriteEventLog("PowerService DLL Object initialized.");

                // Calling PowerService DLL Method GetTrades()
                PwrServiceLog.WriteEventLog("PowerService DLL Method GetTrades() Call - To retrieve all day-ahead trades and their period/volumes.");
                var TradesAll = pwrService.GetTrades(dtExtractDate);

                foreach (var tradeCount in TradesAll)
                {
                    // setting trade counter
                    intCounter += 1;
                    PwrServiceLog.WriteEventLog("****** Power Trade Number: " + intCounter + " - Period & Volume Retrieval Starts. ******");

                    foreach (var powerTrade in tradeCount.Periods)
                    {
                        PwrServiceLog.WriteEventLog("Power Trade " + intCounter + " ,Period: " + powerTrade.Period.ToString() + " ,Volume: " + powerTrade.Volume.ToString());
                        // Aggregation of Power Trade Volumes as per the period respectively.
                        intTradePeriod = powerTrade.Period;
                        switch (intTradePeriod)
                        {
                        case 1:
                            dblVol1 += powerTrade.Volume;
                            break;

                        case 2:
                            dblVol2 += powerTrade.Volume;
                            break;

                        case 3:
                            dblVol3 += powerTrade.Volume;
                            break;

                        case 4:
                            dblVol4 += powerTrade.Volume;
                            break;

                        case 5:
                            dblVol5 += powerTrade.Volume;
                            break;

                        case 6:
                            dblVol6 += powerTrade.Volume;
                            break;

                        case 7:
                            dblVol7 += powerTrade.Volume;
                            break;

                        case 8:
                            dblVol8 += powerTrade.Volume;
                            break;

                        case 9:
                            dblVol9 += powerTrade.Volume;
                            break;

                        case 10:
                            dblVol10 += powerTrade.Volume;
                            break;

                        case 11:
                            dblVol11 += powerTrade.Volume;
                            break;

                        case 12:
                            dblVol12 += powerTrade.Volume;
                            break;

                        case 13:
                            dblVol13 += powerTrade.Volume;
                            break;

                        case 14:
                            dblVol14 += powerTrade.Volume;
                            break;

                        case 15:
                            dblVol15 += powerTrade.Volume;
                            break;

                        case 16:
                            dblVol16 += powerTrade.Volume;
                            break;

                        case 17:
                            dblVol17 += powerTrade.Volume;
                            break;

                        case 18:
                            dblVol18 += powerTrade.Volume;
                            break;

                        case 19:
                            dblVol19 += powerTrade.Volume;
                            break;

                        case 20:
                            dblVol20 += powerTrade.Volume;
                            break;

                        case 21:
                            dblVol21 += powerTrade.Volume;
                            break;

                        case 22:
                            dblVol22 += powerTrade.Volume;
                            break;

                        case 23:
                            dblVol23 += powerTrade.Volume;
                            break;

                        case 24:
                            dblVol24 += powerTrade.Volume;
                            break;
                        }
                    }
                    PwrServiceLog.WriteEventLog("****** Power Trade Number: " + intCounter + " - All Period & Respective Volume Retrieval Completed. ******");
                }

                // if PowerService DLL Method GetTrades() returns 0 trades then throw an exception.
                if (intCounter == 0)
                {
                    strEroorMsg = "%%% ERROR: %%% - There is no day ahead power trades retrieved by calling PowerService DLL Method GetTrades(), Trade Count = " + intCounter;
                    PwrServiceLog.WriteEventLog(strEroorMsg);
                    throw new Exception("An generic error occurred in PwrPositionAggCalc function. Exception Message: " + strEroorMsg);
                }
                else
                {
                    PwrServiceLog.WriteEventLog("@@@@@@ Day Ahead Power Trade's - Period wise Volume Aggregation Completed, Total Trade Count: " + intCounter + " @@@@@@");
                }

                // DataTable Initialization to store Power Periods & Aggregated Volumes
                tblPwrVolume = new DataTable();
                // Column Name Addition in DataTable tblPwrVolume
                tblPwrVolume.Columns.Add("Local Time", typeof(string));
                tblPwrVolume.Columns.Add("Volume", typeof(Double));
                PwrServiceLog.WriteEventLog("Data Table Created to hold Power Trade's Power Periods and respective aggregated volumes.");

                // Adding Power Periods & Aggregated Volumes into DataTable
                tblPwrVolume.Rows.Add("23:00", dblVol1);
                tblPwrVolume.Rows.Add("00:00", dblVol2);
                tblPwrVolume.Rows.Add("01:00", dblVol3);
                tblPwrVolume.Rows.Add("02:00", dblVol4);
                tblPwrVolume.Rows.Add("03:00", dblVol5);
                tblPwrVolume.Rows.Add("04:00", dblVol6);
                tblPwrVolume.Rows.Add("05:00", dblVol7);
                tblPwrVolume.Rows.Add("06:00", dblVol8);
                tblPwrVolume.Rows.Add("07:00", dblVol9);
                tblPwrVolume.Rows.Add("08:00", dblVol10);
                tblPwrVolume.Rows.Add("09:00", dblVol11);
                tblPwrVolume.Rows.Add("10:00", dblVol12);
                tblPwrVolume.Rows.Add("11:00", dblVol13);
                tblPwrVolume.Rows.Add("12:00", dblVol14);
                tblPwrVolume.Rows.Add("13:00", dblVol15);
                tblPwrVolume.Rows.Add("14:00", dblVol16);
                tblPwrVolume.Rows.Add("15:00", dblVol17);
                tblPwrVolume.Rows.Add("16:00", dblVol18);
                tblPwrVolume.Rows.Add("17:00", dblVol19);
                tblPwrVolume.Rows.Add("18:00", dblVol20);
                tblPwrVolume.Rows.Add("19:00", dblVol21);
                tblPwrVolume.Rows.Add("20:00", dblVol22);
                tblPwrVolume.Rows.Add("21:00", dblVol23);
                tblPwrVolume.Rows.Add("22:00", dblVol24);

                PwrServiceLog.WriteEventLog("Data Table filled with Day Ahead Power Periods and aggregated volumes.");

                // CSV File location retrieve from Application Configuration file
                strFileLocation = System.Configuration.ConfigurationManager.AppSettings["CsvFileLocation"];
                PwrServiceLog.WriteEventLog("CSV File location retrieved from Application Configuration file as: " + strFileLocation);
                strFileName = "\\PowerPosition_" + DateTime.Now.ToString("yyyyMMdd_HHmm") + ".csv";

                strPath = strFileLocation + strFileName;
                // Function Call to Create CSV File
                CsvExtract(strPath, tblPwrVolume, true);

                // Release DataTable
                tblPwrVolume.Dispose();

                PwrServiceLog.WriteEventLog("$$$$$$ Power Trades Period Volume Aggregation Operation completed Successfully.. $$$$$$");
                PwrServiceLog.WriteEventLog("");
            }
            catch (Exception objEx)
            {
                PwrServiceLog.WriteEventLog("%%% EXCEPTION ERROR %%% - Exception occurred in PwrPositionAggCalc Method. Exception Message: " + objEx.Message.ToString());
                throw new Exception("An generic error occurred in PwrPositionAggCalc function. Exception Message:" + objEx.Message.ToString());
            }
            finally
            {
                // Release DataTable
                tblPwrVolume.Dispose();
            }
        }
 public void Explore()
 {
     var service = new PowerService();
     var trades = service.GetTrades(new DateTime(2015, 10, 5, 23, 0, 0));
 }
Beispiel #29
0
        public JsonResult read_menu([DataSourceRequest] DataSourceRequest request)
        {
            var model = new PowerService().GetTreeList();

            return(Json(model.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }
Beispiel #30
0
 public Task Concentrate([Remainder] string text) => PowerService.UsePower(Context, text);
Beispiel #31
0
 public Task CreatePower([Remainder] string text) => PowerService.CreatePower(text, Context);
Beispiel #32
0
 public PowerController(WeixiaoSysContext db, IMapper mapper, IOptions <RSASettings> setting) : base(db, mapper, setting)
 {
     bll = new PowerService(db);
 }