Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
        private void tsbView_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
        {
            D07F2011 frm = new D07F2011();
            int      i   = GridStore.View.FocusedRowData.RowHandle.Value;

            frm.VoucherID = L3ConvertType.L3String(GridStore.GetFocusedRowCellValue(COL_VoucherID));
            frm.FormState = Lemon3.EnumFormState.FormView;
            frm.GridVoucherInventory.View.IsEnabled = false;
            frm.lkeSupplier.IsReadOnly   = true;
            frm.deVoucherDate.IsReadOnly = true;
            frm.chePaid.IsReadOnly       = true;
            frm.WindowStartupLocation    = System.Windows.WindowStartupLocation.CenterScreen;
            frm.ShowDialog();
            LoadTDBGrid();
            GridStore.FocusRowHandle(i);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 4
0
        private void tsbDelete_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
        {
            string        VoucherID = GridStore.GetFocusedRowCellValue(COL_VoucherID).ToString();
            int           i         = GridStore.View.FocusedRowData.RowHandle.Value;
            StringBuilder sSQL      = new StringBuilder();

            sSQL.AppendLine(BLStore.SQLDeleteD07T2011(VoucherID));
            sSQL.AppendLine(BLStore.SQLDeleteD07T2010(VoucherID));
            try
            {
                L3SQLServer.ExecuteSQL(sSQL.ToString());
            }
            catch (Exception)
            {
                MessageBox.Show("Lỗi!");
            }
            LoadTDBGrid();
            GridStore.FocusRowHandle(i);
        }
Exemplo n.º 5
0
        public void Update()
        {
            var currentWorldId = ZetaDia.Globals.WorldId;

            if (currentWorldId <= 0)
            {
                return;
            }

            if (_currentWorld != currentWorldId)
            {
                if (!ZetaDia.IsInGame)
                {
                    s_logger.Debug($"[{nameof(Update)}] Left Game...");
                    Reset();
                    return;
                }
                if (ZetaDia.Globals.IsLoadingWorld)
                {
                    s_logger.Debug($"[{nameof(Update)}] World loading...");
                    return;
                }

                s_logger.Information($"[{nameof(Update)}] World has changed from {_currentWorld} to {currentWorldId}.");
                _currentWorld = currentWorldId;
                Reset();
            }

            var          addedScenes = new List <WorldScene>();
            List <Scene> newScenes;

            try
            {
                newScenes = ZetaDia.Scenes
                            .Where(s => s.IsAlmostValid() && !CurrentWorldSceneIds.Contains(s.GetSceneNameString())).ToList();
            }
            catch (NullReferenceException)
            {
                return;
            }
            catch (PartialReadWriteException)
            {
                return;
            }

            SNOWorld worldId = 0;

            foreach (var scene in newScenes)
            {
                try
                {
                    if (!scene.IsAlmostValid())
                    {
                        continue;
                    }

                    var sceneHashName = scene.GetSceneNameString();
                    worldId = scene.Mesh.WorldId;

                    var subScene = scene.Mesh.SubScene;
                    if (scene.IsAlmostValid() && scene.Mesh.ParentSceneId <= 0 && worldId == currentWorldId)
                    {
                        if (scene.Mesh.Zone.GridSquares.Length <= 1 && (subScene != null && !subScene.HasGridSquares()))
                        {
                            continue;
                        }

                        var adventurerScene = new WorldScene(scene, ExplorationData.ExplorationNodeBoxSize,
                                                             ExplorationData.ExplorationNodeBoxTolerance);
                        if (adventurerScene.Cells.Count > 0)
                        {
                            CurrentWorldScenes.Add(adventurerScene);
                            addedScenes.Add(adventurerScene);
                        }
                    }
                    CurrentWorldSceneIds.Add(sceneHashName);
                }
                catch (NullReferenceException)
                {
                }
            }

            if (addedScenes.Count <= 0)
            {
                return;
            }

            s_logger.Information($"[{nameof(Update)}] Found {addedScenes.Count} new scenes.");
            var sceneData = CreateSceneData(addedScenes, worldId);

            foreach (var grid in GridStore.GetCurrentGrids())
            {
                grid.Update(sceneData);
            }

            if (CurrentScene != null)
            {
                foreach (var scene in CurrentWorldScenes.Where(s => !s.HasPlayerConnection))
                {
                    if (scene == CurrentScene || CurrentScene.IsConnected(scene))
                    {
                        scene.HasPlayerConnection = true;
                    }
                }
            }

            ScenesAdded?.Invoke(addedScenes);
            s_logger.Information($"[{nameof(Update)}] Updates Finished.");
        }
Exemplo n.º 6
0
        public void Update()
        {
            var currentWorldId = ZetaDia.Globals.WorldId;

            if (currentWorldId <= 0)
            {
                return;
            }

            if (_currentWorld != currentWorldId)
            {
                //if (GameData.MenuWorldSnoIds.Contains(ZetaDia.Globals.WorldSnoId))
                //{
                //    Core.Logger.Debug("[SceneStorage] Left Game....");
                //    Reset();
                //    return;
                //}
                //if (ZetaDia.Globals.IsLoadingWorld)
                //{
                //    Core.Logger.Debug("[SceneStorage] World loading....");
                //    return;
                //}

                Core.Logger.Debug("[SceneStorage] World has changed from {0} to {1}", _currentWorld, currentWorldId);
                _currentWorld = currentWorldId;
                Reset();
            }

            var          addedScenes = new List <WorldScene>();
            List <Scene> newScenes;

            try
            {
                newScenes = ZetaDia.Scenes.Where(s => s.IsAlmostValid() && !CurrentWorldSceneIds.Contains(s.GetSceneNameString())).ToList();
            }
            catch (NullReferenceException)
            {
                return;
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("ReadProcessMemory"))
                {
                    return;
                }
                throw;
            }

            var worldId = 0;

            foreach (var scene in newScenes)
            {
                try
                {
                    if (!scene.IsAlmostValid())
                    {
                        continue;
                    }

                    var sceneHashName = scene.GetSceneNameString();
                    worldId = scene.Mesh.WorldId;

                    Scene subScene = scene.Mesh.SubScene;
                    if (scene.IsAlmostValid() && scene.Mesh.ParentSceneId <= 0 && worldId == currentWorldId)
                    {
                        if (scene.Mesh.Zone.GridSquares.Length <= 1 && (subScene != null && !subScene.HasGridSquares()))
                        {
                            continue;
                        }

                        var adventurerScene = new WorldScene(scene, ExplorationData.ExplorationNodeBoxSize,
                                                             ExplorationData.ExplorationNodeBoxTolerance);
                        if (adventurerScene.Cells.Count > 0)
                        {
                            CurrentWorldScenes.Add(adventurerScene);
                            addedScenes.Add(adventurerScene);
                        }
                    }
                    CurrentWorldSceneIds.Add(sceneHashName);
                }
                catch (NullReferenceException)
                {
                }
            }

            if (addedScenes.Count > 0)
            {
                Core.Logger.Debug("[ScenesStorage] Found {0} new scenes", addedScenes.Count);
                var sceneData = CreateSceneData(addedScenes, worldId);
                foreach (var grid in GridStore.GetCurrentGrids())
                {
                    grid.Update(sceneData);
                }
                ScenesAdded?.Invoke(addedScenes);
                Core.Logger.Debug("[ScenesStorage] Updates Finished", addedScenes.Count);
            }
        }
Exemplo n.º 7
0
 private void L3Page_Loaded(object sender, RoutedEventArgs e)
 {
     GridStore.InputNumber288("n0", false, false, COL_Amount);
     GridStore.SetDefaultFilterChangeGrid();
     LoadTDBGrid();
 }