Пример #1
0
        public ActionResult UpdateSettings()
        {
            using (DataContext dataContext = new DataContext("dbOpenXDA"))
            {
                m_appModel.ConfigureView(Url.RequestContext, "UpdateSettings", ViewBag);

                try
                {
                    UserInfo userInfo = new UserInfo(System.Web.HttpContext.Current.User.Identity.Name);
                    userInfo.Initialize();
                    ViewBag.email        = userInfo.Email;
                    ViewBag.firstName    = userInfo.FirstName;
                    ViewBag.lastName     = userInfo.LastName;
                    ViewBag.username     = HttpContext.User.Identity.Name;
                    ViewBag.usersid      = UserInfo.UserNameToSID(ViewBag.username);
                    ViewBag.account      = dataContext.Table <ConfirmableUserAccount>().QueryRecordWhere("Name = {0}", ViewBag.usersid);
                    ViewBag.isRegistered = ViewBag.account != null;
                }
                catch
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.Forbidden, "This may be due to an error determining your user identity."));
                }

                return(View());
            }
        }
Пример #2
0
        public ActionResult CycleDataSOEPointView()
        {
            m_dbModel.ConfigureView <Model.CycleDataSOEPointView>(Url.RequestContext, "CycleDataSOEPointView", ViewBag);

            ViewBag.VoltageStatePath        = "~/Images/UpDownState/Box Set 3/";
            ViewBag.BreakerElementPath      = "~/Images/PointCode/BreakerElement/";
            ViewBag.StatusElementPath       = "~/Images/PointCode/StatusElement/";
            ViewBag.SimpleVoltageStatePath  = "~/Images/UpDownState/Summary Set/";
            ViewBag.SimpleBreakerStatusPath = "~/Images/PointCode/Summary/";

            return(View());
        }
Пример #3
0
        public ActionResult Home()
        {
            m_appModel.ConfigureView(Url.RequestContext, "Home", ViewBag);
            int groupID = m_dataContext.Connection.ExecuteScalar <int?>("Select ID From ValueListGroup Where Name = 'timeWindows'") ?? 0;

            //DataTable incidentCountTable = m_dbContext.Connection.RetrieveData("SELECT IncidentType, COUNT(*) AS IncidentCount FROM IncidentEventCycleDataView GROUP BY IncidentType");

            ViewBag.timeWindows = m_dataContext.Table <ValueList>().QueryRecords(restriction: new RecordRestriction("GroupID = {0}", groupID)).ToArray();
            //ViewBag.SOESAD = incidentCountTable.AsEnumerable().Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum();
            //ViewBag.FaultsAT = incidentCountTable.Select("IncidentType IN ('LG', 'LLG', 'LLLG', 'LL', 'LLL')").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum();
            //ViewBag.FaultsLGAT = incidentCountTable.Select("IncidentType IN ('LG', 'LLG', 'LLLG')").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum();
            //ViewBag.FaultsLLAT = incidentCountTable.Select("IncidentType = 'LL'").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum();
            //ViewBag.FaultsLLLAT = incidentCountTable.Select("IncidentType = 'LLL'").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum();
            //ViewBag.VoltsAT = incidentCountTable.Select("IncidentType LIKE '%SAG' OR IncidentType LIKE '%SWELL'").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum();
            //ViewBag.VoltSAGAT = incidentCountTable.Select("IncidentType LIKE '%SAG'").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum();
            //ViewBag.VoltSWELLAT = incidentCountTable.Select("IncidentType LIKE '%SWELL'").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum();
            //ViewBag.OtherAT = incidentCountTable.Select("IncidentType = 'OTHER'").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum();

            //List<int> counts = new List<int>();
            //List<int> faults = new List<int>();
            //List<int> faultsLG = new List<int>();
            //List<int> faultsLL = new List<int>();
            //List<int> faultsLLL = new List<int>();
            //List<int> volts = new List<int>();
            //List<int> others = new List<int>();
            //List<int> voltsags = new List<int>();
            //List<int> voltswells = new List<int>();

            //foreach (ValueList vl in ViewBag.timeWindows)
            //{
            //    incidentCountTable = m_dbContext.Connection.RetrieveData("SELECT IncidentType, COUNT(*) AS IncidentCount FROM IncidentEventCycleDataView WHERE DATEDIFF(day, StartTime, GETDATE()) <= {0} GROUP BY IncidentType", vl.Value);
            //    counts.Add(incidentCountTable.AsEnumerable().Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum());
            //    faults.Add(incidentCountTable.Select("IncidentType IN ('LG', 'LLG', 'LLLG', 'LL', 'LLL')").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum());
            //    faultsLG.Add(incidentCountTable.Select("IncidentType IN ('LG', 'LLG', 'LLLG')").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum());
            //    faultsLL.Add(incidentCountTable.Select("IncidentType = 'LL'").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum());
            //    faultsLLL.Add(incidentCountTable.Select("IncidentType = 'LLL'").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum());
            //    volts.Add(incidentCountTable.Select("IncidentType IN ('SAG', 'SWELL')").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum());
            //    voltsags.Add(incidentCountTable.Select("IncidentType = 'SAG'").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum());
            //    voltswells.Add(incidentCountTable.Select("IncidentType = 'SWELL'").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum());
            //    others.Add(incidentCountTable.Select("IncidentType = 'OTHER'").Select(row => row.ConvertField<int>("IncidentCount")).DefaultIfEmpty(0).Sum());
            //}


            //ViewBag.counts = counts;
            //ViewBag.faults = faults;
            //ViewBag.faultsLG = faultsLG;
            //ViewBag.faultsLL = faultsLL;
            //ViewBag.faultsLLL = faultsLLL;
            //ViewBag.volts = volts;
            //ViewBag.others = others;
            //ViewBag.voltsags = voltsags;
            //ViewBag.voltswells = voltswells;

            return(View());
        }
Пример #4
0
        public ActionResult Home()
        {
            using (DataContext dataContext = new DataContext("systemSettings")) {
                m_appModel.ConfigureView(Url.RequestContext, "Home", ViewBag);

                try
                {
                    ViewBag.username = System.Web.HttpContext.Current.User.Identity.Name;
                    ViewBag.usersid  = UserInfo.UserNameToSID(ViewBag.username);

                    if (dataContext.Connection.ExecuteScalar <int>("SELECT COUNT(*) FROM UserAccount WHERE Name = {0}", ViewBag.usersid) == 0)
                    {
                        ViewBag.username = "******";
                        ViewBag.usersid  = "External";
                    }
                }
                catch (Exception ex)
                {
                    ViewBag.username = "";
                }

                return(View());
            }
        }
Пример #5
0
 public ActionResult Home()
 {
     m_appModel.ConfigureView(Url.RequestContext, "System.Home", ViewBag);
     return(View());
 }
Пример #6
0
 public ActionResult Users()
 {
     m_appModel.ConfigureView(Url.RequestContext, "Security.Users", ViewBag);
     m_dataContext.ConfigureView <UserAccount, SecurityHub>(Url.RequestContext, ViewBag);
     return(View());
 }
Пример #7
0
 public ActionResult Home()
 {
     m_appModel.ConfigureView(Url.RequestContext, "Settings.Home", ViewBag);
     return View();
 }