PersianAssistant 2.1.1

dotnet add package PersianAssistant --version 2.1.1
                    
NuGet\Install-Package PersianAssistant -Version 2.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PersianAssistant" Version="2.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PersianAssistant" Version="2.1.1" />
                    
Directory.Packages.props
<PackageReference Include="PersianAssistant" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PersianAssistant --version 2.1.1
                    
#r "nuget: PersianAssistant, 2.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PersianAssistant@2.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PersianAssistant&version=2.1.1
                    
Install as a Cake Addin
#tool nuget:?package=PersianAssistant&version=2.1.1
                    
Install as a Cake Tool

This asistant helps PERSIAN developers...

We have lots of conversions in this package that are explained in blow :

CurrencyExtension:

It has some methods that convert number to Persian currency type.

example :

1000.Rial() ==> 1,000 ریال
1000.Toman() ==> 1,000 تومان

DateExtension:

It's convert date to persianDate or vice versa... Methods:

ToPersianDate(DateTime value) 
ToPersianDateTime(DateTime value)
DayOfWeekPersianTitle(DayOfWeek day) // example : DayOfWeekPersianTitle(DayOfWeek.Saturday) ==> "شنبه"
DayOfWeekPersianIndex(DayOfWeek day) // example : DayOfWeekPersianIndex(DayOfWeek.Saturday) ==> 1
PersianDayTitleByIndex(int index) // example : PersianDayTitleByIndex(1) ==> "شنبه"
PersianDaysDropDown()
IsPersianDayValidInMonth(int month, int day) // check valid day number in month
PersianMonthTitleByIndex(int month) // example : PersianMonthTitleByIndex(1) ==> "فروردین"
PersianDateToDate(string dateStr) // convert persian date to valid date 
PersianDateToDateTime(string dateStr)
StartAndEndOfMonth(DateTime dateTime)
BeginEndOfMonthAsPersian(DateTime dateTime)
GetPersianYear(DateTime value)
GetPersianDay(DateTime value)
GetPersianMonth(DateTime value)
GetYearList(int from, int to) // as persian year 
GetMonthList() // as number 
GetDayList() // as number 
GetDateInfo(DateTime? enterDate) // ==> شنبه 21 شهریور 1402
NotificationDateTimeStringFormat(DateTime dateTime) // one signal date format 

NumberExtension

This method workes with number :

ToIranMobileNumber(string mobileNumber) // => 09121112233
ToEnglishNumber(string number) // example : ToEnglishNumber("١") ==> 1
ToPersianNumber(string number) // example : ToEnglishNumber("1") ==> ١
GenerateCode(int length) // generate random code by length
CheckIranNationalCode(string nationalCode)
IsDigitsOnly(string str)
NumberDropDown(int val) // get list from 1 to your val
Round1000(double? val) // example : Round1000(15999) ==> 16000

PasswordExtensions

It is the most valuable extension for hashing password with salt :

GeneratePasswordSalt(int length) // at first you must generate salt by your length.
EncodePassword(string pass, string salt) // after creating salt you must encode your password.

PageExtension

It's for paging and return PageModel :

Paging(this int pageId, int count , int take) 

public class PageModel
    {
        public int Skip { get; set; }
        public int PageCount { get; set; }
        public int Take { get; set; }
    }

GenderExtension

It's for user gender in persian :

GetGenderVal(int value) // ==> مرد / زن
GetGenderId(string value) // ==> 1 , 2
GenderList()

ResponseManager

It's a good response for your api or any other methods that are return json :

SessionExpire(string error) // errorId = -21
DataError(string title) // errorId = -2
FillObject(dynamic obj) // errorId = 0 , it's a success method , you can pass any object.
CustomResponse(int id, string title, dynamic res) // with this method you can create your custom response and errorId.

TimeExtension

This method works with time :

ToTime(DateTime time)
ToIntTime(this DateTime time) // return array from hour and minute
TimeDifference(DateTime dateTime, int difference)

StatusExtension

It's for user status :

StatusList()
GetStatusVal(int value) // example : GetStatusVal(1) ==> فعال

OtherExtensions

KafYePersian(string input) // convert  ک و ی arabic to persian
IsValidEmail(string email)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.1 218 6/20/2026
2.1.0 1,364 12/24/2024
2.0.0 1,699 12/24/2023
1.0.0 209 12/18/2023