コード例 #1
0
    public void SaveComponent <T1, T2>(GameObject gameObject, T2 component, string sceneName)
        where T1 : ISave <T2>
    {
        if (gameObject.CheckEmpty())
        {
            return;
        }
        if (component.CheckEmpty())
        {
            return;
        }

        sceneName = string.IsNullOrEmpty(sceneName) == true?SceneManager.GetActiveScene().name : sceneName;

        string ISaveName = typeof(T1).Name;
        T1     ISave     = (T1)ToolUtility.CreateHelperInstance(ISaveName, assemblyNames);
        string value;

        try
        {
            value = ISave.Save(component);
        }
        catch (Exception ex)
        {
            Debug.LogError(ex);
            return;
        }
        SaveComponent <T1, T2>(gameObject.name, value, sceneName);
    }
コード例 #2
0
        /// <summary>
        /// Load the Application, D8TopLevel, and make a call to its own get text.
        /// </summary>
        /// <param name="eTextEvent"></param>
        /// <param name="pMapProdInfo"></param>
        /// <returns></returns>
        protected override string GetText(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo)
        {
            if (App == null)
            {
                App = DesignerUtility.GetApplication();
            }
            if (App == null)
            {
                ToolUtility.LogError(_ProgID + ": Could not load Application Extension");
                return(_defaultDisplay);
            }

            ID8TopLevel topLevel = App.FindExtensionByName("DesignerTopLevel") as ID8TopLevel;

            if (topLevel == null)
            {
                return(_defaultDisplay);
            }

            string DisplayString = GetDxText(eTextEvent, pMapProdInfo, topLevel);

            if (string.IsNullOrEmpty(DisplayString))
            {
                return(_defaultDisplay);
            }
            else
            {
                return(DisplayString);
            }
        }
コード例 #3
0
 // 获取需要更新的资源路径
 private void GetUpdateResPaths(ResListInfo onlineResListInfo, ResListInfo curResListInfo, ref List <SingleResInfo> updateList)
 {
     if (curResListInfo != null)
     {
         if (!onlineResListInfo.Ver.Equals(curResListInfo.Ver))
         {
             // TODO  需要测试一下Linq性能
             updateList = onlineResListInfo.Info.Where(onlineData => !curResListInfo.Info.Where(curData => onlineData.Md5 == curData.Md5 &&
                                                                                                onlineData.Path == curData.Path && onlineData.Status == curData.Status && onlineData.Size == curData.Size).Any()).ToList();
         }
         else
         {
             foreach (var item in onlineResListInfo.Info) // TODO 检测文件是否需要更新的计算方式 感觉不是很好(后续有更好的方案再改)
             {
                 stringBuilder.Clear();
                 stringBuilder.Append(PathUtility.Instance.GetPersistentDataPath());
                 stringBuilder.Append("/");
                 stringBuilder.Append(item.Path);
                 string localFileMd5 = ToolUtility.GetFileMD5Str(stringBuilder.ToString());
                 if (localFileMd5 != item.Md5)
                 {
                     updateList.Add(item);
                 }
             }
         }
     }
     else
     {
         updateList.AddRange(onlineResListInfo.Info);
     }
 }
コード例 #4
0
    public ISave <T2> CreateISave <T1, T2>()
        where T1 : ISave <T2>
    {
        string ISaveName = typeof(T1).Name;
        T1     ISave     = (T1)ToolUtility.CreateHelperInstance(ISaveName, assemblyNames);

        return(ISave);
    }
コード例 #5
0
        public string GetConstructionNotes(ID8TopLevel topLevel, IEnvelope FilterExtent)
        {
            //Parse the Design Tree
            ID8List TopList = topLevel as ID8List;

            TopList.Reset();

            IMMPxApplication PxApp = null;

            try
            {
                PxApp = DesignerUtility.GetPxApplication();
            }
            catch (Exception ex)
            {
                ToolUtility.LogError(_ProgID + ": Could obtain a Px Application reference.", ex);
                return(_defaultDisplay);
            }

            try
            {
                TopList.Reset();
                ID8List WorkRequest = TopList.Next(false) as ID8List;
                if (WorkRequest == null)
                {
                    return("");
                }

                //WorkRequest.Reset();
                //ID8List Design = WorkRequest.Next(false) as ID8List;

                //Get the Design XML
                IMMPersistentXML WrXml = WorkRequest as IMMPersistentXML;

                string result = Utility.LabellingUtility.GetConstructionNotes(PxApp, WrXml, FilterExtent);
                if (string.IsNullOrEmpty(result))
                {
                    return(_NoFeatures);
                }
                else
                {
                    return(result);
                }
            }
            catch (ApplicationException apex)
            {
                //ignore exception, no features
                return(_NoFeatures);
            }
            catch (Exception ex)
            {
                ToolUtility.LogError(_ProgID + ": Error Retrieving Construction Notes", ex);
                return(_defaultDisplay);
            }
        }
コード例 #6
0
 public static void ContextMenu_Transform_SelectTileSystem()
 {
     if (Selection.gameObjects.Length == 1)
     {
         var tileSystem = ToolUtility.FindParentTileSystem(Selection.activeTransform);
         if (tileSystem != null)
         {
             Selection.objects = new Object[] { tileSystem.gameObject };
         }
     }
 }
コード例 #7
0
    static void Menu_RTS_Brushes_RescanBrushes()
    {
        // Refresh asset database.
        AssetDatabase.Refresh();

        // Automatically detect new brushes.
        BrushDatabase.Instance.Rescan(RefreshPreviews.ClearCache);

        // Repaint windows that may have been affected.
        ToolUtility.RepaintPaletteWindows();
        DesignerWindow.RepaintWindow();
    }
コード例 #8
0
    void OnGUI_UpgradeBrushes()
    {
        RotorzEditorGUI.Title("Step 2: Upgrade Brushes");

        if (RtsBrushDatabaseWrapper.Instance.records.Count == 0)
        {
            OnGUI_UpgradeNoBrushes();
            return;
        }

        if (_brushUpgrader == null)
        {
            _brushUpgrader = new RtsBrushUpgradeUtility();
        }

        GUILayout.Label("Existing brushes will not be removed automatically.", _boldWrapStyle);
        GUILayout.Space(5);
        GUILayout.Label("An asset will be generated that maps existing brushes to their upgraded counterparts which is used when upgrading tile systems. If map asset is deleted this wizard restart.", EditorStyles.wordWrappedLabel);
        GUILayout.Space(5);
        EditorGUILayout.HelpBox("Do not remove older version of extension nor existing brushes folder 'Assets/TilePrefabs' until you have upgraded all of your tile systems.", MessageType.Warning, true);

        GUILayout.Space(5);
        GUILayout.BeginHorizontal();
        GUILayout.Space(15);
        GUILayout.BeginVertical();
        _brushUpgrader.useProceduralTilesets = GUILayout.Toggle(_brushUpgrader.useProceduralTilesets, "Use procedural tilesets / atlas brushes");
        _brushUpgrader.useNewAssets          = GUILayout.Toggle(_brushUpgrader.useNewAssets, "Use newer smooth platform brushes.");
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        GUILayout.Space(5);
        GUILayout.Label("Please click 'Upgrade Brushes' to proceed.", EditorStyles.wordWrappedLabel);

        GUILayout.Space(10);

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Go Back", GUILayout.Height(24)))
        {
            _hasWelcomed = false;
            GUIUtility.ExitGUI();
        }

        if (GUILayout.Button("Upgrade Brushes", GUILayout.Height(24)))
        {
            _brushUpgrader.UpgradeBrushes();

            ToolUtility.RepaintPaletteWindows();
            GUIUtility.ExitGUI();
        }

        GUILayout.EndHorizontal();
    }
コード例 #9
0
ファイル: CT_TAT_Query.aspx.cs プロジェクト: wra222/testgit
    protected void btnExport_Click(object sender, EventArgs e)
    {
        ToolUtility tu = new ToolUtility();

        if (gvResult.HeaderRow != null && gvResult.HeaderRow.Cells.Count > 0)
            tu.ExportExcel(gvResult, "CT_TAT", Page);
        else
        {
            string str = "   alert( 'Please select one record! ' );";
            string script = "<script type='text/javascript' language='javascript'>" + str + "</script>";
            ClientScript.RegisterStartupScript(GetType(), "", script);

        }
    }
コード例 #10
0
        public async Task TorSharpToolFetcher_CheckForUpdates(ToolDownloadStrategy strategy)
        {
            using (var te = TestEnvironment.Initialize(_output))
            {
                // Arrange
                var settings = te.BuildSettings();
                settings.ToolDownloadStrategy = strategy;

                using (var httpClientHandler = new HttpClientHandler())
                    using (var loggingHandler = new LoggingHandler(_output)
                    {
                        InnerHandler = httpClientHandler
                    })
                        using (var httpClient = new HttpClient(loggingHandler))
                            using (var proxy = new TorSharpProxy(settings))
                            {
                                _output.WriteLine(settings);
                                var fetcher = _httpFixture.GetTorSharpToolFetcher(settings, httpClient);
                                var initial = await fetcher.CheckForUpdatesAsync();

                                await fetcher.FetchAsync(initial);

                                var prefix         = ToolUtility.GetPrivoxyToolSettings(settings).Prefix;
                                var extension      = Path.GetExtension(initial.Privoxy.DestinationPath);
                                var fakeOldPrivoxy = Path.Combine(settings.ZippedToolsDirectory, $"{prefix}0.0.1{extension}");
                                File.Move(initial.Privoxy.DestinationPath, fakeOldPrivoxy);

                                // Act
                                var newerVersion = await fetcher.CheckForUpdatesAsync();

                                await fetcher.FetchAsync(newerVersion);

                                var upToDate = await fetcher.CheckForUpdatesAsync();

                                // Assert
                                Assert.True(initial.HasUpdate);
                                Assert.Equal(ToolUpdateStatus.NoLocalVersion, initial.Privoxy.Status);
                                Assert.Equal(ToolUpdateStatus.NoLocalVersion, initial.Tor.Status);

                                Assert.True(newerVersion.HasUpdate);
                                Assert.Equal(ToolUpdateStatus.NewerVersionAvailable, newerVersion.Privoxy.Status);
                                Assert.Equal(ToolUpdateStatus.NoUpdateAvailable, newerVersion.Tor.Status);

                                Assert.False(upToDate.HasUpdate);
                                Assert.Equal(ToolUpdateStatus.NoUpdateAvailable, upToDate.Privoxy.Status);
                                Assert.Equal(ToolUpdateStatus.NoUpdateAvailable, upToDate.Tor.Status);
                            }
            }
        }
コード例 #11
0
        public static void ContextMenu_TileSystem_ToggleLock(MenuCommand command)
        {
            var tileSystem = command.context as TileSystem;

            if (tileSystem != null)
            {
                tileSystem.Locked = !tileSystem.Locked;
                ToolUtility.RepaintScenePalette();

                // If a tool is selected then we need to repaint all scene views since the
                // visual status of the tool may have just changed!
                if (ToolManager.Instance.CurrentTool != null)
                {
                    SceneView.RepaintAll();
                }
            }
        }
コード例 #12
0
ファイル: BaseATE.cs プロジェクト: RiverTaig/CU_ATE
        string IMMAutoTextSource.TextString(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo)
        {
            string sReturnVal = _defaultDisplay;

            try
            {
                sReturnVal = GetText(eTextEvent, pMapProdInfo);
            }
            catch (Exception ex)
            {
                ToolUtility.LogError("Error getting autotext", ex);
            }

            if (string.IsNullOrEmpty(sReturnVal))
            {
                return(_NullString);
            }
            else
            {
                return(sReturnVal);
            }
        }
コード例 #13
0
        public async Task TorSharpToolFetcher_UseExistingTools()
        {
            using (var te = TestEnvironment.Initialize(_output))
            {
                // Arrange
                var settings = te.BuildSettings();
                settings.ReloadTools      = true;
                settings.UseExistingTools = true;

                using (var httpClientHandler = new HttpClientHandler())
                    using (var requestCountHandler = new RequestCountHandler {
                        InnerHandler = httpClientHandler
                    })
                        using (var loggingHandler = new LoggingHandler(_output)
                        {
                            InnerHandler = requestCountHandler
                        })
                            using (var httpClient = new HttpClient(requestCountHandler))
                                using (var proxy = new TorSharpProxy(settings))
                                {
                                    _output.WriteLine(settings);
                                    var fetcherA = _httpFixture.GetTorSharpToolFetcher(settings, httpClient);
                                    await fetcherA.FetchAsync();

                                    var requestCount = requestCountHandler.RequestCount;

                                    // Act
                                    var fetcherB = _httpFixture.GetTorSharpToolFetcher(settings, httpClient);
                                    await fetcherB.FetchAsync();

                                    // Assert
                                    Assert.True(requestCount > 0, "The should be at least one request.");
                                    Assert.Equal(requestCount, requestCountHandler.RequestCount);
                                    Assert.NotNull(ToolUtility.GetLatestToolOrNull(settings, ToolUtility.GetPrivoxyToolSettings(settings)));
                                    Assert.NotNull(ToolUtility.GetLatestToolOrNull(settings, ToolUtility.GetTorToolSettings(settings)));
                                }
            }
        }
コード例 #14
0
ファイル: UPH.aspx.cs プロジェクト: wra222/testgit
    protected void Button7_Click(object sender, EventArgs e)
    {
        if (GridView1.Rows.Count > 0)
        {
            ToolUtility tu = new ToolUtility();

            tu.ExportExcel(GridView1, "Sheet1", this.Page);
        }
        else
        {
            Response.Write("<script>alert('请查询后再进行导出!')</script>");
            Response.Flush();
        }
        //ToolUtility tu = new ToolUtility();

        //  tu.ExportExcel(GridView1, "Sheet1", this.Page);
                
    }//将数据导出Excel
コード例 #15
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     ToolUtility tu = new ToolUtility();
     tu.ExportExcel(gvQuery, "PCBTestDefect", Page);
 }
コード例 #16
0
        protected override void OnApplyChanges()
        {
            // Do not proceed if no atlas texture was selected.
            if (this.inputNewAutotileArtwork == null)
            {
                EditorUtility.DisplayDialog(
                    TileLang.ParticularText("Error", "Autotile artwork was not specified"),
                    TileLang.Text("Please select artwork for autotile before proceeding."),
                    TileLang.ParticularText("Action", "Close")
                    );
                return;
            }

            // Warn user if modified atlas will contain impossible brushes.
            if (BrushUtility.WouldHaveImpossibleTilesetBrushes(this.tileset, this.inputTileWidth, this.inputTileHeight, this.inputBorderSize))
            {
                if (!EditorUtility.DisplayDialog(
                        TileLang.Text("Warning, brushes will be deleted"),
                        TileLang.Text("Modified atlas contains fewer tiles than previously. Previously created brushes that are out of range will be deleted.\n\nWould you like to proceed?"),
                        TileLang.ParticularText("Action", "Yes"),
                        TileLang.ParticularText("Action", "No")
                        ))
                {
                    return;
                }
            }

            bool refreshProceduralMeshes = !this.inputProcedural && this.autotileTileset.procedural;

            // If raw uncompressed variation of autotile is not defined generate from
            // current selection.
            if (this.inputNewAutotileArtworkUncompressed == null)
            {
                if (this.inputNewAutotileArtwork == null)
                {
                    Debug.LogError(TileLang.ParticularText("Error", "Invalid autotile artwork was specified."));
                    return;
                }
                this.inputNewAutotileArtworkUncompressed = EditorInternalUtility.LoadTextureUncompressed(this.inputNewAutotileArtwork);
            }

            this.ExpandAutotileArtwork(this.inputBorderSize);

            string tilesetBasePath = this.tilesetRecord.AssetPath.Substring(0, this.tilesetRecord.AssetPath.LastIndexOf('/') + 1);

            // Save texture asset.
            string assetPath = AssetDatabase.GetAssetPath(this.autotileTileset.AtlasTexture);

            if (string.IsNullOrEmpty(assetPath) || !assetPath.StartsWith(tilesetBasePath))
            {
                assetPath = AssetDatabase.GenerateUniqueAssetPath(tilesetBasePath + "atlas.png");
            }

            this.autotileTileset.AtlasTexture = EditorInternalUtility.SavePngAsset(assetPath, this.expandedAutotileAtlas);

            // Update and save material asset.
            if (this.autotileTileset.AtlasMaterial == null)
            {
                this.autotileTileset.AtlasMaterial             = new Material(Shader.Find("Rotorz/Tileset/Opaque Unlit"));
                this.autotileTileset.AtlasMaterial.mainTexture = this.autotileTileset.AtlasTexture;

                assetPath = AssetDatabase.GenerateUniqueAssetPath(tilesetBasePath + "atlas.mat");
                AssetDatabase.CreateAsset(this.autotileTileset.AtlasMaterial, assetPath);
                AssetDatabase.ImportAsset(assetPath);
            }
            else
            {
                this.autotileTileset.AtlasMaterial.mainTexture = this.autotileTileset.AtlasTexture;
                EditorUtility.SetDirty(this.autotileTileset.AtlasMaterial);
            }

            // Calculate metrics for tileset.
            var metrics = new TilesetMetrics(this.autotileTileset.AtlasTexture, this.inputTileWidth, this.inputTileHeight, this.inputBorderSize, this.inputDelta);

            // Update properties of tileset.
            this.autotileTileset.procedural      = this.inputProcedural;
            this.autotileTileset.ForceClampEdges = this.inputClampEdges;
            this.autotileTileset.rawTexture      = this.inputNewAutotileArtwork;
            this.autotileTileset.SetMetricsFrom(metrics);

            this.ClearExpandedAutotileAtlas();

            EditorUtility.SetDirty(this.autotileTileset);

            // Delete "impossible" tile brushes in tileset.
            // For example, an extra brush for a tile that no longer exists.
            BrushUtility.DeleteImpossibleTilesetBrushes(this.tileset);

            // Ensure that non-procedural meshes are pre-generated if missing.
            if (refreshProceduralMeshes)
            {
                BrushUtility.RefreshNonProceduralMeshes(this.tileset);
            }

            ToolUtility.RepaintBrushPalette();

            // Update procedural meshes for tile systems in scene if necessary.
            // Note: Only update if procedural mode of tileset was not modified.
            if (this.inputProcedural && this.tileset.procedural)
            {
                foreach (TileSystem tileSystem in Object.FindObjectsOfType(typeof(TileSystem)))
                {
                    tileSystem.UpdateProceduralTiles(true);
                }
            }
        }
コード例 #17
0
        protected virtual void OnApplyChanges()
        {
            // Do not proceed if no atlas texture was selected.
            if (this.inputAtlasTexture == null)
            {
                EditorUtility.DisplayDialog(
                    TileLang.ParticularText("Error", "Atlas texture was not specified"),
                    TileLang.Text("Please select an atlas texture before proceeding."),
                    TileLang.ParticularText("Action", "Close")
                    );
                return;
            }

            // Warn user if modified atlas will contain impossible brushes.
            if (BrushUtility.WouldHaveImpossibleTilesetBrushes(this.tileset, this.inputTileWidth, this.inputTileHeight, this.inputBorderSize))
            {
                if (!EditorUtility.DisplayDialog(
                        TileLang.Text("Warning, brushes will be deleted"),
                        TileLang.Text("Modified atlas contains fewer tiles than previously. Previously created brushes that are out of range will be deleted.\n\nWould you like to proceed?"),
                        TileLang.ParticularText("Action", "Yes"),
                        TileLang.ParticularText("Action", "No")
                        ))
                {
                    return;
                }
            }

            bool refreshNonProceduralMeshes = !this.inputProcedural && this.tileset.procedural;

            string tilesetBasePath = this.tilesetRecord.AssetPath.Substring(0, this.tilesetRecord.AssetPath.LastIndexOf('/') + 1);

            // Update and save material asset.
            if (this.tileset.AtlasMaterial == null)
            {
                this.tileset.AtlasMaterial             = new Material(Shader.Find("Rotorz/Tileset/Opaque Unlit"));
                this.tileset.AtlasMaterial.mainTexture = this.inputAtlasTexture;

                string assetPath = AssetDatabase.GenerateUniqueAssetPath(tilesetBasePath + "atlas.mat");
                AssetDatabase.CreateAsset(this.tileset.AtlasMaterial, assetPath);
                AssetDatabase.ImportAsset(assetPath);
            }
            else
            {
                this.tileset.AtlasMaterial.mainTexture = this.inputAtlasTexture;
                EditorUtility.SetDirty(this.tileset.AtlasMaterial);
            }

            this.tileset.AtlasTexture = this.inputAtlasTexture;

            // Calculate metrics for tileset.
            this.RecalculateMetrics();

            // Update properties of tileset.
            this.tileset.procedural = this.inputProcedural;
            this.tileset.SetMetricsFrom(this.inputTilesetMetrics);

            EditorUtility.SetDirty(this.tileset);

            // Delete "impossible" tile brushes in tileset.
            // For example, an extra brush for a tile that no longer exists.
            BrushUtility.DeleteImpossibleTilesetBrushes(this.tileset);

            // Ensure that non-procedural meshes are pre-generated if missing.
            if (refreshNonProceduralMeshes)
            {
                BrushUtility.RefreshNonProceduralMeshes(this.tileset);
            }

            ToolUtility.RepaintBrushPalette();

            // Update procedural meshes for tile systems in scene if necessary.
            // Note: Only update if procedural mode of tileset was not modified.
            if (this.inputProcedural && this.tileset.procedural)
            {
                foreach (TileSystem system in Object.FindObjectsOfType(typeof(TileSystem)))
                {
                    system.UpdateProceduralTiles(true);
                }
            }
        }
コード例 #18
0
 static void Menu_RTS_EditorWindows_Brushes()
 {
     ToolUtility.ShowBrushPalette();
 }
コード例 #19
0
 protected void btnDetailExcel_Click(object sender, EventArgs e)
 {
     
     ToolUtility t = new ToolUtility();
   t.ExportExcel(grvDetail, "Excel", Page);
  // t.ToExcel(hidGrv1.Value);
     
 }
コード例 #20
0
ファイル: SAMBRepair.aspx.cs プロジェクト: wra222/testgit
    protected void btnExport_Click(object sender, EventArgs e)
    {
        ToolUtility tu = new ToolUtility();
        tu.ExportExcel(gvQuery, "SAMBRepair" , Page);

    }
コード例 #21
0
 public static bool ContextMenu_Transform_SelectTileSystem_Validate()
 {
     return(Selection.gameObjects.Length == 1 && ToolUtility.FindParentTileSystem(Selection.activeTransform) != null);
 }
コード例 #22
0
 public static void ToolMenu_EditorWindows_Scene()
 {
     ToolUtility.ShowScenePalette();
 }
コード例 #23
0
 public static void ToolMenu_EditorWindows_Brushes()
 {
     ToolUtility.ShowBrushPalette();
 }
コード例 #24
0
ファイル: SQEReport.aspx.cs プロジェクト: wra222/testgit
 protected void btnExport_Click(object sender, EventArgs e)
 {
     if (gvQuery.Rows.Count == 0)
         return;
     ToolUtility tu = new ToolUtility();
     myControls.GridViewExt gv = gvQuery;
     string fileName = "SQEReport";
     if ("M".Equals(hidPeriod.Value))
     {
         fileName = "Monthly" + fileName;
     }
     else if ("Q".Equals(hidPeriod.Value))
     {
         fileName = "Quarterly" + fileName;
     }
     tu.ExportExcel(gv, fileName, Page);
 }
コード例 #25
0
ファイル: PCBInputQuery.aspx.cs プロジェクト: wra222/testgit
 protected void btnDetailExport_Click(object sender, EventArgs e) {
     ToolUtility tu = new ToolUtility();
     tu.ExportExcel(gvStationDetail, "PCBInputDetailQuery", Page);
 }
コード例 #26
0
 static void Menu_RTS_EditorWindows_Scene()
 {
     ToolUtility.ShowScenePalette();
 }
コード例 #27
0
 public void ExcelOut(GridView gv)
 {
     if (gv.Rows.Count > 0)
     {
         ToolUtility tu = new ToolUtility();
         tu.ExportExcel(dinnertime, "Sheet1", this.Page);
     }
     else
     {
         Response.Write("<script>alert('沒有數據!')</script>");
     }
 }
コード例 #28
0
ファイル: UPH.aspx.cs プロジェクト: wra222/testgit
    private void Inutexcel2(Stream ExcelFileStream)
    {
        ToolUtility tu = new ToolUtility();
        DataTable dt= tu.getExcelSheetData( ExcelFileStream,false);
        bindbullTable(dt,0);
        foreach (DataRow dr in dt.Rows)
        {
            string process= dr["Process"].ToString().Trim();
            if (string.IsNullOrEmpty(process))
            {
                break;
            }
            UPHInfo alarminfo = new UPHInfo();
            alarminfo.Process = process;
           
            alarminfo.Family = dr["Family"].ToString().Trim();
            alarminfo.Attend_normal = int.Parse(dr["Attend_normal"].ToString().Trim());
            alarminfo.ST = dr["ST"].ToString().Trim();
            alarminfo.NormalUPH = int.Parse(dr["NormalUPH"].ToString().Trim());
            alarminfo.Cycle = dr["Cycle"].ToString().Trim();
            alarminfo.Remark = dr["Remark"].ToString().Trim();
            alarminfo.Special = dr["Special"].ToString().Trim();
            // alarminfo.Editor = ((MasterPageMaintain)Master).userInfo.UserName.ToString().Trim();
            alarminfo.Editor = Master.userInfo.UserId;
            alarminfo.Cdt = DateTime.Now;
            alarminfo.Udt = DateTime.Now;
            uph.AddProductUPHInfo(alarminfo);


        }

    }
コード例 #29
0
    private void InputExcel(string pPath)
    {
        int NUM = 0;
        ToolUtility TU = new ToolUtility();
        DataTable DT = TU.getExcelSheetData(pPath, false);
        DataTable dinnertime = DinnerTime.GetAllDinnerTime();
        foreach (DataRow DR in DT.Rows)
        {
            DinnerTimeInfo dinnerinfo = new DinnerTimeInfo()
            {
                Process = DR["Process"].ToString().Trim(),
                Type = DR["Type"].ToString().Trim(),
                Class = DR["Class"].ToString().Trim(),
                PdLine = DR["PdLine"].ToString().Trim(),
                BeginTime = DR["BeginTime"].ToString().Trim(),
                EndTime = DR["EndTime"].ToString().Trim(),
                Remark = DR["Remark"].ToString().Trim(),
                Editor = Master.userInfo.UserId,
                Cdt = DateTime.Now,
                Udt = DateTime.Now
            };

            DinnerLogInfo dinnerLoginfo = new DinnerLogInfo()
            {
                Process = DR["Process"].ToString().Trim(),
                Type = DR["Type"].ToString().Trim(),
                Class = DR["Class"].ToString().Trim(),
                PdLine = DR["PdLine"].ToString().Trim(),
                BeginTime = DR["BeginTime"].ToString().Trim(),
                EndTime = DR["EndTime"].ToString().Trim(),
                Remark = DR["Remark"].ToString().Trim(),
                Editor = Master.userInfo.UserId,
                Cdt = DateTime.Now
            };

            if (dinnerinfo.Process != "" && dinnerinfo.Type != "" && dinnerinfo.Class != "" && dinnerinfo.PdLine != "" && dinnerinfo.BeginTime != "" && dinnerinfo.EndTime != "")
            {
                DinnerTime.AddDinnerLogInfo(dinnerLoginfo);
                DinnerTime.AddDinnerTimeInfo(dinnerinfo);
            }
            else
            {
                NUM += 1;
                continue;
            }
            foreach (DataRow allDR in dinnertime.Rows)
            {
                if (allDR["Class"].ToString().Trim() == DR["Class"].ToString().Trim() && allDR["PdLine"].ToString().Trim() == DR["PdLine"].ToString().Trim())
                {
                    string id  = allDR["ID"].ToString().Trim();
                    DinnerTime.DelDinnerTime(Int32.Parse(id));
                    id = null;
                }
            }
        }
        txtremark.Text = "";
        txtquery_Click(null, null);
    }
コード例 #30
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     ToolUtility tu = new ToolUtility();
     if (gvQuery.HeaderRow != null && gvQuery.HeaderRow.Cells.Count > 0)
         tu.ExportExcel(gvQuery, "FAReturnPCAQuery", Page);
     else
         writeToAlertMessage("Please select one record!"); 
     
 }
コード例 #31
0
ファイル: PCBInputQuery.aspx.cs プロジェクト: wra222/testgit
    private void InitGridViewHeader()
    {
        DataTable dtStation = Station.GetStation(DBConnection);
        for (int r = FixedColCount; r <= StationList.Split(',').Length + (FixedColCount - 1); r++)
        {
            ToolUtility tool = new ToolUtility();
            string descr = tool.GetStationDescr(dtStation, gvQuery.HeaderRow.Cells[r].Text.Trim());
            string tip = tool.GetTipString(descr);
            gvQuery.HeaderRow.Cells[r].Attributes.Add("onmouseover", tip);
            gvQuery.HeaderRow.Cells[r].Attributes.Add("onmouseout", "UnTip()");

        }
    }
コード例 #32
0
 protected void btnDetailExport_Click(object sender, EventArgs e)
 {
     if (gvStationDetail.HeaderRow == null)
         return;
     ToolUtility tu = new ToolUtility();
     tu.ExportExcel(gvStationDetail, "PCBStationDetailQuery", Page);
 }
コード例 #33
0
ファイル: BTLocQuery.aspx.cs プロジェクト: wra222/testgit
 protected void btnExcel_Click(object sender, EventArgs e)
 {
      ToolUtility t = new ToolUtility();
      t.ExportExcel(gvResult, "Excel",Page);
 }
コード例 #34
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        ToolUtility tu = new ToolUtility();
        DataTable dt = (DataTable)gvQuery.DataSource;

        tu.ExportExcel(gvQuery, Page.Title, Page);
    }
コード例 #35
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     ToolUtility tu = new ToolUtility();
     tu.ExportExcel(gvResult, Page.Title, Page);        
     //MemoryStream ms = ExcelTool.GridViewToExcel(gvResult, "MO查詢");
     //this.Response.ContentType = "application/download";
     //this.Response.AddHeader("Content-Disposition", "attachment; filename=file.xls");
     //this.Response.Clear();
     //this.Response.BinaryWrite(ms.GetBuffer());
     //ms.Close();
     //ms.Dispose();
 }
コード例 #36
0
 /// <summary>
 /// 保存游戏数据
 /// </summary>
 public static void SaveGame()
 {
     ToolUtility.SaveJson(gameSaveSystem.GameData, "GameData");
 }
コード例 #37
0
ファイル: MaterialUsed.aspx.cs プロジェクト: wra222/testgit
    protected void btnExport_Click(object sender, EventArgs e)
    {
        if (gvQuery.Rows.Count == 0)
            return;
        ToolUtility tu = new ToolUtility();
        myControls.GridViewExt gv = gvQuery;
        string fileName = "MaterialUsed";
        if ("M".Equals(hidPeriod.Value))
        {
            fileName = "Monthly" + fileName;

            DataTable dt = (DataTable) gvQuery.DataSource;
            DataTable dt2 = new DataTable();
            for (int p = 0; p < gvQuery.HeaderRow.Cells.Count; p++)
                dt2.Columns.Add(gvQuery.HeaderRow.Cells[p].Text);
            for (int i = 0; i < gvQuery.Rows.Count; i++)
            {
                DataRow r = dt2.NewRow();
                for (int j = 0; j < gvQuery.Rows[i].Cells.Count; j++) {
                    if (j == IDX_Monthly)
                        r[j] = "=\"" + gvQuery.Rows[i].Cells[j].Text + "\"";
                    else
                        r[j] = gvQuery.Rows[i].Cells[j].Text;
                }
                dt2.Rows.Add(r);
            }
            gv = new myControls.GridViewExt();
            gv.DataSource = dt2;
            gv.DataBind();
        }
        else if ("Q".Equals(hidPeriod.Value))
        {
            fileName = "Quarterly" + fileName;
        }
        tu.ExportExcel(gv, fileName, Page);
    }
コード例 #38
0
ファイル: PCBTestReport.aspx.cs プロジェクト: wra222/testgit
 protected void btnDetailExport_Click(object sender, EventArgs e)
 {
     ToolUtility tu = new ToolUtility();
     tu.ExportExcel(grvDetail, Page.Title, Page);
 }
コード例 #39
0
ファイル: AlarmMaintain.aspx.cs プロジェクト: wra222/testgit
    //private void InputExcel(string pPath)
    //{
    //    //FileStream file = null;
    //    //string conn = "Provider = Microsoft.ACE.OLEDB.12.0 ; Data Source =" + pPath + ";Extended Properties='Excel 12.0;HDR=Yes;IMEX=1'";
    //    string connstr2003 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pPath + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
    //    string connstr2007 = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pPath + ";Extended Properties=\"Excel 12.0;HDR=YES\"";
    //    OleDbConnection oleCon;
    //    if (System.IO.Path.GetExtension(pPath) == ".xls")
    //    {
    //        oleCon = new OleDbConnection(connstr2003);
    //    }
    //    else
    //    {
    //        oleCon = new OleDbConnection(connstr2007);
    //    }
    //    oleCon.Open();
    //    //file = new FileStream(pPath, FileMode.Open);
    //    string Sql = "select * from [Sheet1$] where process<>'' and Class<>'' and PdLine<>'' and BeginTime<>'' and EndTime<>'' and Status<>''";
    //    OleDbDataAdapter mycommand = new OleDbDataAdapter(Sql, oleCon);
    //    DataSet ds = new DataSet();
    //    mycommand.Fill(ds, "[Sheet1$]");
    //    oleCon.Close();
    //    //file.Close();
    //    int count = ds.Tables["[Sheet1$]"].Rows.Count;
    //    AlarmInfo alarminfo = new AlarmInfo();
    //    AlarmInfoLog alarminfolog = new AlarmInfoLog();
    //    for (int i = 0; i < count; i++)
    //    {
    //        if (ds.Tables["[Sheet1$]"].Rows[i]["process"].ToString().Trim() != "")
    //        {
    //            alarminfo.process = ds.Tables["[Sheet1$]"].Rows[i]["process"].ToString().ToUpper().Trim();
    //            alarminfo.Class = ds.Tables["[Sheet1$]"].Rows[i]["Class"].ToString().ToUpper().Trim();
    //            alarminfo.PdLine = ds.Tables["[Sheet1$]"].Rows[i]["PdLine"].ToString().ToUpper().Trim();
    //            alarminfo.BeginTime = Convert.ToDateTime(ds.Tables["[Sheet1$]"].Rows[i]["BeginTime"]).ToString("HH:mm").Trim();
    //            alarminfo.EndTime = Convert.ToDateTime(ds.Tables["[Sheet1$]"].Rows[i]["EndTime"]).ToString("HH:mm").Trim();
    //            alarminfo.Status = ds.Tables["[Sheet1$]"].Rows[i]["Status"].ToString().Trim();
    //            alarminfo.Remark = ds.Tables["[Sheet1$]"].Rows[i]["Remark"].ToString().Trim();
    //            alarminfo.Editor = ((MasterPageMaintain)Master).userInfo.UserName.ToString().Trim();
    //            alarminfo.Cdt = DateTime.Now;
    //            alarminfo.Udt = DateTime.Now;
    //            IAM.AddAlarmInfo(alarminfo);
    //            //塞入Log
    //            alarminfolog.process = ds.Tables["[Sheet1$]"].Rows[i]["process"].ToString().ToUpper().Trim();
    //            alarminfolog.Class = ds.Tables["[Sheet1$]"].Rows[i]["Class"].ToString().ToUpper().Trim();
    //            alarminfolog.PdLine = ds.Tables["[Sheet1$]"].Rows[i]["PdLine"].ToString().ToUpper().Trim();
    //            alarminfolog.BeginTime = Convert.ToDateTime(ds.Tables["[Sheet1$]"].Rows[i]["BeginTime"]).ToString("HH:mm").Trim();
    //            alarminfolog.EndTime = Convert.ToDateTime(ds.Tables["[Sheet1$]"].Rows[i]["EndTime"]).ToString("HH:mm").Trim();
    //            alarminfolog.Status = ds.Tables["[Sheet1$]"].Rows[i]["Status"].ToString().Trim();
    //            alarminfolog.Remark = "InputExcel! " + ds.Tables["[Sheet1$]"].Rows[i]["Remark"].ToString().Trim();
    //            alarminfolog.Editor = ((MasterPageMaintain)Master).userInfo.UserName.ToString().Trim();
    //            alarminfolog.Cdt = DateTime.Now;
    //            IAM.AddAlarmlog(alarminfolog);
    //        }
    //        else
    //        {
    //            break;
    //        }
    //    }
    //    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "alert('导入成功!')", true);
    //    Button_Query_Click(this, null);
    //}
#endregion
    private void InputExcel(string pPath)
    {
        int NUM = 0;
        ToolUtility TU = new ToolUtility();
        DataTable DT = TU.getExcelSheetData(pPath, false);
        DataTable allDT = IAM.GetAlarmALL();
        foreach (DataRow DR in DT.Rows)
        {
            AlarmInfo alarminfo = new AlarmInfo()
            {
                process = DR["Process"].ToString().Trim(),
                Class = DR["Class"].ToString().Trim(),
                PdLine = DR["PdLine"].ToString().Trim(),
                BeginTime = DR["BeginTime"].ToString().Trim(),
                EndTime = DR["EndTime"].ToString().Trim(),
                Status = DR["Status"].ToString().Trim(),
                Remark = DR["Remark"].ToString().Trim(),
                Editor = ((MasterPageMaintain)Master).userInfo.UserId.ToString(),
                Cdt = DateTime.Now,
                Udt = DateTime.Now
            };
            AlarmInfoLog alarminfolog = new AlarmInfoLog()
            {
                process = DR["Process"].ToString().Trim(),
                Class = DR["Class"].ToString().Trim(),
                PdLine = DR["PdLine"].ToString().Trim(),
                BeginTime = DR["BeginTime"].ToString().Trim(),
                EndTime = DR["EndTime"].ToString().Trim(),
                Status = DR["Status"].ToString().Trim(),
                Remark = "Excel Input! " + DR["Remark"].ToString().Trim(),
                Editor = ((MasterPageMaintain)Master).userInfo.UserId.ToString(),
                Cdt = DateTime.Now,
            };
            if (alarminfo.process != "" && alarminfo.Class != "" && alarminfo.PdLine != "" && alarminfo.BeginTime != "" && alarminfo.EndTime != "")
            {
                IAM.AddAlarmInfo(alarminfo);
                IAM.AddAlarmlog(alarminfolog);
            }
            else
            {
                NUM += 1;
                continue;
            }
            foreach (DataRow allDR in allDT.Rows)
            {
                if (allDR["Class"].ToString().Trim() == DR["Class"].ToString().Trim() && allDR["PdLine"].ToString().Trim() == DR["PdLine"].ToString().Trim())
                {
                    get_id.Value = allDR["ID"].ToString().Trim();
                    IAM.DelAlarm(Int32.Parse(get_id.Value));
                    get_id.Value = null;
                }
            }
        }
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "alert('导入Excel已完成!" + NUM + "行数据不完整,未进行导入!')", true);
        Button_Query_Click(this, null);
    }
コード例 #40
0
ファイル: PCBInputQuery.aspx.cs プロジェクト: wra222/testgit
 protected void btnDetailExport_Click(object sender, EventArgs e) {
     ToolUtility tu = new ToolUtility();
     if (gvStationDetail.HeaderRow != null && gvStationDetail.HeaderRow.Cells.Count > 0)
         tu.ExportExcel(gvStationDetail, "PCBInputDetailQuery", Page);
     else
         writeToAlertMessage("Please select one record!");        
 }
コード例 #41
0
ファイル: AlarmMaintain.aspx.cs プロジェクト: wra222/testgit
 protected void ExportExcel(GridView gv)
 {
     if (GridView1.Rows.Count > 0)
     {
         ToolUtility tu = new ToolUtility();
         tu.ExportExcel(GridView1, "Sheet1", Page);
     }
     else
     {
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "alert('请查出需要导出的数据!')", true);
     }
 }
コード例 #42
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     ToolUtility tu = new ToolUtility();
     tu.ExportExcel(gvQuery, "FAReturnPCAQuery", Page);
 }
コード例 #43
0
        protected override string GetDxText(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo, ID8TopLevel topLevel)
        {
            //Only render the ATE when printing/plotting or previewing a print.
            //This boosts performance when working in page layout view
            //without having to 'pause' rendering.
            switch (eTextEvent)
            {
            case mmAutoTextEvents.mmCreate:
            case mmAutoTextEvents.mmDraw:
            case mmAutoTextEvents.mmFinishPlot:
            case mmAutoTextEvents.mmRefresh:
            default:
                return(_defaultDisplay);

            case mmAutoTextEvents.mmPlotNewPage:
            case mmAutoTextEvents.mmPrint:
            case mmAutoTextEvents.mmStartPlot:
                break;
            }

            IEnvelope CurrentExtent = null;

            try
            {
                IMap Map = null;
                if (pMapProdInfo != null && pMapProdInfo.Map != null)
                {
                    Map = pMapProdInfo.Map;
                }
                else
                {
                    //This is requried for print preview or file->export map.
                    //During these times there will be no map production object
                    //and we will just use the current extent.  Useful for testing
                    //and "one-off" maps.
                    IApplication App   = DesignerUtility.GetApplication();
                    IMxDocument  MxDoc = App.Document as IMxDocument;
                    if (MxDoc == null)
                    {
                        throw new Exception("Unable to load Map Document from Application");
                    }

                    Map = MxDoc.FocusMap;
                }

                IActiveView ActiveView = Map as IActiveView;
                if (ActiveView == null)
                {
                    throw new Exception("Unable to load Active View from Map");
                }

                CurrentExtent = ActiveView.Extent;
                if (CurrentExtent == null ||
                    CurrentExtent.IsEmpty)
                {
                    throw new Exception("Unable to determine map extent.");
                }
            }
            catch (Exception ex)
            {
                ToolUtility.LogError("Unable to load extents of the focus map", ex);
                return(_defaultDisplay);
            }

            return(GetConstructionNotes(topLevel, CurrentExtent));
        }
コード例 #44
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     ToolUtility tu = new ToolUtility();
     tu.ExportExcel(gvResult, Page.Title, Page);
 }
コード例 #45
0
ファイル: SA_SABANDIT.aspx.cs プロジェクト: wra222/testgit
 protected void btnExport_Click(object sender, EventArgs e)
 {
     if (gvQuery.HeaderRow == null)
         return;
     ToolUtility tu = new ToolUtility();
     tu.ExportExcel(gvQuery, "PCBTESTQuery", Page);
 }