├── .gitignore ├── LICENSE ├── README.md ├── SqlCLR.JalaliDateUtility.sln └── SqlCLR.JalaliDateUtility ├── Dist └── DeploymentScript.sql ├── JalaliDateUtility.cs ├── Sohato.SqlCLR.jfm ├── SqlCLR.JalaliDateUtility.jfm ├── SqlCLR.JalaliDateUtility.sqlproj └── TestScripts └── Test.sql /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | *.VC.VC.opendb 85 | 86 | # Visual Studio profiler 87 | *.psess 88 | *.vsp 89 | *.vspx 90 | *.sap 91 | 92 | # TFS 2012 Local Workspace 93 | $tf/ 94 | 95 | # Guidance Automation Toolkit 96 | *.gpState 97 | 98 | # ReSharper is a .NET coding add-in 99 | _ReSharper*/ 100 | *.[Rr]e[Ss]harper 101 | *.DotSettings.user 102 | 103 | # JustCode is a .NET coding add-in 104 | .JustCode 105 | 106 | # TeamCity is a build add-in 107 | _TeamCity* 108 | 109 | # DotCover is a Code Coverage Tool 110 | *.dotCover 111 | 112 | # NCrunch 113 | _NCrunch_* 114 | .*crunch*.local.xml 115 | nCrunchTemp_* 116 | 117 | # MightyMoose 118 | *.mm.* 119 | AutoTest.Net/ 120 | 121 | # Web workbench (sass) 122 | .sass-cache/ 123 | 124 | # Installshield output folder 125 | [Ee]xpress/ 126 | 127 | # DocProject is a documentation generator add-in 128 | DocProject/buildhelp/ 129 | DocProject/Help/*.HxT 130 | DocProject/Help/*.HxC 131 | DocProject/Help/*.hhc 132 | DocProject/Help/*.hhk 133 | DocProject/Help/*.hhp 134 | DocProject/Help/Html2 135 | DocProject/Help/html 136 | 137 | # Click-Once directory 138 | publish/ 139 | 140 | # Publish Web Output 141 | *.[Pp]ublish.xml 142 | *.azurePubxml 143 | # TODO: Comment the next line if you want to checkin your web deploy settings 144 | # but database connection strings (with potential passwords) will be unencrypted 145 | *.pubxml 146 | *.publishproj 147 | 148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 149 | # checkin your Azure Web App publish settings, but sensitive information contained 150 | # in these scripts will be unencrypted 151 | PublishScripts/ 152 | 153 | # NuGet Packages 154 | *.nupkg 155 | # The packages folder can be ignored because of Package Restore 156 | **/packages/* 157 | # except build/, which is used as an MSBuild target. 158 | !**/packages/build/ 159 | # Uncomment if necessary however generally it will be regenerated when needed 160 | #!**/packages/repositories.config 161 | # NuGet v3's project.json files produces more ignoreable files 162 | *.nuget.props 163 | *.nuget.targets 164 | 165 | # Microsoft Azure Build Output 166 | csx/ 167 | *.build.csdef 168 | 169 | # Microsoft Azure Emulator 170 | ecf/ 171 | rcf/ 172 | 173 | # Windows Store app package directories and files 174 | AppPackages/ 175 | BundleArtifacts/ 176 | Package.StoreAssociation.xml 177 | _pkginfo.txt 178 | 179 | # Visual Studio cache files 180 | # files ending in .cache can be ignored 181 | *.[Cc]ache 182 | # but keep track of directories ending in .cache 183 | !*.[Cc]ache/ 184 | 185 | # Others 186 | ClientBin/ 187 | ~$* 188 | *~ 189 | *.dbmdl 190 | *.dbproj.schemaview 191 | *.pfx 192 | *.publishsettings 193 | node_modules/ 194 | orleans.codegen.cs 195 | 196 | # Since there are multiple workflows, uncomment next line to ignore bower_components 197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 198 | #bower_components/ 199 | 200 | # RIA/Silverlight projects 201 | Generated_Code/ 202 | 203 | # Backup & report files from converting an old project file 204 | # to a newer Visual Studio version. Backup files are not needed, 205 | # because we have git ;-) 206 | _UpgradeReport_Files/ 207 | Backup*/ 208 | UpgradeLog*.XML 209 | UpgradeLog*.htm 210 | 211 | # SQL Server files 212 | *.mdf 213 | *.ldf 214 | 215 | # Business Intelligence projects 216 | *.rdl.data 217 | *.bim.layout 218 | *.bim_*.settings 219 | 220 | # Microsoft Fakes 221 | FakesAssemblies/ 222 | 223 | # GhostDoc plugin setting file 224 | *.GhostDoc.xml 225 | 226 | # Node.js Tools for Visual Studio 227 | .ntvs_analysis.dat 228 | 229 | # Visual Studio 6 build log 230 | *.plg 231 | 232 | # Visual Studio 6 workspace options file 233 | *.opt 234 | 235 | # Visual Studio LightSwitch build output 236 | **/*.HTMLClient/GeneratedArtifacts 237 | **/*.DesktopClient/GeneratedArtifacts 238 | **/*.DesktopClient/ModelManifest.xml 239 | **/*.Server/GeneratedArtifacts 240 | **/*.Server/ModelManifest.xml 241 | _Pvt_Extensions 242 | 243 | # Paket dependency manager 244 | .paket/paket.exe 245 | paket-files/ 246 | 247 | # FAKE - F# Make 248 | .fake/ 249 | 250 | # JetBrains Rider 251 | .idea/ 252 | *.sln.iml 253 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SQL CLR Jalali Date Time Utility 2 | 3 | The aim of this project is to make it more easier for developers to work with jalali (shamsi - شمسی) dates. 4 | 5 | * Support .Net Date and Time Formatting (More Information at this page: [Custom Date and Time Format Strings](https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx) ). 6 | * Developed with C# (SQL CLR) 7 | 8 | ## 💡 Installation 9 | 10 | * Make sure you have .NET framework 4.7.2+ installed on your server. 11 | 12 | * Since this library has beed developed using SQL CLR, firstly you need to configure your SQL Server by [Enabling CLR Integration In SQL Server](https://msdn.microsoft.com/en-us/library/ms131048.aspx) 13 | 14 | ### SQL Server 2005-2014 15 | ```sql 16 | sp_configure 'show advanced options', 1; 17 | GO 18 | RECONFIGURE; 19 | GO 20 | sp_configure 'clr enabled', 1; 21 | GO 22 | RECONFIGURE; 23 | GO 24 | ``` 25 | ### SQL Server 2017+ 26 | ```sql 27 | sp_configure 'show advanced options', 1; 28 | GO 29 | RECONFIGURE; 30 | GO 31 | sp_configure 'clr enabled', 1; 32 | GO 33 | EXEC sp_configure 'clr strict security',0; 34 | GO 35 | RECONFIGURE; 36 | GO 37 | ``` 38 | 39 | * Run the [Deployment Script](https://github.com/mirsaeedi/SQLCLR-Jalali-Date-Utility/blob/master/SqlCLR.JalaliDateUtility/Dist/DeploymentScript.sql) in SQL Server Management Studio to generate the Jalali functions in your database. 40 | 41 | * Note that you have to run this script in SQLCMD Mode. So in SQL Management Studio, Select _Query Menu_, and then select _SQLCMD Mode_. Now you will be able to execute the query. 42 | 43 | * Please be sure that you have changed the _[your-database-name]_ inside the [Deployment Script](https://github.com/mirsaeedi/SQLCLR-Jalali-Date-Utility/blob/master/SqlCLR.JalaliDateUtility/Dist/DeploymentScript.sql) to your database's name. 44 | 45 | 46 | ## 🕹 Usage 47 | 48 | ###### ★ Convert Gregorian To Jalali: 49 | 50 | Suppose that GETDATE() Method in sql server returns 2016/09/22 15:04:33 51 | 52 | ```sql 53 | select dbo.GregorianToJalali(GETDATE(),'yy') -- returns 95 54 | ``` 55 | 56 | ```sql 57 | select dbo.GregorianToJalali(GETDATE(),'yyyy') -- returns 1395 58 | ``` 59 | 60 | ```sql 61 | select dbo.GregorianToJalali(GETDATE(),'yyyy-MM') -- returns 1395-07 62 | ``` 63 | 64 | ```sql 65 | select dbo.GregorianToJalali(GETDATE(),'yyyy-M') -- returns 1395-7 66 | ``` 67 | 68 | ```sql 69 | select dbo.GregorianToJalali(GETDATE(),'yyyy/MM/dd') -- returns 1395/07/01 70 | ``` 71 | 72 | ```sql 73 | select dbo.GregorianToJalali(GETDATE(),'yyyy/MM/dd hh:mm tt') -- returns 1395/07/01 03:04 ب ظ 74 | ``` 75 | 76 | ```sql 77 | select dbo.GregorianToJalali(GETDATE(),'yyyy/MM/dd hh:mm:ss tt') -- returns 1395/07/01 03:04:33 ب ظ 78 | ``` 79 | 80 | ```sql 81 | select dbo.GregorianToJalali(GETDATE(),'yyyy/MM/dd HH:mm') -- returns 1395/07/01 15:04 82 | ``` 83 | 84 | ```sql 85 | select dbo.GregorianToJalali(GETDATE(),'yyyy MMMM dddd') -- returns 1395 پنج شنبه مهر 86 | ``` 87 | 88 | 89 | ###### ★ Convert Jajali Date To Gregorian: 90 | 91 | ```sql 92 | select dbo.JalaliToGregorian('95-06-11','-') --returns 2016-09-01 00:00:00.000 93 | ``` 94 | 95 | ```sql 96 | select dbo.JalaliToGregorian('1395/06/11','/') --returns 2016-09-01 00:00:00.000 97 | ``` 98 | 99 | ###### ★ Some times you need to have the first and last day of a persian month in gregorian date (specially in reporting) 100 | 101 | ```sql 102 | select dbo.GetJalaliLastDayOfMonth(GETDATE()) --returns 2016-10-21 00:00:00.000 which is equal to 1395/07/30 103 | ``` 104 | 105 | ```sql 106 | select dbo.GetJalaliFirstDayOfMonth(GETDATE()) --returns 2016-09-22 00:00:00.000 which is equal to 1395/07/01 107 | ``` 108 | -------------------------------------------------------------------------------- /SqlCLR.JalaliDateUtility.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "SqlCLR.JalaliDateUtility", "SqlCLR.JalaliDateUtility\SqlCLR.JalaliDateUtility.sqlproj", "{C078AE9B-F978-44BC-AC3D-1A6705A8098C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C078AE9B-F978-44BC-AC3D-1A6705A8098C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {C078AE9B-F978-44BC-AC3D-1A6705A8098C}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {C078AE9B-F978-44BC-AC3D-1A6705A8098C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 17 | {C078AE9B-F978-44BC-AC3D-1A6705A8098C}.Release|Any CPU.ActiveCfg = Release|Any CPU 18 | {C078AE9B-F978-44BC-AC3D-1A6705A8098C}.Release|Any CPU.Build.0 = Release|Any CPU 19 | {C078AE9B-F978-44BC-AC3D-1A6705A8098C}.Release|Any CPU.Deploy.0 = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(SolutionProperties) = preSolution 22 | HideSolutionNode = FALSE 23 | EndGlobalSection 24 | EndGlobal 25 | -------------------------------------------------------------------------------- /SqlCLR.JalaliDateUtility/Dist/DeploymentScript.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Deployment script for SqlCLR.JalaliDateUtility 3 | 4 | This code was generated by a tool. 5 | Changes to this file may cause incorrect behavior and will be lost if 6 | the code is regenerated. 7 | */ 8 | 9 | GO 10 | SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON; 11 | 12 | SET NUMERIC_ROUNDABORT OFF; 13 | 14 | 15 | GO 16 | :setvar DatabaseName "YourDatabaseName" 17 | 18 | GO 19 | :on error exit 20 | GO 21 | /* 22 | Detect SQLCMD mode and disable script execution if SQLCMD mode is not supported. 23 | To re-enable the script after enabling SQLCMD mode, execute the following: 24 | SET NOEXEC OFF; 25 | */ 26 | :setvar __IsSqlCmdEnabled "True" 27 | GO 28 | IF N'$(__IsSqlCmdEnabled)' NOT LIKE N'True' 29 | BEGIN 30 | PRINT N'SQLCMD mode must be enabled to successfully execute this script.'; 31 | SET NOEXEC ON; 32 | END 33 | 34 | 35 | GO 36 | USE [$(DatabaseName)]; 37 | 38 | 39 | GO 40 | IF EXISTS (SELECT 1 41 | FROM [master].[dbo].[sysdatabases] 42 | WHERE [name] = N'$(DatabaseName)') 43 | BEGIN 44 | ALTER DATABASE [$(DatabaseName)] 45 | SET ANSI_NULLS ON, 46 | ANSI_PADDING ON, 47 | ANSI_WARNINGS ON, 48 | ARITHABORT ON, 49 | CONCAT_NULL_YIELDS_NULL ON, 50 | QUOTED_IDENTIFIER ON, 51 | ANSI_NULL_DEFAULT ON, 52 | CURSOR_DEFAULT LOCAL 53 | WITH ROLLBACK IMMEDIATE; 54 | END 55 | 56 | 57 | GO 58 | IF EXISTS (SELECT 1 59 | FROM [master].[dbo].[sysdatabases] 60 | WHERE [name] = N'$(DatabaseName)') 61 | BEGIN 62 | ALTER DATABASE [$(DatabaseName)] 63 | SET PAGE_VERIFY NONE 64 | WITH ROLLBACK IMMEDIATE; 65 | END 66 | 67 | 68 | GO 69 | ALTER DATABASE [$(DatabaseName)] 70 | SET TARGET_RECOVERY_TIME = 0 SECONDS 71 | WITH ROLLBACK IMMEDIATE; 72 | 73 | 74 | GO 75 | IF EXISTS (SELECT 1 76 | FROM [master].[dbo].[sysdatabases] 77 | WHERE [name] = N'$(DatabaseName)') 78 | BEGIN 79 | ALTER DATABASE [$(DatabaseName)] 80 | SET QUERY_STORE (CLEANUP_POLICY = (STALE_QUERY_THRESHOLD_DAYS = 367)) 81 | WITH ROLLBACK IMMEDIATE; 82 | END 83 | 84 | GO 85 | PRINT N'Creating [SqlCLR.JalaliDateUtility]...'; 86 | 87 | 88 | GO 89 | CREATE ASSEMBLY [SqlCLR.JalaliDateUtility] 90 | AUTHORIZATION [dbo] 91 | FROM 0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A24000000000000005045000064860200C9F306600000000000000000F00022200B0230000014000000040000000000000000000000200000000000800100000000200000000200000400000000000000060000000000000000600000000200000000000003006085000040000000000000400000000000000000100000000000002000000000000000000000100000000000000000000000000000000000000000400000E8020000000000000000000000000000000000000000000000000000503100001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000004800000000000000000000002E7465787400000088120000002000000014000000020000000000000000000000000000200000602E72737263000000E802000000400000000400000016000000000000000000000000000040000040000000000000000000000000000000000000000000000000000000000000000000000000000000004800000002000500A0260000B00A000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001B300300E300000001000011000F00280500000A16FE010B072C0C14280600000A0C38C6000000730700000A0A00060F00280800000A6F0900000A0D060F00280800000A6F0A00000A1304060F00280800000A6F0B00000A1305060F00280800000A6F0C00000A130672010000701307030F00280800000A2809000006130711070F00280800000A280B000006130711070F00280800000A280A000006130711070F00280800000A28050000061307110709280600000613071107110428070000061307110711051106280800000613071107280600000A0CDE1213080011086F0D00000A280600000A0CDE00082A000110000000002100AECF00120D0000011B3008006000000002000011000F00280500000A16FE010B072C087E0E00000A0C2B47730700000A0A00060F00280800000A6F0900000A0D060F00280800000A6F0A00000A13040609110417161616166F0F00000A281000000A0CDE0D260000DE007E0E00000A0C2B00082A0110000000001D00345100050D0000011B3008006C00000003000011000F00280500000A16FE010B072C087E0E00000A0C2B53730700000A0A00060F00280800000A6F0900000A0D060F00280800000A6F0A00000A1304060911046F1100000A1305060911041105161616166F0F00000A281000000A0CDE0D260000DE007E0E00000A0C2B00082A0110000000001D00405D00050D0000011B3008008800000004000011000214FE010C082C087E0E00000A0D2B7502178D100000012516039D6F1200000A0A730700000A0B0006169A6F1300000A182E0506169A2B0D720300007006169A281400000A281500000A130406179A281500000A130506189A281500000A130607110411051106161616166F0F00000A281000000A0DDE0D260000DE007E0E00000A0D2B00092A0110000000002800517900050D000001133004004900000005000011000272090000700F01281600000A1F0C2F07720F0000702B0572170000706F1700000A721F0000700F01281600000A1F0C2F0772230000702B0572270000706F1700000A0A2B00062A0000001330050035000000050000110002722B0000700F017235000070281800000A6F1700000A723B0000700F01281900000A18186F1A00000A6F1700000A0A2B00062A000000133004003E000000050000110002724100007003280D0000066F1700000A724B0000700F017251000070281800000A6F1700000A72570000700F01281900000A6F1700000A0A2B00062A0000133004003E000000050000110002725B00007004280C0000066F1700000A72650000700F017251000070281800000A6F1700000A726B0000700F01281900000A6F1700000A0A2B00062A00001330040033000000050000110002726F0000700F01726F000070281B00000A6F1700000A72750000700F017275000070281B00000A6F1700000A0A2B00062A00133004005F00000005000011000272790000700F017279000070281B00000A6F1700000A727F0000700F017283000070281B00000A6F1700000A72890000700F017289000070281B00000A6F1700000A728F0000700F017293000070281B00000A6F1700000A0A2B00062A00133004003300000005000011000272990000700F017299000070281B00000A6F1700000A729F0000700F0172A3000070281B00000A6F1700000A0A2B00062A00133002007F0000000600001100021CFE010A062C0872A90000700B2B6C0216FE010C082C0872B30000700B2B5C0217FE010D092C0872C30000700B2B4C0218FE01130411042C0872D10000700B2B3A0219FE01130511052C0872E10000700B2B28021AFE01130611062C0872F30000700B2B16021AFE01130711072C0872050100700B2B04140B2B00072A0013300200EC00000007000011000217FE010A062C0B720F0100700B38D60000000218FE010C082C0B721F0100700B38C30000000219FE010D092C0B72310100700B38B0000000021AFE01130411042C0B723D0100700B389B000000021BFE01130511052C0B72450100700B3886000000021CFE01130611062C0872510100700B2B74021DFE01130711072C08725F0100700B2B62021EFE01130811082C0872670100700B2B50021F09FE01130911092C0872710100700B2B3D021F0AFE01130A110A2C0872790100700B2B2A021F0BFE01130B110B2C08727F0100700B2B17021F0CFE01130C110C2C0872890100700B2B04140B2B00072A2202281C00000A002A00000042534A4201000100000000000C00000076342E302E33303331390000000005006C00000048030000237E0000B40300007C03000023537472696E677300000000300700009801000023555300C8080000100000002347554944000000D8080000D801000023426C6F620000000000000002000001471502080900000000FA0133001600000100000012000000020000000E000000170000001C00000007000000070000000100000001000000020000000000CD010100000000000600CA00AF020600EA00AF020600A1008E020F00CF02000006003F03EF010A00B50049020A00300049020A001F01DE0206000100EF0106008900EF010600270208020600B901EF0106001D02EF010A006B00DE0206002E02080206004402EF0106002B01EF0106000C00EF01000000001200000000000100010001001000690300001500010001004820000000009600A401D500010048210000000096006D01E1000300C4210000000096005501E10004004C22000000009600F601EC000500F0220000000091006402F300070048230000000091000E03FA0009008C230000000091000103FA000B00D823000000009100260300010D002424000000009600A102F300100064240000000096001A03F3001200D024000000009600F302F300140010250000000091005A00080116009C2500000000910047000E01170094260000000086187F0206001800000001009200000002003803000001009200000001009200000001007700000002007502000001005803000002009200000001005803000002003F02000001005803000002009E01000001005803000002005E0300000300C301000001005803000002009200000001005803000002009200000001005803000002009200000001005E03000001009E0109007F02010011007F02060019007F020A0031007F0206000C0012012700410046032B0059007F0206000C00080131007900370236007900950136007900470136007900B6013C002900290143007100EA01510079008700550071004603610079008601730089005203860089003C018D0089003103910091009B009700510085028D0089003F00A00091002901A60091002901430089003201AB0051002901A60029007F0206002000230044012E000B0013012E0013001C012E001B003B0140002300440160002300440180002300440110004700680079009C00B100BC00200004800000000000000000000000000000000062030000040000000000000000000000CC00270000000000040000000000000000000000CC001B000000000000000000004E756C6C61626C65603100496E743332003C4D6F64756C653E0053797374656D2E44617461006D73636F726C696200446174614163636573734B696E64005265706C616365004765744A616C616C694D6F6E74684E616D65004765744A616C616C694461794E616D650053716C4461746554696D65007065726973616E4461746554696D6500546F4461746554696D65006461746554696D650050617273650044656275676761626C654174747269627574650053716C46756E6374696F6E41747472696275746500436F6D70696C6174696F6E52656C61786174696F6E734174747269627574650052756E74696D65436F6D7061746962696C697479417474726962757465006765745F56616C7565006765745F48617356616C75650053716C537472696E6700546F537472696E6700537562737472696E67006765745F4C656E677468004765744461794F664D6F6E7468004765744A616C616C694C6173744461794F664D6F6E7468004765744A616C616C6946697273744461794F664D6F6E74680047657444617973496E4D6F6E7468004765744D6F6E7468006D6F6E746800477265676F7269616E546F4A616C616C69004765744461794F665765656B006461794F665765656B0053716C434C522E4A616C616C69446174655574696C6974792E646C6C004E756C6C0053797374656D004A616C616C69546F477265676F7269616E0053797374656D2E476C6F62616C697A6174696F6E00457863657074696F6E005065727369616E43616C656E646172004765745965617200796561720043686172004D6963726F736F66742E53716C5365727665722E53657276657200466F726D617444657369676E61746F7200736570657261746F72002E63746F72006765745F486F75720053797374656D2E446961676E6F737469637300466F726D61745365636F6E64730053797374656D2E52756E74696D652E436F6D70696C6572536572766963657300446562756767696E674D6F6465730053797374656D2E446174612E53716C547970657300466F726D61744D696E7574657300466F726D61744D6F6E74687300466F726D6174596561727300466F726D6174486F75727300466F726D61744461797300436F6E63617400666F726D6174004F626A656374006F705F496D706C696369740053706C697400696E707574006461790053716C434C522E4A616C616C69446174655574696C69747900000001000531003300000574007400000742062000380601072806200038060103740000034206010328060109790079007900790000054400340000057900790000094D004D004D004D0000054D004D0000054400320000034D00000964006400640064000005640064000003640000057300730000037300000568006800000368000005250068000005480048000003480000052500480000056D006D0000036D00000525006D0000093406460628064706010FCC06A90620003406460628064706010D2F0648063406460628064706010F330647062000340646062806470601118606470627063106340646062806470601117E0646062C062000340646062806470601092C06450639064706010F41063106480631062F06CC0646060111270631062F06CC062806470634062A06010B2E0631062F0627062F0601072A06CC063106010B450631062F0627062F06010D340647063106CC0648063106010745064706310601092206280627064606010722063006310601052F06CC0601092806470645064606010B27063306410646062F0601000000F0F273F7F6E30347A962134F0846C7C6000420010108032000010520010111110F0709122D02112108080811310E1235061511250111290320000205000111210E0420001300052001081129062001113111290320000E090705122D0211390808030611390B2007112908080808080808060001113911290A0706122D0211390808080520020808080C07071D0E122D0211390808080620011D0E1D03032000080500020E0E0E040001080E0307010E0520020E0E0E0420010E0E0520020E08080A0708020E0202020202020F070D020E020202020202020202020208B77A5C561934E0890B000211211511250111290E0A0001113915112501112906000211390E030600020E0E11290500020E0E080700030E0E0811310500010E11310400010E080801000800000000001E01000100540216577261704E6F6E457863657074696F6E5468726F777301080100070100000000808F010001005455794D6963726F736F66742E53716C5365727665722E5365727665722E446174614163636573734B696E642C2053797374656D2E446174612C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038390A446174614163636573730000000000000000000000C9F3066000000000020000001C0100006C3100006C13000052534453F2E95D05102308498B56F79C5D2BC8A101000000433A5C55736572735C503132353442365C536F757263655C5265706F735C53514C434C522D4A616C616C692D446174652D5574696C6974795C53716C434C522E4A616C616C69446174655574696C6974795C6F626A5C44656275675C53716C434C522E4A616C616C69446174655574696C6974792E706462000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001001000000018000080000000000000000000000000000001000100000030000080000000000000000000000000000001000000000048000000584000008C02000000000000000000008C0234000000560053005F00560045005200530049004F004E005F0049004E0046004F0000000000BD04EFFE00000100000000000000000000000000000000003F000000000000000400000002000000000000000000000000000000440000000100560061007200460069006C00650049006E0066006F00000000002400040000005400720061006E0073006C006100740069006F006E00000000000000B004EC010000010053007400720069006E006700460069006C00650049006E0066006F000000C801000001003000300030003000300034006200300000002C0002000100460069006C0065004400650073006300720069007000740069006F006E000000000020000000300008000100460069006C006500560065007200730069006F006E000000000030002E0030002E0030002E00300000005A001D00010049006E007400650072006E0061006C004E0061006D0065000000530071006C0043004C0052002E004A0061006C0061006C00690044006100740065005500740069006C006900740079002E0064006C006C00000000002800020001004C006500670061006C0043006F00700079007200690067006800740000002000000062001D0001004F0072006900670069006E0061006C00460069006C0065006E0061006D0065000000530071006C0043004C0052002E004A0061006C0061006C00690044006100740065005500740069006C006900740079002E0064006C006C0000000000340008000100500072006F006400750063007400560065007200730069006F006E00000030002E0030002E0030002E003000000038000800010041007300730065006D0062006C0079002000560065007200730069006F006E00000030002E0030002E0030002E00300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000; 92 | 93 | 94 | GO 95 | ALTER ASSEMBLY [SqlCLR.JalaliDateUtility] 96 | DROP FILE ALL 97 | ADD FILE FROM 0x4D6963726F736F667420432F432B2B204D534620372E30300D0A1A4453000000000200000200000023000000B00000000000000021000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF38000000FCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0BCA3101380000000010000000100000000000001000FFFF04000000FFFF03000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000BCA3101380000000010000000100000000000001100FFFF04000000FFFF0300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000942E3101C9F3066001000000F2E95D05102308498B56F79C5D2BC8A100000000000000000100000001000000000000000000000000000000DC51330100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000BCA310138000000001000000010000000000000FFFFFFFF04000000FFFF030000000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000BCA310138000000001000000010000000000000FFFFFFFF04000000FFFF030000000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F862513FC607D311905300C04FA302A1C4454B99E9E6D211903F00C04FA302A10B9D865A1166D311BD2A0000F80849BD0FD02988B8111342878B770E8597AC162000000000000000732DB93BC4C034435786AC53ED4A41618AE3E42F47805EC2E55452298BA0503E000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F862513FC607D311905300C04FA302A1C4454B99E9E6D211903F00C04FA302A10B9D865A1166D311BD2A0000F80849BD0FD02988B8111342878B770E8597AC162000000000000000820D57E19110B281BB9A191D9958391EC159094982937744C3FEB26D48E9929B0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000610500000000000061050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FEEFFEEF010000007A01000000433A5C55736572735C503132353442365C536F757263655C5265706F735C53514C434C522D4A616C616C692D446174652D5574696C6974795C53716C434C522E4A616C616C69446174655574696C6974795C4A616C616C69446174655574696C6974792E63730000633A5C75736572735C703132353462365C736F757263655C7265706F735C73716C636C722D6A616C616C692D646174652D7574696C6974795C73716C636C722E6A616C616C69646174657574696C6974795C6A616C616C69646174657574696C6974792E637300433A5C55736572735C503132353442365C417070446174615C4C6F63616C5C54656D705C2E4E45544672616D65776F726B2C56657273696F6E3D76342E372E322E53716C436C72417474726962757465732E637300633A5C75736572735C703132353462365C617070646174615C6C6F63616C5C74656D705C2E6E65746672616D65776F726B2C76657273696F6E3D76342E372E322E73716C636C72617474726962757465732E63730007000000000000006800000000000000D00000000100000069000000250100000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001BE23001AC0000009C5D7BAB73EED601010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000400000001000000060000000000000025010000280000001BE23001154EAB0268000000D0000000680000002501000065000000000000000000000069000000280000001BE23001C00C36F2680000000100000068000000690000006500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000F400000008000000D000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000003A002A11000000000C02000000000000E3000000000000000000000001000006000000000100000000477265676F7269616E546F4A616C616C6900001600031104000000B8010000E300000000000000010000000A0024115553797374656D001A0024115553797374656D2E476C6F62616C697A6174696F6E0000001A0024115553797374656D2E446174612E53716C54797065730000001E002411554D6963726F736F66742E53716C5365727665722E53657276657200160020110000000001000011000000000000000070630000160003114000000080010000AE00000021000000010000001A0020110300000001000011000000000000000079656172000000001A002011040000000100001100000000000000006D6F6E74680000001E002011050000000100001100000000000000006461794F664D6F6E746800001E002011060000000100001100000000000000006461794F665765656B0000001A00201107000000010000110000000000000000726573756C740000020006001600031140000000B401000012000000CF0000000100000016002011080000000100001100000000000000006500000002000600020006004E000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040000000C000000010004000406000020000000014D020C16010180940180C80180FE01813E01817E0183610200060042002A1100000000200300000000000060000000000000000000000002000006E300000001000000004765744A616C616C6946697273744461794F664D6F6E74680000001600031110020000D802000060000000E3000000010000001600201100000000020000110000000000000000706300001600031154020000D40200003400000000010000010000001A0020110300000002000011000000000000000079656172000000001A002011040000000200001100000000000000006D6F6E7468000000020006000200060042000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C0000000100000604060000140000000159020C16010180A00180D40200060042002A110000000054040000000000006C0000000000000000000000030000064301000001000000004765744A616C616C694C6173744461794F664D6F6E7468000000001600031124030000080400006C00000043010000010000001600201100000000030000110000000000000000706300001600031168030000040400004000000060010000010000001A0020110300000003000011000000000000000079656172000000001A002011040000000300001100000000000000006D6F6E74680000001A002011050000000300001100000000000000006C61737444617900020006000200060046000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C0000000100000604060001180000000159020C16010180A00180D401810A00020006003A002A11000000009C0500000000000088000000000000000000000004000006AF01000001000000004A616C616C69546F477265676F7269616E000016000311580400004C05000088000000AF010000010000001A00201100000000040000110000000000000000706172747300000016002011010000000400001100000000000000007063000016000311940400004805000051000000D7010000010000001A0020110400000004000011000000000000000079656172000000001A002011050000000400001100000000000000006D6F6E746800000016002011060000000400001100000000000000006461790002000600020006004A000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C00000001000006040600021C000000015E018097020C16010180DE0181340181620000020006003A002A1100000000180600000000000049000000000000000000000005000006370200000100000000466F726D617444657369676E61746F720000003A000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C00000001000006040600020C000000160100000200060036002A1100000000900600000000000035000000000000000000000006000006800200000100000000466F726D61745965617273000000003A000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C00000001000006040600020C000000160100000200060036002A110000000008070000000000003E000000000000000000000007000006B50200000100000000466F726D61744D6F6E7468730000003A000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C00000001000006040600020C000000160100000200060032002A11000000007C070000000000003E000000000000000000000008000006F30200000100000000466F726D617444617973003A000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C00000001000006040600020C000000160100000200060036002A1100000000F40700000000000033000000000000000000000009000006310300000100000000466F726D61745365636F6E647300003A000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C00000001000006040600020C000000160100000200060036002A11000000006C080000000000005F00000000000000000000000A000006640300000100000000466F726D6174486F757273000000003A000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C00000001000006040600020C000000160100000200060036002A1100000000E4080000000000003300000000000000000000000B000006C30300000100000000466F726D61744D696E7574657300003A000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C00000001000006040600020C00000016010000020006003A002A110000000074090000000000007F00000000000000000000000C000006F603000001000000004765744A616C616C694461794E616D650000004E000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C000000010000060406000320000000020C160102520280990280DF0281270281720281BC000000020006003A002A1100000000100A000000000000EC00000000000000000000000D0000067504000001000000004765744A616C616C694D6F6E74684E616D65005A000404C93FEAC6B359D649BC250902BBABB460000000004D0044003200000004020000040100000C00000001000006040600002C000000020C160102460280810280B90280EF0281270281600281960281CD02820302823902827102000600F20000002C0100000000000001000100E3000000000000001700000020010000000000000D000080010000000E0000800C000000EEEFFE800F0000000F0000801B000000110000802100000014000080220000001500008030000000160000803F000000170000804E000000180000805D0000001A000080640000001C000080730000001D000080830000001E000080930000001F000080A300000021000080AD00000022000080B800000023000080C500000025000080CF00000027000080D100000028000080D200000029000080E10000002D0000800500060009002000000000000D0019000900280009000A000D0033000D0035000D003F000D003D000D001D000D003C000D003C000D003A000D003F000D0030000D0032000D0040000D001B0009001C0009000A000D00210005000600F2000000C0000000E30000000100010060000000000000000E000000B4000000000000003100008001000000320000800C000000EEEFFE800F0000003300008017000000350000801D000000380000801E000000390000802C0000003A0000803B0000003C000080510000003F0000805200000040000080530000004100008056000000430000805E000000450000800500060009002000000000000D0025000900280009000A000D0033000D0035000D003E0009001A0009000A0009000A000900210005000600F2000000CC00000043010000010001006C000000000000000F000000C00000000000000049000080010000004A0000800C000000EEEFFE800F0000004B000080170000004D0000801D000000500000801E000000510000802C000000520000803B0000005300008046000000550000805D000000580000805E000000590000805F0000005A000080620000005C0000806A0000005E0000800500060009002000000000000D0025000900280009000A000D0033000D0035000D003A000D00440009001A0009000A0009000A000900210005000600F2000000D8000000AF01000001000100880000000000000010000000CC0000000000000062000080010000006300008006000000EEEFFE80090000006400008011000000660000802200000068000080280000006B000080290000006C0000804D0000006D000080570000006E000080610000007000008079000000720000807A000000730000807B000000740000807E0000007600008086000000780000800500060009002500000000000D002500090036000900280009000A000D0055000D002D000D002B000D00400009001A0009000A0009000A000900210005000600F20000003C000000370200000100010049000000000000000300000030000000000000007F000080010000008000008247000000830000800500060009003C0005000600F20000003C00000080020000010001003500000000000000030000003000000000000000860000800100000087000082330000008A0000800500060009003D0005000600F20000003C000000B5020000010001003E000000000000000300000030000000000000008D000080010000008E0000833C000000920000800500060009002D0005000600F20000003C000000F3020000010001003E000000000000000300000030000000000000009500008001000000960000833C0000009A0000800500060009002B0005000600F20000003C000000310300000100010033000000000000000300000030000000000000009D000080010000009E00008231000000A1000080050006000900330005000600F20000003C00000064030000010001005F00000000000000030000003000000000000000A400008001000000A50000845D000000AA000080050006000900340005000600F20000003C000000C3030000010001003300000000000000030000003000000000000000AD00008001000000AE00008231000000B1000080050006000900340005000600F200000038010000F6030000010001007F00000000000000180000002C01000000000000B400008001000000B500008006000000EEEFFE8009000000B600008011000000B800008016000000EEEFFE8019000000B900008021000000BB00008026000000EEEFFE8029000000BC00008031000000BE00008037000000EEEFFE803B000000BF00008043000000C100008049000000EEEFFE804D000000C200008055000000C40000805B000000EEEFFE805F000000C500008067000000C70000806D000000EEEFFE8071000000C800008079000000CA0000807D000000CC0000800500060009002700000000000D001B0009002500000000000D001E0009002500000000000D001D0009002600000000000D001E0009002800000000000D001F0009002700000000000D001F0009002700000000000D001B000900150005000600F2000000EC0100007504000001000100EC0000000000000027000000E001000000000000CF00008001000000D000008006000000EEEFFE8009000000D100008014000000D300008019000000EEEFFE801C000000D400008027000000D60000802C000000EEEFFE802F000000D70000803A000000D900008040000000EEEFFE8044000000DA0000804F000000DC00008055000000EEEFFE8059000000DD00008064000000DF0000806A000000EEEFFE806E000000E000008076000000E20000807C000000EEEFFE8080000000E300008088000000E50000808E000000EEEFFE8092000000E60000809A000000E8000080A1000000EEEFFE80A5000000E9000080AD000000EB000080B4000000EEEFFE80B8000000EC000080C0000000EE000080C7000000EEEFFE80CB000000EF000080D3000000F1000080DA000000EEEFFE80DE000000F2000080E6000000F4000080EA000000F60000800500060009001800000000000D001E0009001800000000000D001F0009001800000000000D001C0009001800000000000D001A0009001800000000000D001C0009001800000000000D001D0009001800000000000D001A0009001800000000000D001B0009001800000000000D001A0009001900000000000D00190009001900000000000D001B0009001900000000000D001C000900150005000600F4000000080000000100000000000000680000000000000020000000380000006000000078000000A0000000B8000000D8000000F00000001001000028010000440100005C0100007801000090010000AC010000C4010000E0010000F8010000140200002C02000048020000600200008002000098020000BC0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFF1A092FF1D00000006C020000610000000100000049020000010000005D01000001000000A100000001000000810200000100000061020000010000002D02000001000000910100000100000021000000010000001502000001000000450100000100000029010000010000007901000001000000C501000001000000F100000001000000D900000001000000BD020000010000009902000001000000B9000000010000001101000001000000AD01000001000000E1010000010000000100000001000000F90100000100000079000000010000003900000001000000010400000000000000000000000000000000000000000000000000000000002001040000000000040000000000000000000000000000000000000000000000000000000000000100000000000000000001000000000000000000000000000000010400000000000000000000000000000000000000000000000000000000000001000000000000000000000000004000000000000000000000000000000000000100000000000000000000000000000000000000000000080002000000000000010400000000000000000000000000000000000000000000000410000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000008000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000002000000000000000000000000000000000000000000000000000000000000000C0000001800000024000000300000003C0000004800000054000000600000006C0000007800000084000000900000009C000000A8000000B4000000C0000000CC000000D8000000E4000000F0000000FC0000000801000014010000200100002C0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001E00251100000000040000000100477265676F7269616E546F4A616C616C690016002911000000000400000001003036303030303031000026002511000000001002000001004765744A616C616C6946697273744461794F664D6F6E7468000016002911000000001002000001003036303030303032000026002511000000002403000001004765744A616C616C694C6173744461794F664D6F6E74680000001600291100000000240300000100303630303030303300001E002511000000005804000001004A616C616C69546F477265676F7269616E001600291100000000580400000100303630303030303400001E00251100000000A00500000100466F726D617444657369676E61746F7200001600291100000000A00500000100303630303030303500001A002511000000001C0600000100466F726D6174596561727300000016002911000000001C0600000100303630303030303600001A00251100000000940600000100466F726D61744D6F6E74687300001600291100000000940600000100303630303030303700001A002511000000000C0700000100466F726D6174446179730000000016002911000000000C0700000100303630303030303800001A00251100000000800700000100466F726D61745365636F6E6473001600291100000000800700000100303630303030303900001A0025110000000010000000000000000000000000000000000000000000000000000000FFFFFFFF1A092FF10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F80700000100466F726D6174486F7572730000001600291100000000F80700000100303630303030306100001A00251100000000700800000100466F726D61744D696E75746573001600291100000000700800000100303630303030306200001E00251100000000E808000001004765744A616C616C694461794E616D6500001600291100000000E808000001003036303030303063000022002511000000007809000001004765744A616C616C694D6F6E74684E616D6500000000160029110000000078090000010030363030303030640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFF77093101010000000D000C8E0E00E6640F000200E0000000700100002C000000D0000000000000000000000016000000190000000000EEC00000000000000000FFFF000000000000FFFFFFFF00000000FFFF0000000000000000000000000C00140A000000000000D0080000010000000000000000000000000000004A616C616C69446174655574696C697479003044453635413641000000000000FFFF000000000000FFFFFFFF00000000FFFF0000000000000000000000000B00040000000000000010000000010000000000000000000000000000003C44616E676C696E67446F63756D656E74732A32323333343362642D613835392D343161332D393063302D3964666131303166316139353E0037464244413244320000002DBA2EF10100000000000000E30000000000000000000000000000000000000001000000E3000000600000000000000000000000000000000000000001000000430100006C0000000000000000000000000000000000000001000000AF0100008800000000000000000000000000000000000000010000003702000049000000000000000000000000000000000000000100000080020000350000000000000000000000000000000000000001000000B50200003E0000000000000000000000000000000000000001000000F30200003E000000000000000000000000000000000000000100000031030000330000000000000000000000000000000000000001000000640300005F0000000000000000000000000000000000000001000000C3030000330000000000000000000000000000000000000001000000F60300007F000000000000000000000000000000000000000100000075040000EC00000000000000000000000000000000000000020002000D01000000000100FFFFFFFF00000000610500000802000000000000FFFFFFFF00000000FFFFFFFF0200020000000100010001005500000000000000433A5C55736572735C503132353442365C417070446174615C4C6F63616C5C54656D705C2E4E45544672616D65776F726B2C56657273696F6E3D76342E372E322E53716C436C72417474726962757465732E637300433A5C55736572735C503132353442365C536F757263655C5265706F735C53514C434C522D4A616C616C692D446174652D5574696C6974795C53716C434C522E4A616C616C69446174655574696C6974795C4A616C616C69446174655574696C6974792E637300FEEFFEEF010000000100000000010000000000000000000000FFFFFFFFFFFFFFFFFFFF0A00FFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000942E3101C9F3066001000000F2E95D05102308498B56F79C5D2BC8A1F40000002F4C696E6B496E666F002F6E616D6573002F7372632F686561646572626C6F636B002F7372632F66696C65732F633A5C75736572735C703132353462365C736F757263655C7265706F735C73716C636C722D6A616C616C692D646174652D7574696C6974795C73716C636C722E6A616C616C69646174657574696C6974795C6A616C616C69646174657574696C6974792E6373002F7372632F66696C65732F633A5C75736572735C703132353462365C617070646174615C6C6F63616C5C74656D705C2E6E65746672616D65776F726B2C76657273696F6E3D76342E372E322E73716C636C72617474726962757465732E637300050000000A00000001000000E60000000000000011000000070000000000000005000000940000000900000022000000080000000A0000000600000000000000DC51330100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000200000005801000038000000BB0300003800000000000000AA010000AC00000068000000680000002800000018000000501300004C0300002C000000D4020000030000001F000000060000001D0000001E000000070000000B0000000C00000008000000090000000A0000000D0000000E0000000F000000100000001100000012000000130000001400000015000000160000001700000018000000190000001B0000001A0000001C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 AS N'SqlCLR.JalaliDateUtility.pdb'; 98 | 99 | 100 | GO 101 | PRINT N'Creating [dbo].[GetJalaliFirstDayOfMonth]...'; 102 | 103 | 104 | GO 105 | CREATE FUNCTION [dbo].[GetJalaliFirstDayOfMonth] 106 | (@dateTime DATETIME NULL) 107 | RETURNS DATETIME 108 | AS 109 | EXTERNAL NAME [SqlCLR.JalaliDateUtility].[JalaliDateUtility].[GetJalaliFirstDayOfMonth] 110 | 111 | 112 | GO 113 | PRINT N'Creating [dbo].[GetJalaliLastDayOfMonth]...'; 114 | 115 | 116 | GO 117 | CREATE FUNCTION [dbo].[GetJalaliLastDayOfMonth] 118 | (@dateTime DATETIME NULL) 119 | RETURNS DATETIME 120 | AS 121 | EXTERNAL NAME [SqlCLR.JalaliDateUtility].[JalaliDateUtility].[GetJalaliLastDayOfMonth] 122 | 123 | 124 | GO 125 | PRINT N'Creating [dbo].[GregorianToJalali]...'; 126 | 127 | 128 | GO 129 | CREATE FUNCTION [dbo].[GregorianToJalali] 130 | (@dateTime DATETIME NULL, @format NVARCHAR (MAX) NULL) 131 | RETURNS NVARCHAR (MAX) 132 | AS 133 | EXTERNAL NAME [SqlCLR.JalaliDateUtility].[JalaliDateUtility].[GregorianToJalali] 134 | 135 | 136 | GO 137 | PRINT N'Creating [dbo].[JalaliToGregorian]...'; 138 | 139 | 140 | GO 141 | CREATE FUNCTION [dbo].[JalaliToGregorian] 142 | (@perisanDateTime NVARCHAR (MAX) NULL, @seperator NCHAR (1) NULL) 143 | RETURNS DATETIME 144 | AS 145 | EXTERNAL NAME [SqlCLR.JalaliDateUtility].[JalaliDateUtility].[JalaliToGregorian] 146 | 147 | 148 | GO 149 | PRINT N'Update complete.'; 150 | 151 | GO 152 | select dbo.GregorianToJalali(GETDATE(),'yy') 153 | 154 | select dbo.GregorianToJalali(GETDATE(),'yy-MM') 155 | 156 | select dbo.GregorianToJalali(GETDATE(),'yyyy/MM/dd hh:mm') 157 | 158 | select dbo.GregorianToJalali(GETDATE(),'yyyy/M/d hh:mm tt') 159 | 160 | select dbo.GregorianToJalali(GETDATE(),'yyyy-M-d HH:mm') 161 | 162 | select dbo.GregorianToJalali(GETDATE(),'MMMM dddd') 163 | 164 | select dbo.GregorianToJalali(GETDATE(),'yy MMMM dddd') 165 | GO 166 | -------------------------------------------------------------------------------- /SqlCLR.JalaliDateUtility/JalaliDateUtility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Data.SqlTypes; 4 | using Microsoft.SqlServer.Server; 5 | 6 | 7 | public class JalaliDateUtility 8 | { 9 | #region SQL Functions 10 | 11 | [SqlFunction(DataAccess = DataAccessKind.None)] 12 | public static SqlString GregorianToJalali(DateTime? dateTime, string format) 13 | { 14 | if (!dateTime.HasValue) 15 | return null; 16 | 17 | var pc = new PersianCalendar(); 18 | 19 | try 20 | { 21 | var year = pc.GetYear(dateTime.Value); 22 | var month = pc.GetMonth(dateTime.Value); 23 | var dayOfMonth = pc.GetDayOfMonth(dateTime.Value); 24 | var dayOfWeek = pc.GetDayOfWeek(dateTime.Value); 25 | 26 | var result = ""; 27 | 28 | result = FormatSeconds(format, dateTime.Value); 29 | result = FormatMinutes(result, dateTime.Value); 30 | result = FormatHours(result, dateTime.Value); 31 | result = FormatDesignator(result, dateTime.Value); 32 | 33 | result = FormatYears(result, year); 34 | result = FormatMonths(result, month); 35 | result = FormatDays(result, dayOfMonth, dayOfWeek); 36 | 37 | return result; 38 | } 39 | catch (Exception e) 40 | { 41 | return e.ToString(); 42 | } 43 | 44 | return null; 45 | } 46 | 47 | [SqlFunction(DataAccess = DataAccessKind.None)] 48 | public static SqlDateTime GetJalaliFirstDayOfMonth(DateTime? dateTime) 49 | { 50 | if (!dateTime.HasValue) 51 | return SqlDateTime.Null; 52 | 53 | var pc = new PersianCalendar(); 54 | 55 | try 56 | { 57 | var year = pc.GetYear(dateTime.Value); 58 | var month = pc.GetMonth(dateTime.Value); 59 | 60 | return pc.ToDateTime(year, month, 1, 0, 0, 0, 0); 61 | 62 | } 63 | catch (Exception) 64 | { 65 | } 66 | 67 | return SqlDateTime.Null; 68 | 69 | } 70 | 71 | [SqlFunction(DataAccess = DataAccessKind.None)] 72 | public static SqlDateTime GetJalaliLastDayOfMonth(DateTime? dateTime) 73 | { 74 | if (!dateTime.HasValue) 75 | return SqlDateTime.Null; 76 | 77 | var pc = new PersianCalendar(); 78 | 79 | try 80 | { 81 | var year = pc.GetYear(dateTime.Value); 82 | var month = pc.GetMonth(dateTime.Value); 83 | var lastDay = pc.GetDaysInMonth(year, month); 84 | 85 | return pc.ToDateTime(year, month, lastDay, 0, 0, 0, 0); 86 | 87 | } 88 | catch (Exception) 89 | { 90 | } 91 | 92 | return SqlDateTime.Null; 93 | 94 | } 95 | 96 | [SqlFunction(DataAccess = DataAccessKind.None)] 97 | public static SqlDateTime JalaliToGregorian(string perisanDateTime, char seperator) 98 | { 99 | if (perisanDateTime == null) 100 | return SqlDateTime.Null; 101 | 102 | var parts = perisanDateTime.Split(seperator); 103 | 104 | var pc = new PersianCalendar(); 105 | 106 | try 107 | { 108 | var year = int.Parse(parts[0].Length == 2 ? "13" + parts[0] : parts[0]); 109 | var month = int.Parse(parts[1]); 110 | var day = int.Parse(parts[2]); 111 | 112 | return pc.ToDateTime(year, month, day, 0, 0, 0, 0); 113 | } 114 | catch (Exception) 115 | { 116 | } 117 | 118 | return SqlDateTime.Null; 119 | 120 | } 121 | 122 | #endregion 123 | 124 | #region Private Functions 125 | 126 | private static string FormatDesignator(string input, DateTime dateTime) 127 | { 128 | return input 129 | .Replace("tt", dateTime.Hour >= 12 ? "ب ظ" : "ق ظ") 130 | .Replace("t", dateTime.Hour >= 12 ? "ب" : "ق"); 131 | } 132 | 133 | private static string FormatYears(string input, int year) 134 | { 135 | return input 136 | .Replace("yyyy", year.ToString("D4")) 137 | .Replace("yy", year.ToString().Substring(2, 2)); 138 | } 139 | 140 | private static string FormatMonths(string input, int month) 141 | { 142 | return input 143 | .Replace("MMMM", GetJalaliMonthName(month)) 144 | .Replace("MM", month.ToString("D2")) 145 | .Replace("M", month.ToString()); 146 | } 147 | 148 | private static string FormatDays(string input, int day, DayOfWeek dayOfWeek) 149 | { 150 | return input 151 | .Replace("dddd", GetJalaliDayName(dayOfWeek)) 152 | .Replace("dd", day.ToString("D2")) 153 | .Replace("d", day.ToString()); 154 | } 155 | 156 | public static string FormatSeconds(string input, DateTime dateTime) 157 | { 158 | return input 159 | .Replace("ss", dateTime.ToString("ss")) 160 | .Replace("s", dateTime.ToString("s")); 161 | } 162 | 163 | public static string FormatHours(string input, DateTime dateTime) 164 | { 165 | return input 166 | .Replace("hh", dateTime.ToString("hh")) 167 | .Replace("h", dateTime.ToString("%h")) 168 | .Replace("HH", dateTime.ToString("HH")) 169 | .Replace("H", dateTime.ToString("%H")); 170 | } 171 | 172 | public static string FormatMinutes(string input, DateTime dateTime) 173 | { 174 | return input 175 | .Replace("mm", dateTime.ToString("mm")) 176 | .Replace("m", dateTime.ToString("%m")); 177 | } 178 | 179 | private static string GetJalaliDayName(DayOfWeek day) 180 | { 181 | if (day == DayOfWeek.Saturday) 182 | return "شنبه"; 183 | 184 | if (day == DayOfWeek.Sunday) 185 | return "یک شنبه"; 186 | 187 | if (day == DayOfWeek.Monday) 188 | return "دوشنبه"; 189 | 190 | if (day == DayOfWeek.Tuesday) 191 | return "سه شنبه"; 192 | 193 | if (day == DayOfWeek.Wednesday) 194 | return "چهارشنبه"; 195 | 196 | if (day == DayOfWeek.Thursday) 197 | return "پنج شنبه"; 198 | 199 | if (day == DayOfWeek.Thursday) 200 | return "جمعه"; 201 | 202 | return null; 203 | 204 | } 205 | 206 | private static string GetJalaliMonthName(int month) 207 | { 208 | if (month == 1) 209 | return "فروردین"; 210 | 211 | if (month == 2) 212 | return "اردیبهشت"; 213 | 214 | if (month == 3) 215 | return "خرداد"; 216 | 217 | if (month == 4) 218 | return "تیر"; 219 | 220 | if (month == 5) 221 | return "مرداد"; 222 | 223 | if (month == 6) 224 | return "شهریور"; 225 | 226 | if (month == 7) 227 | return "مهر"; 228 | 229 | if (month == 8) 230 | return "آبان"; 231 | 232 | if (month == 9) 233 | return "آذر"; 234 | 235 | if (month == 10) 236 | return "دی"; 237 | 238 | if (month == 11) 239 | return "بهمن"; 240 | 241 | if (month == 12) 242 | return "اسفند"; 243 | 244 | return null; 245 | 246 | } 247 | 248 | #endregion 249 | } 250 | -------------------------------------------------------------------------------- /SqlCLR.JalaliDateUtility/Sohato.SqlCLR.jfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirsaeedi/SQLCLR-Jalali-Date-Utility/a497a7d237cbcae309c1795b1faf629c3bf9a3a3/SqlCLR.JalaliDateUtility/Sohato.SqlCLR.jfm -------------------------------------------------------------------------------- /SqlCLR.JalaliDateUtility/SqlCLR.JalaliDateUtility.jfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirsaeedi/SQLCLR-Jalali-Date-Utility/a497a7d237cbcae309c1795b1faf629c3bf9a3a3/SqlCLR.JalaliDateUtility/SqlCLR.JalaliDateUtility.jfm -------------------------------------------------------------------------------- /SqlCLR.JalaliDateUtility/SqlCLR.JalaliDateUtility.sqlproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | SqlCLR.JalaliDateUtility 8 | 2.0 9 | 4.1 10 | {c078ae9b-f978-44bc-ac3d-1a6705a8098c} 11 | Microsoft.Data.Tools.Schema.Sql.Sql130DatabaseSchemaProvider 12 | Database 13 | 14 | 15 | SqlCLR.JalaliDateUtility 16 | SqlCLR.JalaliDateUtility 17 | 1033,CI 18 | BySchemaAndSchemaType 19 | True 20 | v4.7.2 21 | CS 22 | Properties 23 | False 24 | True 25 | True 26 | SQL_Latin1_General_CP1_CI_AS 27 | PRIMARY 28 | 29 | SqlCLR.JalaliDateUtility 30 | True 31 | 32 | 33 | bin\Release\ 34 | $(MSBuildProjectName).sql 35 | False 36 | pdbonly 37 | true 38 | false 39 | true 40 | prompt 41 | 4 42 | 43 | 44 | bin\Debug\ 45 | $(MSBuildProjectName).sql 46 | false 47 | true 48 | full 49 | false 50 | true 51 | true 52 | prompt 53 | 4 54 | x64 55 | SqlCLR 56 | 57 | 58 | 11.0 59 | 60 | True 61 | 11.0 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /SqlCLR.JalaliDateUtility/TestScripts/Test.sql: -------------------------------------------------------------------------------- 1 | select dbo.GregorianToJalali(GETDATE(),'yy') 2 | 3 | select dbo.GregorianToJalali(GETDATE(),'yy-MM') 4 | 5 | select dbo.GregorianToJalali(GETDATE(),'yyyy/MM/dd hh:mm') 6 | 7 | select dbo.GregorianToJalali(GETDATE(),'yyyy/M/d hh:mm tt') 8 | 9 | select dbo.GregorianToJalali(GETDATE(),'yyyy-M-d HH:mm') 10 | 11 | select dbo.GregorianToJalali(GETDATE(),'MMMM dddd') 12 | 13 | select dbo.GregorianToJalali(GETDATE(),'yy MMMM dddd') --------------------------------------------------------------------------------