public void BindData()
        {
            List <Utility.Data.Store_Info> StoreInfo = GetStoreInfo();

            GridStore.DataSource = StoreInfo;
            GridStore.DataBind();
        }
示例#2
0
        /// <summary>
        /// GridStore Refresh
        /// </summary>
        protected void OnGridStoreRefresh(object sender, StoreRefreshDataEventArgs e)
        {
            try {
                var start = Int32.Parse(e.Parameters["start"]);
                var limit = Int32.Parse(e.Parameters["limit"]);
                var end   = start + limit;
                var data  = new List <object>(limit);

                var cacheKey = WebUtility.GetCacheKeyName(UserData, "bat-count-report");
                var records  = HttpRuntime.Cache[cacheKey] as List <IDValuePair <BatStaticInfo, List <BatStaticInfo> > >;
                if (records == null)
                {
                    records = AddDataToCache();
                }
                if (records != null && records.Count > 0)
                {
                    if (end > records.Count)
                    {
                        end = records.Count;
                    }
                    for (int i = start; i < end; i++)
                    {
                        if (records[i].ID == null)
                        {
                            continue;
                        }
                        data.Add(new {
                            ID        = i + 1,
                            LscID     = records[i].ID.LscID,
                            LscName   = records[i].ID.LscName,
                            Area1Name = records[i].ID.Area1Name,
                            Area2Name = records[i].ID.Area2Name,
                            Area3Name = records[i].ID.Area3Name,
                            StaName   = records[i].ID.StaName,
                            DevID     = records[i].ID.DevID,
                            DevName   = records[i].ID.DevName,
                            DevIndex  = records[i].ID.DevIndex,
                            FDCount   = records[i].Value.Count
                        });
                    }
                }

                e.Total = (records != null ? records.Count : 0);
                GridStore.DataSource = data;
                GridStore.DataBind();
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
示例#3
0
        /// <summary>
        /// Grid Store Refresh
        /// </summary>
        protected void OnGridStoreRefresh(object sender, StoreRefreshDataEventArgs e)
        {
            try {
                var start = Int32.Parse(e.Parameters["start"]);
                var limit = Int32.Parse(e.Parameters["limit"]);
                var end   = start + limit;
                var data  = new List <object>(limit);

                var cacheKey = WebUtility.GetCacheKeyName(UserData, "energy-records");
                var records  = HttpRuntime.Cache[cacheKey] as List <EnergyInfo>;
                if (records == null)
                {
                    records = AddDataToCache();
                }
                if (records != null && records.Count > 0)
                {
                    if (end > records.Count)
                    {
                        end = records.Count;
                    }
                    for (int i = start; i < end; i++)
                    {
                        data.Add(new {
                            ID          = i + 1,
                            LscName     = records[i].LscName,
                            Area1Name   = records[i].Area1Name,
                            Area2Name   = records[i].Area2Name,
                            Area3Name   = records[i].Area3Name,
                            StaName     = records[i].StaName,
                            StaTypeName = records[i].StaTypeName,
                            SumValue    = records[i].SumValue,
                            YoYValue    = records[i].YoYValue,
                            YoY         = String.Format("{0:P2}", records[i].YoYValue > 0 ? (records[i].SumValue - records[i].YoYValue) / records[i].YoYValue : 1),
                            QoQValue    = records[i].QoQValue,
                            QoQ         = String.Format("{0:P2}", records[i].QoQValue > 0 ? (records[i].SumValue - records[i].QoQValue) / records[i].QoQValue : 1)
                        });
                    }
                }

                e.Total = (records != null ? records.Count : 0);
                GridStore.DataSource = data;
                GridStore.DataBind();
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }