예제 #1
0
        private void BeginInvoke(HttpContext context)
        {
            var persianCulture = new PersianCulture();

            Thread.CurrentThread.CurrentCulture   = persianCulture;
            Thread.CurrentThread.CurrentUICulture = persianCulture;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IdentifyCulture.cultureName().Contains("fa"))
            {
                var persianCulture = new PersianCulture();
                Thread.CurrentThread.CurrentCulture   = persianCulture;
                Thread.CurrentThread.CurrentUICulture = persianCulture;
            }
            if (!Page.IsPostBack)
            {
                rptOrdersBind();

                if (Request.QueryString["Fail"] != null)
                {
                    pnlError.Visible = true;
                }
                else
                {
                    pnlError.Visible = false;
                }

                if (Request.QueryString["Confirm"] != null)
                {
                    pnlSuccess.Visible = true;
                    lblSaleRefID.Text  = Request.QueryString["Confirm"];
                }
                else
                {
                    pnlSuccess.Visible = false;
                }
            }
        }
예제 #3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var persianCulture = new PersianCulture();

            Thread.CurrentThread.CurrentCulture   = persianCulture;
            Thread.CurrentThread.CurrentUICulture = persianCulture;
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["OID"] != null && Request.QueryString["UID"] != null)
            {
                if (IdentifyCulture.cultureName().Contains("fa"))
                {
                    var persianCulture = new PersianCulture();
                    Thread.CurrentThread.CurrentCulture   = persianCulture;
                    Thread.CurrentThread.CurrentUICulture = persianCulture;
                }
                Guid OrderID = new Guid(Request.QueryString["OID"]);
                Guid UserID  = new Guid(Request.QueryString["UID"]);

                if (ValidateUser(UserID, OrderID) == true)
                {
                    //if (IsFinlizedOrder(OrderID) == false)
                    //{
                    //CreatePDFFactor();
                    //}
                    //Panel1.Visible = false;
                    FinlizeOrder(OrderID);
                    List <string> PriceAndOrderID = ReturnPaymentLogID(OrderID);
                    PayRequest(PriceAndOrderID[0], PriceAndOrderID[1]);
                }
                else
                {
                    pnlError.Visible = true;
                }
            }
            else
            {
                pnlError.Visible = true;
            }
        }
예제 #5
0
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            var persianCulture = new PersianCulture();

            Thread.CurrentThread.CurrentCulture   = persianCulture;
            Thread.CurrentThread.CurrentUICulture = persianCulture;
        }
예제 #6
0
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            var persianCulture = new PersianCulture();

            Thread.CurrentThread.CurrentCulture   = persianCulture;
            Thread.CurrentThread.CurrentUICulture = persianCulture;

            //HttpContext context = HttpContext.Current;
            //context.Response.Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress);
            //HttpContext.Current.Response.AppendHeader("Content-encoding", "gzip");
            //HttpContext.Current.Response.Cache.VaryByHeaders["Accept-encoding"] = true;

            if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://www.varanegar.com/services/education"))
            {
                HttpContext.Current.Response.Status = "301 Moved Permanently";
                Response.StatusCode = 301;
                HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower().Replace("http://www.varanegar.com/services/education", "http://www.varanegar.com/Services/training"));
                Response.End();
            }
            else if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://www.varanegar.com/products-and-solutions/distribution-and-sales-software"))
            {
                HttpContext.Current.Response.Status = "301 Moved Permanently";
                Response.StatusCode = 301;
                HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower().Replace("http://www.varanegar.com/products-and-solutions/distribution-and-sales-software", "http://www.varanegar.com/Product/sales-and-distribution-software"));
                Response.End();
            }
        }
예제 #7
0
        protected override void InitializeCulture()
        {
            string lang    = Convert.ToString(Session["lang"]);
            string culture = string.Empty;

            if (lang.ToLower().CompareTo("fa") == 0 || string.IsNullOrEmpty(lang))
            {
                culture = "fa-IR";

                var persianCulture = new PersianCulture();
                Thread.CurrentThread.CurrentCulture   = persianCulture;
                Thread.CurrentThread.CurrentUICulture = persianCulture;
            }
            if (lang.ToLower().CompareTo("en") == 0)
            {
                culture = "en-US";
            }
            if (lang.ToLower().CompareTo("ru") == 0)
            {
                culture = "ru-RU";
            }
            if (lang.ToLower().CompareTo("zh") == 0)
            {
                culture = "zh-CN";
            }
            Thread.CurrentThread.CurrentCulture   = CultureInfo.CreateSpecificCulture(culture);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);

            base.InitializeCulture();
        }
예제 #8
0
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            var persianCulture = new  PersianCulture();

            Thread.CurrentThread.CurrentCulture   = persianCulture;
            Thread.CurrentThread.CurrentUICulture = persianCulture;
            persianCulture.NumberFormat.NumberDecimalSeparator = ".";
            persianCulture.NumberFormat.CurrencySymbol         = "";
            persianCulture.NumberFormat.CurrencyDecimalDigits  = 0;
        }
예제 #9
0
        protected void Application_Start()
        {
            var persianCulture = new PersianCulture();

            Thread.CurrentThread.CurrentCulture   = persianCulture;
            Thread.CurrentThread.CurrentUICulture = persianCulture;

            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }
예제 #10
0
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            var persianCulture = new PersianCulture();

            persianCulture.DateTimeFormat.ShortDatePattern = "yyyy/MM/dd";
            persianCulture.DateTimeFormat.LongDatePattern  = "dddd d MMMM yyyy";
            persianCulture.DateTimeFormat.AMDesignator     = "صبح";
            persianCulture.DateTimeFormat.PMDesignator     = "عصر";
            Thread.CurrentThread.CurrentCulture            = persianCulture;
            Thread.CurrentThread.CurrentUICulture          = persianCulture;
        }
        /// <summary>
        /// نمایش فارسی روز دریافتی شمسی
        /// مانند سه شنبه ۲۱ دی ۱۳۹۵
        /// </summary>
        public static string ToPersianDateTextify(int persianYear, int persianMonth, int persianDay)
        {
            if (persianYear <= 99)
            {
                persianYear += 1300;
            }

            var strDay   = PersianCulture.GetPersianWeekDayName(persianYear, persianMonth, persianDay);
            var strMonth = PersianCulture.PersianMonthNames[persianMonth];

            return($"{strDay} {persianDay} {strMonth} {persianYear}".ToPersianNumbers());
        }
예제 #12
0
        protected override void Initialize(HttpControllerContext controllerContext)
        {
            //System.Globalization.CultureInfo oCultureInfo =
            //    new System.Globalization.CultureInfo("fa-IR");
            //System.Threading.Thread.CurrentThread.CurrentCulture = oCultureInfo;
            //System.Threading.Thread.CurrentThread.CurrentUICulture = oCultureInfo;
            var persianCulture = new PersianCulture();

            Thread.CurrentThread.CurrentCulture   = persianCulture;
            Thread.CurrentThread.CurrentUICulture = persianCulture;
            base.Initialize(controllerContext);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //UpdateAlienImages();
            //  HttpCookie cookie = Request.Cookies["CurrentLanguage"];
            if (IdentifyCulture.cultureName().Contains("fa"))
            {
                var persianCulture = new PersianCulture();
                Thread.CurrentThread.CurrentCulture = persianCulture;
                Thread.CurrentThread.CurrentUICulture = persianCulture;
                imglogo.ImageUrl = "~/images/Logo2.png";
                imgSh.ImageUrl = "~/images/Shoar.png";

                const string styleFormat =
            "<LINK href=\"{0}\" type=\"text/css\" rel=\"stylesheet\">";

                string linkText;
                linkText = String.Format(styleFormat, StyleSheetPathFa);
                StyleSheet.Text = linkText;
            }
            else
            {
                imglogo.ImageUrl = "~/images/Logo-eng.png";
                imgSh.ImageUrl = "~/images/Shor-Eng.png";

                const string styleFormat =
               "<LINK href=\"{0}\" type=\"text/css\" rel=\"stylesheet\">";

                string linkText;
                linkText = String.Format(styleFormat, StyleSheetPath);
                StyleSheet.Text = linkText;

            }
            if (!Page.IsPostBack)
            {
                ChooseTitleAndDesc();
                rptProductGroupBind();
                OrderLoad();
                rptRecentProductsBind();
                rptLinksBind();

                rptBlogsBind();
                rptSliderBind();
                rptMiddelTextBind();
                rptBuyingManualBind();
                rptMainProductGroupBind();
                rptTextBind();
                PaymentBtnAddress();

                //UpdatePaymentDate();
            }
        }
예제 #14
0
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            var persianCulture = new PersianCulture();

            Thread.CurrentThread.CurrentCulture   = persianCulture;
            Thread.CurrentThread.CurrentUICulture = persianCulture;

            string urlSite = "http://www.mashadcarpet.com";

            if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://mashadcarpet.com"))
            {
                HttpContext.Current.Response.Status = "301 Moved Permanently"; Response.StatusCode = 301;
                HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower().Replace("http://mashadcarpet.com", "http://www.mashadcarpet.com"));
            }

            RedirectingPages(urlSite + "/about.aspx", urlSite + "/about-us");


            RedirectingPages(urlSite + "/ProductsSearch.aspx", urlSite + "/carpet-online-shopping");
            RedirectingPages(urlSite + "/Products.aspx", urlSite + "/carpet-online-shopping");
            RedirectingPages(urlSite + "/ShopList.aspx", urlSite + "/carpet-online-shopping");
            RedirectingPages(urlSite + "/ProductsList.aspx", urlSite + "/carpet-online-shopping");
            RedirectingPages(urlSite + "/ShopDetail.aspx", urlSite + "/carpet-online-shopping");
            RedirectingPages(urlSite + "/ProductDetail.aspx", urlSite + "/carpet-online-shopping");
            RedirectingPages(urlSite + "/ShopDetail.aspx", urlSite + "/carpet-online-shopping");

            RedirectingPages(urlSite + "/Social.aspx", urlSite + "/corporate-social-responsibility");

            RedirectingPages(urlSite + "/News.aspx", urlSite + "/Blog/all");
            RedirectingPages(urlSite + "/NewsShow.aspx", urlSite + "/Blog/all");

            RedirectingPages(urlSite + "/Contact.aspx", urlSite + "/Contact-us");
            RedirectingPages(urlSite + "/FormOffer.aspx", urlSite + "/Contact-us");
            RedirectingPages(urlSite + "/FAQ.aspx", urlSite + "/Contact-us");
            //diffrent from babak files
            RedirectingPages(urlSite + "/ContactIran.aspx", urlSite + "/Sales-Representatives");

            RedirectingPages(urlSite + "/StoreList.aspx", urlSite + "/Sales-Representatives");
            RedirectingPages(urlSite + "/ShopUserPanel.aspx", urlSite + "/login");
            RedirectingPages(urlSite + "/ShopOrder.aspx", urlSite + "/login");
            RedirectingPages(urlSite + "/ShopBasket.aspx", urlSite + "/login");
            RedirectingPages(urlSite + "/login.aspx", urlSite + "/login");
            RedirectingPages(urlSite + "/LostPass.aspx", urlSite + "/login");

            RedirectingPages(urlSite + "/ShopOrder.aspx", urlSite + "/login");
            RedirectingPages(urlSite + "/ShopBasket.aspx", urlSite + "/login");
            RedirectingPages(urlSite + "/login.aspx", urlSite + "/login");
        }
예제 #15
0
    public static void ChangCulter(CulterType cu)
    {
        switch (cu)
        {
        case CulterType.en:
            CultureInfo CU = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentCulture   = CU;
            Thread.CurrentThread.CurrentUICulture = CU;
            break;

        case CulterType.fa:
            PersianCulture PC = new PersianCulture();
            Thread.CurrentThread.CurrentCulture   = PC;
            Thread.CurrentThread.CurrentUICulture = PC;
            break;
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IdentifyCulture.cultureName().Contains("fa"))
            {
                var persianCulture = new PersianCulture();
                Thread.CurrentThread.CurrentCulture   = persianCulture;
                Thread.CurrentThread.CurrentUICulture = persianCulture;

                ScriptManager.RegisterStartupScript(this, GetType(), "PageScriptfa",
                                                    "$('.newfa').removeClass('fa-arrow-right'); $('.newfa').addClass('fa-arrow-left');", true);
            }
            if (!Page.IsPostBack)
            {
                LoadLabels();
                CreatePDFFactor();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IdentifyCulture.cultureName().Contains("fa"))
            {
                var persianCulture = new PersianCulture();
                Thread.CurrentThread.CurrentCulture   = persianCulture;
                Thread.CurrentThread.CurrentUICulture = persianCulture;
                ScriptManager.RegisterStartupScript(this, GetType(), "PageScriptfa",
                                                    "$('.newfa').removeClass('fa-arrow-right'); $('.newfa').addClass('fa-arrow-left');", true);
            }


            if (!Page.IsPostBack)
            {
                FindBlog();
                rptPopularBlogsBind();
                rptLatestBlogsBind();
                rptBlogGroupBind();
                rptRelatedBlogsBind();
                ChooseTitleAndDesc();
            }
        }
예제 #18
0
 /// <summary>
 /// format datetime
 /// </summary>
 /// <param name="dateTime"></param>
 /// <returns></returns>
 public static string FormatDate(DateTime dateTime)
 {
     return($"{dateTime.ToPersianYearMonthDay().Day.ToPersianNumbers()}م {PersianCulture.GetPersianMonthName(dateTime.ToPersianYearMonthDay().Month)} {dateTime.ToPersianYearMonthDay().Year.ToPersianNumbers()}");
 }
예제 #19
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              IActionDescriptorCollectionProvider actionDescriptorCollectionProvider,
                              DataSeeder seeder,
                              IApplicationLifetime lifetime)
        {
            // Setting Persian culture
            var culture             = new PersianCulture();
            var localizationOptions = new RequestLocalizationOptions
            {
                SupportedCultures = new List <CultureInfo>
                {
                    culture
                },
                SupportedUICultures = new List <CultureInfo>
                {
                    culture
                },
                DefaultRequestCulture      = new RequestCulture(culture),
                FallBackToParentCultures   = false,
                FallBackToParentUICultures = false,
                RequestCultureProviders    = null
            };

            app.UseRequestLocalization(localizationOptions);

            // Custom exception handling
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                //app.UseExceptionHandler("/Home/Error");
                //app.UseHsts();
            }

            // MVC
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseAuthentication();
            app.UseSession();

            // This is used to get httpContext in extension or static methods
            HttpContext.Configure(app.ApplicationServices.GetRequiredService <Microsoft.AspNetCore.Http.IHttpContextAccessor>());

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            seeder.SeedAsync().Wait();

            // Routing
            var routeBuilder     = new RouteBuilder(app);
            var middleWareRoutes = routeBuilder.Build();

            app.UseRouter(middleWareRoutes);
        }
예제 #20
0
        private void FillData(string StartDate, string EndDate, string ListOfProductionLines)
        {
            try
            {
                Array.Clear(LastApprochmentInfo, 0, LastApprochmentInfo.Length);
                this.Cursor = Cursors.WaitCursor;

                this.radScheduler1.Appointments.Clear();

                radScheduler1.Resources.Clear();

                var persianCulture = new PersianCulture();
                System.Threading.Thread.CurrentThread.CurrentCulture   = persianCulture;
                System.Threading.Thread.CurrentThread.CurrentUICulture = persianCulture;
                SchedulerNavigatorLocalizationProvider.CurrentProvider = new CustomSchedulerNavigatorLocalizationProvider();

                Color[] colors = new Color[]
                {
                    Color.LightBlue, Color.LightBlue, Color.LightBlue,
                    Color.LightBlue, Color.LightBlue, Color.LightBlue, Color.LightBlue, Color.LightBlue, Color.LightBlue
                };


                if (LSTProrudtionLines1.CheckedItems.Count > 1)
                {
                    BLL.Cls_PublicOperations.Dt = BllDeviceLine.GetAllResourceForShowSummeryCurrentState(ListOfProductionLines);

                    for (int i = 0; i < BLL.Cls_PublicOperations.Dt.DefaultView.Count; i++)
                    {
                        Resource resource = new Resource();
                        resource.Id    = new EventId(BLL.Cls_PublicOperations.Dt.DefaultView[i]["ProductLineId"].ToString());
                        resource.Name  = BLL.Cls_PublicOperations.Dt.DefaultView[i]["GroupShowName"].ToString();
                        resource.Color = colors[rand.Next(0, 8)];
                        this.radScheduler1.Resources.Add(resource);
                        LastApprochmentInfo[i, 0] = BLL.Cls_PublicOperations.Dt.DefaultView[i]["ProductLineId"].ToString();
                    }
                }
                else
                {
                    BLL.Cls_PublicOperations.Dt = BllDeviceLine.GetDeviceLineByProductLineId(LSTProrudtionLines1.CheckedItems[0].Value.ToString());

                    for (int i = 0; i < BLL.Cls_PublicOperations.Dt.Rows.Count; i++)
                    {
                        Resource resource = new Resource();
                        resource.Id    = new EventId(BLL.Cls_PublicOperations.Dt.DefaultView[i]["id"].ToString());
                        resource.Name  = BLL.Cls_PublicOperations.Dt.DefaultView[i]["LineDesc"].ToString();
                        resource.Color = colors[0];

                        this.radScheduler1.Resources.Add(resource);

                        LastApprochmentInfo[i, 0] = BLL.Cls_PublicOperations.Dt.DefaultView[i]["id"].ToString();
                    }
                }



                BLL.Cls_PublicOperations.Dt = BllClient.GetAllClientData(StartDate, EndDate, ListOfProductionLines);

                int totalHours;

                for (int i = 0; i < BLL.Cls_PublicOperations.Dt.DefaultView.Count; i++)
                {
                    this.radScheduler1.Backgrounds.Add(new AppointmentBackgroundInfo(this.radScheduler1.Backgrounds.Count + 1, "test", Color.FromArgb(Convert.ToInt32(BLL.Cls_PublicOperations.Dt.DefaultView[i]["color"].ToString()))));

                    totalHours = 0;

                    totalHours = Convert.ToInt32(BLL.Cls_PublicOperations.Dt.DefaultView[i]["duration"].ToString()); // (DateTime.Parse(dt.DefaultView[i]["MiladiFinishDateTime"].ToString()) - DateTime.Parse(dt.DefaultView[i]["MiladiStartDateTime"].ToString())).TotalSeconds;

                    DateTime Start = new DateTime();
                    DateTime end   = new DateTime();
                    Start = DateTime.Parse(BLL.Cls_PublicOperations.Dt.DefaultView[i]["MiladiStartDateTime"].ToString());
                    end   = DateTime.Parse(BLL.Cls_PublicOperations.Dt.DefaultView[i]["MiladiFinishDateTime"].ToString());



                    Appointment app = new Appointment(Start.AddSeconds(1), end, (Math.Round((double)totalHours / 60)).ToString());

                    app.StatusId = Convert.ToInt32(BLL.Cls_PublicOperations.Dt.DefaultView[i]["DeviceStateID"].ToString());


                    if (LSTProrudtionLines1.CheckedItems.Count > 1)
                    {
                        app.ResourceId = this.radScheduler1.Resources.GetById(BLL.Cls_PublicOperations.Dt.DefaultView[i]["ProductLineId"].ToString()).Id;
                    }

                    else
                    {
                        app.ResourceId = this.radScheduler1.Resources.GetById(BLL.Cls_PublicOperations.Dt.DefaultView[i]["id"].ToString()).Id;
                    }
                    app.BackgroundId = this.radScheduler1.Backgrounds[this.radScheduler1.Backgrounds.Count - 1].Id;

                    if (BLL.Cls_PublicOperations.Dt.DefaultView[i]["color"].ToString() == "16777215")
                    {
                        app.Visible = false;
                    }



                    if (LSTProrudtionLines1.CheckedItems.Count > 1)
                    {
                        if (BLL.Cls_PublicOperations.Dt.DefaultView[i]["StateId"].ToString() == "0" && BLL.Cls_PublicOperations.Dt.DefaultView[i]["DeActiveStateForShowGroupOk"].ToString() == "False")
                        {
                            app.Visible = false;
                        }

                        if (BLL.Cls_PublicOperations.Dt.DefaultView[i]["StateId"].ToString() == "1" && BLL.Cls_PublicOperations.Dt.DefaultView[i]["ActiveStateForShowGroupOk"].ToString() == "False")
                        {
                            app.Visible = false;
                        }
                    }

                    this.radScheduler1.Appointments.Add(app);

                    if (LSTProrudtionLines1.CheckedItems.Count > 1)
                    {
                        var coordinates = LastApprochmentInfo.CoordinatesOf(BLL.Cls_PublicOperations.Dt.DefaultView[i]["ProductLineId"].ToString());
                        LastApprochmentInfo[coordinates.Item1, 1] = BLL.Cls_PublicOperations.Dt.DefaultView[i]["DeviceStateID"].ToString();
                    }

                    else
                    {
                        var coordinates = LastApprochmentInfo.CoordinatesOf(BLL.Cls_PublicOperations.Dt.DefaultView[i]["id"].ToString());
                        LastApprochmentInfo[coordinates.Item1, 1] = BLL.Cls_PublicOperations.Dt.DefaultView[i]["DeviceStateID"].ToString();
                    }
                }

                this.radScheduler1.GroupType = GroupType.Resource;

                this.radScheduler1.ActiveViewType = SchedulerViewType.Timeline;
                this.radScheduler1.GetTimelineView().GroupSeparatorWidth = 0;

                this.radScheduler1.GetTimelineView().ResourcesPerView = this.radScheduler1.Resources.Count;
                this.radScheduler1.GetTimelineView().ShowTimescale(Timescales.Minutes);
                RadSchedulerLocalizationProvider.CurrentProvider = new CustomSchedulerLocalizationProvider();


                if (IsFirstLoad == true)
                {
                    IsFirstLoad = false;
                }
                TimelineGroupingByResourcesElement timelineElement = this.radScheduler1.SchedulerElement.ViewElement as TimelineGroupingByResourcesElement;

                SchedulerUIHelper.BringAppointmentIntoView(this.radScheduler1.Appointments[this.radScheduler1.Appointments.Count - 1], this.radScheduler1);
                timelineElement.ResourceHeaderWidth             = 135;
                timelineElement.ResourcesHeader.TextOrientation = Orientation.Vertical;
                timelineElement.ResourcesHeader.Font            = HeaderFont;
                this.Cursor = Cursors.Default;
            }
            catch (Exception E)
            {
                this.Cursor = Cursors.Default;
            }
        }
        private static string toFriendlyPersianDate(this DateTime dt, DateTime comparisonBase, bool appendHhMm)
        {
            var persianDate = dt.ToPersianYearMonthDay();

            //1388/10/22
            var persianYear  = persianDate.Year;
            var persianMonth = persianDate.Month;
            var persianDay   = persianDate.Day;

            //13:14
            var hour = dt.Hour;
            var min  = dt.Minute;
            var hhMm =
                $"{hour.ToString("00", CultureInfo.InvariantCulture)}:{min.ToString("00", CultureInfo.InvariantCulture)}";

            var date         = new PersianCalendar().ToDateTime(persianYear, persianMonth, persianDay, hour, min, 0, 0);
            var diff         = date - comparisonBase;
            var totalSeconds = Math.Round(diff.TotalSeconds);
            var totalDays    = Math.Round(diff.TotalDays);

            var suffix = " بعد";

            if (totalSeconds < 0)
            {
                suffix       = " قبل";
                totalSeconds = Math.Abs(totalSeconds);
                totalDays    = Math.Abs(totalDays);
            }

            var dateTimeToday = DateTime.Today;
            var yesterday     = dateTimeToday.AddDays(-1);
            var today         = dateTimeToday.Date;
            var tomorrow      = dateTimeToday.AddDays(1);

            hhMm = appendHhMm ? $"، ساعت {hhMm}" : string.Empty;

            if (today == date.Date)
            {
                // Less than one minute ago.
                if (totalSeconds < 60)
                {
                    return("هم اکنون");
                }

                // Less than 2 minutes ago.
                if (totalSeconds < 120)
                {
                    return($"یک دقیقه{suffix}{hhMm}");
                }

                // Less than one hour ago.
                if (totalSeconds < 3600)
                {
                    return(string.Format(CultureInfo.InvariantCulture, "{0} دقیقه",
                                         ((int)Math.Floor(totalSeconds / 60))) + suffix + hhMm);
                }

                // Less than 2 hours ago.
                if (totalSeconds < 7200)
                {
                    return($"یک ساعت{suffix}{hhMm}");
                }

                // Less than one day ago.
                if (totalSeconds < 86400)
                {
                    return
                        (string.Format(
                             CultureInfo.InvariantCulture,
                             "{0} ساعت",
                             ((int)Math.Floor(totalSeconds / 3600))
                             ) + suffix + hhMm);
                }
            }

            if (yesterday == date.Date)
            {
                return($"دیروز {PersianCulture.GetPersianWeekDayName(persianYear, persianMonth, persianDay)}{hhMm}");
            }

            if (tomorrow == date.Date)
            {
                return($"فردا {PersianCulture.GetPersianWeekDayName(persianYear, persianMonth, persianDay)}{hhMm}");
            }

            var dayStr = $"، {ToPersianDateTextify(persianYear, persianMonth, persianDay)}{hhMm}";

            if (totalSeconds < 30 * TimeConstants.Day)
            {
                return($"{(int)Math.Abs(totalDays)} روز{suffix}{dayStr}");
            }

            if (totalSeconds < 12 * TimeConstants.Month)
            {
                int months = Convert.ToInt32(Math.Floor((double)Math.Abs(diff.Days) / 30));
                return(months <= 1 ? $"1 ماه{suffix}{dayStr}" : $"{months} ماه{suffix}{dayStr}");
            }

            var years         = Convert.ToInt32(Math.Floor((double)Math.Abs(diff.Days) / 365));
            var daysMonths    = (double)Math.Abs(diff.Days) / 30;
            var nextMonths    = Convert.ToInt32(Math.Truncate(daysMonths)) - (years * 12) - 1;
            var nextMonthsStr = nextMonths <= 0 ? "" : $"{(years >= 1 ? " و " : "")}{nextMonths} ماه";

            if (years < 1)
            {
                return($"{nextMonthsStr}{suffix}{dayStr}");
            }

            return($"{years} سال{nextMonthsStr}{suffix}{dayStr}");
        }