Пример #1
0
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        Panel2.Visible = false;

        if (DropDownList2.SelectedValue != "")
        {
            DropDownList3.Items.Clear();
            DropDownList3.Items.Add("");
            DropDownList3.Enabled = true;
            con.Open();
            com.Connection  = con;
            com.CommandText = "select id_l from tblteach where id_s=" + Session["id_s"].ToString() + " and name='" + DropDownList1.SelectedValue + "' and id_l=(select code from lesson where id_school=" + Session["id_s"].ToString() + " and name='" + DropDownList2.SelectedValue + "')";
            SqlDataReader dr = com.ExecuteReader();
            dr.Read();
            Session.Add("id_l", dr["id_l"].ToString());
            dr.Close();
            if (pc.GetMonth(dt) < 6)
            {
                dt = pc.AddYears(dt, -1);
            }
            com.CommandText = "select * from lesson where date1<>'-' and id_school=" + Session["id_s"] + " and code=" + Session["id_l"].ToString();
            dr = com.ExecuteReader();
            dr.Read();
            if (dr.HasRows)
            {
                dr.Close();
                com.CommandText = "select * from tblmark where mark1<>'' and id_school=" + Session["id_s"] + " and id_lesson=" + Session["id_l"].ToString();
                dr = com.ExecuteReader();
                dr.Read();
                if (!dr.HasRows)
                {
                    DropDownList3.Items.Add("Çæá");
                }
            }
            dr.Close();
            com.CommandText = "select * from lesson where date2<>'-' and id_school=" + Session["id_s"] + " and code=" + Session["id_l"].ToString();
            dr = com.ExecuteReader();
            dr.Read();
            if (dr.HasRows)
            {
                dr.Close();
                com.CommandText = "select * from tblmark where mark2<>'' and id_school=" + Session["id_s"] + " and id_lesson=" + Session["id_l"].ToString();
                dr = com.ExecuteReader();
                dr.Read();
                if (!dr.HasRows)
                {
                    DropDownList3.Items.Add("Ïæã");
                }
            }
        }
        else
        {
            DropDownList3.Enabled = false;
        }
    }
Пример #2
0
        private void btnAddYears_Click(object sender, EventArgs e)
        {
            PersianDate pd = new PersianDate(calendar.AddYears(DateTime.Now, 10));

            lblMessage.Text   = pd.ToString();
            lblToWritten.Text = pd.ToWritten();
        }
    public static SqlString DATEADDPersian(string datepart, int number, string date)
    {
        try
        {
            PersianCalendar objPersianCalendar = new PersianCalendar();

            DateTime PersianDate = new DateTime();

            string result = "";

            string[] date_spilt = date.Split('/');

            if (datepart == Date_part.YEAR.ToString())
            {
                PersianDate = objPersianCalendar.AddYears(objPersianCalendar.ToDateTime(int.Parse(date_spilt[0]), int.Parse(date_spilt[1]), int.Parse(date_spilt[2]), 0, 0, 0, 0), number);
            }
            else if (datepart == Date_part.DAY.ToString())
            {
                PersianDate = objPersianCalendar.AddDays(objPersianCalendar.ToDateTime(int.Parse(date_spilt[0]), int.Parse(date_spilt[1]), int.Parse(date_spilt[2]), 0, 0, 0, 0), number);
            }


            result = string.Format("{0}/{1}/{2}", objPersianCalendar.GetYear(PersianDate).ToString().PadLeft(4, '0'), objPersianCalendar.GetMonth(PersianDate).ToString().PadLeft(2, '0'), objPersianCalendar.GetDayOfMonth(PersianDate).ToString().PadLeft(2, '0'));

            return(new SqlString(result));
        }
        catch (Exception e)
        {
            return(SqlString.Null);
        }
    }
Пример #4
0
        public static PersianDateTime AddYears(this PersianDateTime persianDateTime, int years)
        {
            var dateTime = PersianCalendar.AddYears(persianDateTime.DateTime, years);

            persianDateTime.DateTime = dateTime;
            return(new PersianDateTime(dateTime));
        }
Пример #5
0
        public Date AddYears(int years)
        {
            if (IsEmpty(this))
            {
                throw new ArgumentException("Date is empty!");
            }

            return(new Date(PersianCalendar.AddYears(dateGregorian, years)));
        }
Пример #6
0
        public async Task <string> CountOfWebsiteViewIn7YearsAgo()
        {
            var websiteViewIn7YearsAgoList = new List <WebsiteViewIn7YearsAgo>();
            var dateTimeNow       = DateTime.Now;
            var dateTime7YearsAgo = dateTimeNow.AddYears(-7);

            var persianCalendar             = new PersianCalendar();
            var year7Persian                = persianCalendar.GetYear(dateTime7YearsAgo);
            var dateTime7YearsAgoClockClear = persianCalendar.ToDateTime(year7Persian, 1, 1, 0, 0, 0, 0);

            var yearNowPersian        = persianCalendar.GetYear(dateTimeNow);
            var dateTimeNowClockClear = persianCalendar.AddYears(persianCalendar.ToDateTime(yearNowPersian, 1, 1, 0, 0, 0, 0), 1);

            var websiteViews =
                _webView
                .AsNoTracking()
                .Where(q => q.CreatedOn <= dateTimeNowClockClear & q.CreatedOn >= dateTime7YearsAgoClockClear)
                .AsQueryable();

            var next = persianCalendar.ToDateTime(year7Persian, 1, 1, 0, 0, 0, 0);

            while (next < dateTimeNowClockClear)
            {
                var nextyear     = persianCalendar.AddYears(next, 1);
                var next1        = next;
                var dailyWebView = await websiteViews.Where(q => q.CreatedOn <= nextyear& q.CreatedOn >= next1).CountAsync();

                websiteViewIn7YearsAgoList.Add(new WebsiteViewIn7YearsAgo
                {
                    Year  = next.ToPersianString("yyyy"),
                    Count = dailyWebView
                });

                next = persianCalendar.AddYears(next, 1);
            }

            return(JsonConvert.SerializeObject(websiteViewIn7YearsAgoList, Formatting.None));
        }
 public static string AddYear(this PersianCalendar persianCalendar, string persianDate, int number)
 {
     try
     {
         DateTime initDate         = ConvertToGregorian(persianCalendar, persianDate);
         DateTime finalDate        = persianCalendar.AddYears(initDate, number);
         string   finalPersianDate = ConvertToPersian(persianCalendar, finalDate);
         return(finalPersianDate);
     }
     catch
     {
         return(null);
     }
 }
Пример #8
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int flag1 = 0;
        int flag2 = 0;

        lbld2.Visible = false;
        lbld1.Visible = false;
        if (CheckBox1.Checked == true)
        {
            int yer = int.Parse(TextBox5.Text.Substring(0, 4));
            if (pc.GetYear(dt) == yer && int.Parse(TextBox5.Text.Substring(5, 2)) <= 12 && int.Parse(TextBox5.Text.Substring(8, 2)) <= 31)
            {
                flag1 = 1;
            }
            else
            {
                lbld1.Visible = true;
                flag2         = 1;
            }
        }
        if (CheckBox2.Checked == true)
        {
            int yer1 = int.Parse(TextBox7.Text.Substring(0, 4));
            dt = pc.AddYears(dt, 1);

            if (yer1 == pc.GetYear(dt) && int.Parse(TextBox7.Text.Substring(5, 2)) <= 12 && int.Parse(TextBox7.Text.Substring(8, 2)) <= 31)
            {
                flag1 += 2;
            }
            else
            {
                lbld2.Visible = true;
                flag2         = 1;
            }
        }
        if (flag2 != 1)
        {
            sabtlesson(flag1);
        }
    }
 /// <summary>
 /// اضافه کردن سال به تاریخ
 /// </summary>
 public PersianDateTime AddYears(int years)
 {
     return(new PersianDateTime(PersianCalendar.AddYears(_dateTime, years), EnglishNumber));
 }
Пример #10
0
 public PersianDate AddYears(int years)
 {
     return(new PersianDate(_pc.AddYears(_date, years)));
 }
    public static SqlString DATEADDPersian(string datepart, int number, string date)
    {
        try
        {
            PersianCalendar objPersianCalendar = new PersianCalendar();

            DateTime PersianDate = new DateTime();

            string result = "";

            string[] date_spilt = date.Split('/');

            if (datepart == Date_part.YEAR.ToString())
            {
                PersianDate = objPersianCalendar.AddYears(objPersianCalendar.ToDateTime(int.Parse(date_spilt[0]), int.Parse(date_spilt[1]), int.Parse(date_spilt[2]), 0, 0, 0, 0), number);
            }
            else if (datepart == Date_part.DAY.ToString())
            {
                PersianDate = objPersianCalendar.AddDays(objPersianCalendar.ToDateTime(int.Parse(date_spilt[0]), int.Parse(date_spilt[1]), int.Parse(date_spilt[2]), 0, 0, 0, 0), number);
            }


            result = string.Format("{0}/{1}/{2}", objPersianCalendar.GetYear(PersianDate).ToString().PadLeft(4, '0'), objPersianCalendar.GetMonth(PersianDate).ToString().PadLeft(2, '0'), objPersianCalendar.GetDayOfMonth(PersianDate).ToString().PadLeft(2, '0'));

            return new SqlString(result);
        }
        catch (Exception e)
        {
            return SqlString.Null;
        }

    }
 public PersianDateTime AddYears(int years)
 {
     return(PersianDateTime.FromGorgian(Calendar.AddYears(DateTime, years)));
 }
Пример #13
0
 public PersianDateTime AddYears(int year)
 {
     return(new PersianDateTime(persianCalendar.AddYears(this.dateTime, year)));
 }