private string one_day_earlier() { DateTime dt = pc.AddDays(DateTime.Now, -1); string year = pc.GetYear(dt).ToString(); string month = pc.GetMonth(dt).ToString("d2"); string day = pc.GetDayOfMonth(dt).ToString("d2"); return(string.Concat(year, "/", month, "/", day)); }
public static PersianDate operator +(PersianDate persianDate, int days) { try { return(new PersianDate(persianCalendar.AddDays(persianDate.ToDateTime(), days))); } catch (OverflowException ex) { throw new OverflowException("The resulting date of the addition is outside of acceptable range.", ex); } }
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); } }
private void btnDeductDays(object sender, EventArgs e) { PersianDate pd = new PersianDate(calendar.AddDays(DateTime.Now, -66)); lblMessage.Text = pd.ToString(); lblToWritten.Text = pd.ToWritten(); }
public static PersianDateTime AddDays(this PersianDateTime persianDateTime, int days) { var dateTime = PersianCalendar.AddDays(persianDateTime.DateTime, days); persianDateTime.DateTime = dateTime; return(new PersianDateTime(dateTime)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if ((((string)Session["level"] != "programer") || (Convert.ToInt32(Session["userid"]) != 15)) && (((string)Session["level"] != "mng_product") || (Convert.ToInt32(Session["userid"]) != 16)) && (((string)Session["level"] != "Bana") || (Convert.ToInt32(Session["userid"]) != 34))) { Response.Redirect("../login.aspx"); Session.Clear(); } } System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar(); DateTime datetimeformat = DateTime.Now; PersianCalendar p = new PersianCalendar(); DateTime miladi = datetimeformat; datetimeformat = p.AddDays(miladi, -1); date = p.GetYear(datetimeformat).ToString("0000") + '/' + p.GetMonth(datetimeformat).ToString("00") + '/' + p.GetDayOfMonth(datetimeformat).ToString("00"); if (!Page.IsPostBack) { lbldateshow.Text = date; year = date.Substring(0, 4); dryear.SelectedValue = year; mounth = date.Substring(5, 2); drmounth.SelectedValue = mounth; day = date.Substring(8, 2); drday.SelectedValue = day; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (((string)Session["level"] != "Bana") || (Convert.ToInt32(Session["userid"]) != 34)) { Response.Redirect("../login.aspx"); Session.Clear(); } } System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar(); DateTime miladi; DateTime datetimeformat = DateTime.Now; PersianCalendar p = new PersianCalendar(); miladi = datetimeformat; datetimeformat = p.AddDays(miladi, -1); date_end = p.GetYear(datetimeformat).ToString("0000") + '/' + p.GetMonth(datetimeformat).ToString("00") + '/' + p.GetDayOfMonth(datetimeformat).ToString("00"); lbldate_e.Text = date_end; gridbis_day.DataBind(); }
public static string GetDeadLinePaymentDate() { PersianCalendar HijriDate = new PersianCalendar(); DateTime Dt = HijriDate.AddDays(DateTime.Now, 12); string Date = HijriDate.GetYear(Dt) + "/" + HijriDate.GetMonth(Dt).ToString("00") + "/" + HijriDate.GetDayOfMonth(Dt).ToString("00"); return(Date); }
public static SqlString GTS_ASM_AddShamsiDay(int Year, int Month, int Day, int Value) { string ShamsiDate = String.Format("{0}/{1}/{2}", Year, Month, Day); PersianCalendar pc = new PersianCalendar(); DateTime dt = Convert.ToDateTime(GTS_ASM_ShamsiToMiladi(ShamsiDate).ToString()); return(GTS_ASM_MiladiToShamsi(pc.AddDays(dt, Value).ToShortDateString()).ToString()); }
public void Should_add_day_to_perisan_date(string current, int days, string expected) { // Arrange // Act var final = persianCalendar.AddDays(current, days); // Assert Assert.Equal(expected, final); }
public Date AddDays(int days) { if (IsEmpty(this)) { throw new ArgumentException("Date is empty!"); } return(new Date(PersianCalendar.AddDays(dateGregorian, days))); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if ((((string)Session["level"] != "programer") || (Convert.ToInt32(Session["userid"]) != 15)) && (((string)Session["level"] != "mng_product") || (Convert.ToInt32(Session["userid"]) != 16)) && (((string)Session["level"] != "Bana") || (Convert.ToInt32(Session["userid"]) != 34))) { Response.Redirect("../login.aspx"); Session.Clear(); } } cnn.Open(); SqlCommand cmd_query_sms = new SqlCommand("SELECT COUNT(id) AS n_sms FROM dbo.messages WHERE (user_recive = " + Convert.ToInt32(Session["userid"]) + ") AND (msg_read = 0) AND (reciver = 0)", cnn); SqlDataReader dr = cmd_query_sms.ExecuteReader(); if (dr.Read())//if count sms>1 then goto masseges.aspx { int cn_sms = Convert.ToInt32(dr["n_sms"]); if (cn_sms >= 1) { Response.Redirect("masseges.aspx"); } } cnn.Close(); System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar(); DateTime miladi; DateTime datetimeformat = DateTime.Now; PersianCalendar p = new PersianCalendar(); miladi = datetimeformat; datetimeformat = p.AddDays(miladi, -1); date = p.GetYear(datetimeformat).ToString("0000") + '/' + p.GetMonth(datetimeformat).ToString("00") + '/' + p.GetDayOfMonth(datetimeformat).ToString("00"); if (!Page.IsPostBack) { labldate.Text = date; SqlDataSource1.FilterExpression = "tarikh ='" + date + "'"; SqlDataSource2.FilterExpression = "tarikh ='" + date + "'"; grid_total_press.DataBind(); grid_press.DataBind(); year = date.Substring(0, 4); dryear.SelectedValue = year; mounth = date.Substring(5, 2); drmounth.SelectedValue = mounth; day = date.Substring(8, 2); drday.SelectedValue = day; } }
protected void Page_Load(object sender, EventArgs e) { Page.MaintainScrollPositionOnPostBack = true; if (!Page.IsPostBack) { if ((((string)Session["level"] != "programer") || (Convert.ToInt32(Session["userid"]) != 15)) && (((string)Session["level"] != "mng_product") || (Convert.ToInt32(Session["userid"]) != 16)) && (((string)Session["level"] != "Bana") || (Convert.ToInt32(Session["userid"]) != 34))) { Response.Redirect("../login.aspx"); Session.Clear(); } } System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar(); DateTime miladi; DateTime datetimeformat = DateTime.Now; PersianCalendar p = new PersianCalendar(); miladi = datetimeformat; datetimeformat = p.AddDays(miladi, -1); date_end = p.GetYear(datetimeformat).ToString("0000") + '/' + p.GetMonth(datetimeformat).ToString("00") + '/' + p.GetDayOfMonth(datetimeformat).ToString("00"); if (!Page.IsPostBack) { year = date_end.Substring(0, 4); dryearstart.SelectedValue = year; mounth = date_end.Substring(5, 2); drmounthstart.SelectedValue = mounth; day = date_end.Substring(8, 2); drdaystart.SelectedValue = day; year = date_end.Substring(0, 4); dryear.SelectedValue = year; mounth = date_end.Substring(5, 2); drmounth.SelectedValue = mounth; day = date_end.Substring(8, 2); drday.SelectedValue = day; } if (rdbglaze.SelectedValue == "1") { lblfaz.Text = "فاز یک"; } else if (rdbglaze.SelectedValue == "2") { lblfaz.Text = "فاز دو"; } }
protected void Page_Load(object sender, EventArgs e) { Page.MaintainScrollPositionOnPostBack = true; if (!Page.IsPostBack) { if ((((string)Session["level"] != "depogol") || (Convert.ToInt32(Session["userid"]) != 24)) && (((string)Session["level"] != "depogol1") || (Convert.ToInt32(Session["userid"]) != 31)) && (((string)Session["level"] != "depogol2") || (Convert.ToInt32(Session["userid"]) != 33)) && (((string)Session["level"] != "Bana") || (Convert.ToInt32(Session["userid"]) != 34))) { Response.Redirect("../login.aspx"); Session.Clear(); } DateTime miladi; DateTime datetimeformat = DateTime.Now; PersianCalendar p = new PersianCalendar(); string date_end; miladi = datetimeformat; datetimeformat = p.AddDays(miladi, 0); date_end = p.GetYear(datetimeformat).ToString("0000") + '/' + p.GetMonth(datetimeformat).ToString("00") + '/' + p.GetDayOfMonth(datetimeformat).ToString("00"); yerstart.SelectedValue = date_end.Substring(0, 4); yerfin.SelectedValue = date_end.Substring(0, 4); monfin.SelectedValue = date_end.Substring(5, 2); dayfin.SelectedValue = date_end.Substring(8, 2); } }
/// <summary> /// اضافه کردن روز به تاریخ /// </summary> public PersianDateTime AddDays(int days) { return(new PersianDateTime(PersianCalendar.AddDays(_dateTime, days), EnglishNumber)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (((string)Session["level"] != "programer") || (Convert.ToInt32(Session["userid"]) != 15)) { Response.Redirect("../login.aspx"); Session.Clear(); } } System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar(); DateTime miladi; DateTime datetimeformat = DateTime.Now; PersianCalendar p = new PersianCalendar(); miladi = datetimeformat; datetimeformat = p.AddDays(miladi, -1); date_end = p.GetYear(datetimeformat).ToString("0000") + '/' + p.GetMonth(datetimeformat).ToString("00") + '/' + p.GetDayOfMonth(datetimeformat).ToString("00"); if (!Page.IsPostBack) { year = date_end.Substring(0, 4); dryearstart.SelectedValue = year; mounth = date_end.Substring(5, 2); drmounthstart.SelectedValue = mounth; day = date_end.Substring(8, 2); drdaystart.SelectedValue = day; year = date_end.Substring(0, 4); dryear.SelectedValue = year; mounth = date_end.Substring(5, 2); drmounth.SelectedValue = mounth; day = date_end.Substring(8, 2); drday.SelectedValue = day; } if (rdbglaze.SelectedValue == "1") { q = 0; flat = 0; fd = 0; faleh = 0; lueez = 0; pi = 0; grid_falehR.DataSource = faz1falehR; grid_falehF.DataSource = faz1falehF; grid_falehP.DataSource = faz1falehP; grid_falehR0.DataSource = faz1falehR0; grid_falehF0.DataSource = faz1falehF0; grid_falehP0.DataSource = faz1falehP0; //---------------------------------- grid_QueenR.DataSource = faz1QueenR; grid_QueenF.DataSource = faz1QueenF; grid_QueenP.DataSource = faz1QueenP; grid_QueenR0.DataSource = faz1QueenR0; grid_QueenF0.DataSource = faz1QueenF0; grid_QueenP0.DataSource = faz1QueenP0; //--------------------------------- grid_FlatR.DataSource = faz1FlatR; grid_FlatF.DataSource = faz1FlatF; grid_FlatP.DataSource = faz1FlatP; grid_FlatR0.DataSource = faz1FlatR0; grid_FlatF0.DataSource = faz1FlatF0; grid_FlatP0.DataSource = faz1FlatP0; //--------------------------------- grid_PR.DataSource = faz1PR; grid_PF.DataSource = faz1PF; grid_PP.DataSource = faz1PP; grid_PR0.DataSource = faz1PR0; grid_PF0.DataSource = faz1PF0; grid_PP0.DataSource = faz1PP0; //-------------------------------- grid_FDR.DataSource = faz1FDR; grid_FDF.DataSource = faz1FDF; grid_FDP.DataSource = faz1FDP; grid_FDR0.DataSource = faz1FDR0; grid_FDF0.DataSource = faz1FDF0; grid_FDP0.DataSource = faz1FDP0; //-------------------------------- grid_LUR.DataSource = faz1LUR; grid_LUF.DataSource = faz1LUF; grid_LUP.DataSource = faz1LUP; grid_LUR0.DataSource = faz1LUR0; grid_LUF0.DataSource = faz1LUF0; grid_LUP0.DataSource = faz1LUP0; //-------------------------------- grid_total.DataSource = SqlDataSource11; griddarsad.DataSource = SqlDataSource111; //------------------------------- grid_falehR.DataBind(); grid_falehF.DataBind(); grid_falehP.DataBind(); grid_falehR0.DataBind(); grid_falehF0.DataBind(); grid_falehP0.DataBind(); //---------------------------------- grid_QueenR.DataBind(); grid_QueenF.DataBind(); grid_QueenP.DataBind(); grid_QueenR0.DataBind(); grid_QueenF0.DataBind(); grid_QueenP0.DataBind(); //--------------------------------- grid_FlatR.DataBind(); grid_FlatF.DataBind(); grid_FlatP.DataBind(); grid_FlatR0.DataBind(); grid_FlatF0.DataBind(); grid_FlatP0.DataBind(); //--------------------------------- grid_PR.DataBind(); grid_PF.DataBind(); grid_PP.DataBind(); grid_PR0.DataBind(); grid_PF0.DataBind(); grid_PP0.DataBind(); //-------------------------------- grid_FDR.DataBind(); grid_FDF.DataBind(); grid_FDP.DataBind(); grid_FDR0.DataBind(); grid_FDF0.DataBind(); grid_FDP0.DataBind(); //-------------------------------- grid_LUR.DataBind(); grid_LUF.DataBind(); grid_LUP.DataBind(); grid_LUR0.DataBind(); grid_LUF0.DataBind(); grid_LUP0.DataBind(); //------------------------------- grid_total.DataBind(); griddarsad.DataBind(); lblfaz.Text = "یک"; glaze = "glaze1"; } else if (rdbglaze.SelectedValue == "2") { q = 0; flat = 0; fd = 0; faleh = 0; lueez = 0; pi = 0; grid_falehR.DataSource = faz2falehR; grid_falehF.DataSource = faz2falehF; grid_falehP.DataSource = faz2falehP; grid_falehR0.DataSource = faz2falehR0; grid_falehF0.DataSource = faz2falehF0; grid_falehP0.DataSource = faz2falehP0; //---------------------------------- grid_QueenR.DataSource = faz2QueenR; grid_QueenF.DataSource = faz2QueenF; grid_QueenP.DataSource = faz2QueenP; grid_QueenR0.DataSource = faz2QueenR0; grid_QueenF0.DataSource = faz2QueenF0; grid_QueenP0.DataSource = faz2QueenP0; //--------------------------------- grid_FlatR.DataSource = faz2FlatR; grid_FlatF.DataSource = faz2FlatF; grid_FlatP.DataSource = faz2FlatP; grid_FlatR0.DataSource = faz2FlatR0; grid_FlatF0.DataSource = faz2FlatF0; grid_FlatP0.DataSource = faz2FlatP0; //--------------------------------- grid_PR.DataSource = faz2PR; grid_PF.DataSource = faz2PF; grid_PP.DataSource = faz2PP; grid_PR0.DataSource = faz2PR0; grid_PF0.DataSource = faz2PF0; grid_PP0.DataSource = faz2PP0; //-------------------------------- grid_FDR.DataSource = faz2FDR; grid_FDF.DataSource = faz2FDF; grid_FDP.DataSource = faz2FDP; grid_FDR0.DataSource = faz2FDR0; grid_FDF0.DataSource = faz2FDF0; grid_FDP0.DataSource = faz2FDP0; //-------------------------------- grid_LUR.DataSource = faz2LUR; grid_LUF.DataSource = faz2LUF; grid_LUP.DataSource = faz2LUP; grid_LUR0.DataSource = faz2LUR0; grid_LUF0.DataSource = faz2LUF0; grid_LUP0.DataSource = faz2LUP0; //-------------------------------- grid_total.DataSource = SqlDataSource22; griddarsad.DataSource = SqlDataSource222; //------------------------------- grid_falehR.DataBind(); grid_falehF.DataBind(); grid_falehP.DataBind(); grid_falehR0.DataBind(); grid_falehF0.DataBind(); grid_falehP0.DataBind(); //---------------------------------- grid_QueenR.DataBind(); grid_QueenF.DataBind(); grid_QueenP.DataBind(); grid_QueenR0.DataBind(); grid_QueenF0.DataBind(); grid_QueenP0.DataBind(); //--------------------------------- grid_FlatR.DataBind(); grid_FlatF.DataBind(); grid_FlatP.DataBind(); grid_FlatR0.DataBind(); grid_FlatF0.DataBind(); grid_FlatP0.DataBind(); //--------------------------------- grid_PR.DataBind(); grid_PF.DataBind(); grid_PP.DataBind(); grid_PR0.DataBind(); grid_PF0.DataBind(); grid_PP0.DataBind(); //-------------------------------- grid_FDR.DataBind(); grid_FDF.DataBind(); grid_FDP.DataBind(); grid_FDR0.DataBind(); grid_FDF0.DataBind(); grid_FDP0.DataBind(); //-------------------------------- grid_LUR.DataBind(); grid_LUF.DataBind(); grid_LUP.DataBind(); grid_LUR0.DataBind(); grid_LUF0.DataBind(); grid_LUP0.DataBind(); grid_total.DataBind(); grid_falehR.DataBind(); lblfaz.Text = "دو"; glaze = "glaze2"; } }
public PersianDateTime AddDays(int days) { return(new PersianDateTime(persianCalendar.AddDays(this.dateTime, days))); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if ((((string)Session["level"] != "programer") || (Convert.ToInt32(Session["userid"]) != 15)) && (((string)Session["level"] != "mng_product") || (Convert.ToInt32(Session["userid"]) != 16)) && (((string)Session["level"] != "Bana") || (Convert.ToInt32(Session["userid"]) != 34))) { Response.Redirect("../login.aspx"); Session.Clear(); } } System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar(); DateTime miladi; DateTime datetimeformat = DateTime.Now; PersianCalendar p = new PersianCalendar(); miladi = datetimeformat; datetimeformat = p.AddDays(miladi, -1); date_end = p.GetYear(datetimeformat).ToString("0000") + '/' + p.GetMonth(datetimeformat).ToString("00") + '/' + p.GetDayOfMonth(datetimeformat).ToString("00"); if (!Page.IsPostBack) { year = date_end.Substring(0, 4); dryearstart.SelectedValue = year; mounth = date_end.Substring(5, 2); drmounthstart.SelectedValue = mounth; day = date_end.Substring(8, 2); drdaystart.SelectedValue = day; year = date_end.Substring(0, 4); dryear.SelectedValue = year; mounth = date_end.Substring(5, 2); drmounth.SelectedValue = mounth; day = date_end.Substring(8, 2); drday.SelectedValue = day; } if (rdbglaze.SelectedValue == "1") { grid_wagon.DataSource = SqlDataSource1; chart_wagon.DataSource = SqlDataSource1; chart_wagon.Series[0].XValueMember = "tarikh"; chart_wagon.Series[0].YValueMembers = "tonazh"; chart_wagon.DataBind(); grid_wagon.DataBind(); Session["daily"] = "glaze1"; lblfaz.Text = "یک"; } else if (rdbglaze.SelectedValue == "2") { grid_wagon.DataSource = SqlDataSource2; chart_wagon.DataSource = SqlDataSource2; chart_wagon.Series[0].XValueMember = "tarikh"; chart_wagon.Series[0].YValueMembers = "tonazh"; chart_wagon.DataBind(); grid_wagon.DataBind(); Session["daily"] = "glaze2"; lblfaz.Text = "دو"; } }
protected void Page_Load(object sender, EventArgs e) { Page.MaintainScrollPositionOnPostBack = true; if (!Page.IsPostBack) { if ((((string)Session["level"] != "programer") || (Convert.ToInt32(Session["userid"]) != 15)) && (((string)Session["level"] != "mng_product") || (Convert.ToInt32(Session["userid"]) != 16)) && (((string)Session["level"] != "Bana") || (Convert.ToInt32(Session["userid"]) != 34))) { Response.Redirect("../login.aspx"); Session.Clear(); } } System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar(); DateTime miladi; DateTime datetimeformat = DateTime.Now; PersianCalendar p = new PersianCalendar(); miladi = datetimeformat; datetimeformat = p.AddDays(miladi, -1); date_end = p.GetYear(datetimeformat).ToString("0000") + '/' + p.GetMonth(datetimeformat).ToString("00") + '/' + p.GetDayOfMonth(datetimeformat).ToString("00"); if (!Page.IsPostBack) { year = date_end.Substring(0, 4); dryearstart.SelectedValue = year; mounth = date_end.Substring(5, 2); drmounthstart.SelectedValue = mounth; day = date_end.Substring(8, 2); drdaystart.SelectedValue = day; year = date_end.Substring(0, 4); dryear.SelectedValue = year; mounth = date_end.Substring(5, 2); drmounth.SelectedValue = mounth; day = date_end.Substring(8, 2); drday.SelectedValue = day; //================================== if (rdbglaze.SelectedValue == "1") { grid_press.DataSource = faz1Press; // grid_press_help.DataSource = faz1Press; //----------------------------------- grid_Rikht.DataSource = faz1Rikht; // grid_Rikht_help.DataSource = faz1Rikht; //----------------------------------- grid_falehR.DataSource = faz1falehR; // grid_falehR_help.DataSource = faz1falehR; //----------------------------------- grid_falehP.DataSource = faz1falehP; // grid_falehP_help.DataSource = faz1falehP; //----------------------------------- grid_Form.DataSource = faz1fForm; //-------------------------------- grid_other.DataSource = faz1other; grid_total.DataSource = totalfaz1; grid_koll.DataSource = sqlcol1; //------------------------------- grid_press.DataBind(); // grid_press_help.DataBind(); grid_Rikht.DataBind(); // grid_Rikht_help.DataBind(); grid_falehR.DataBind(); // grid_falehR_help.DataBind(); grid_falehP.DataBind(); // grid_falehP_help.DataBind(); grid_Form.DataBind(); grid_koll.DataBind(); //------------------------------- grid_total.DataBind(); grid_other.DataBind(); lblfaz.Text = "یک"; glaze = "glaze1"; } else if (rdbglaze.SelectedValue == "2") { grid_press.DataSource = faz2Press; // grid_press_help.DataSource = faz2Press; //----------------------------------- grid_Rikht.DataSource = faz2Rikht; // grid_Rikht_help.DataSource = faz2Rikht; //----------------------------------- grid_falehR.DataSource = faz2falehR; // grid_falehR_help.DataSource = faz2falehR; //----------------------------------- grid_falehP.DataSource = faz2falehP; // grid_falehP_help.DataSource = faz2falehP; //----------------------------------- grid_Form.DataSource = faz2Form; //-------------------------------- grid_total.DataSource = totalfaz2; grid_other.DataSource = faz2other; grid_koll.DataSource = sqlcol2; //------------------------------- grid_press.DataBind(); // grid_press_help.DataBind(); grid_Rikht.DataBind(); // grid_Rikht_help.DataBind(); grid_falehR.DataBind(); // grid_falehR_help.DataBind(); grid_falehP.DataBind(); // grid_falehP_help.DataBind(); grid_Form.DataBind(); grid_koll.DataBind(); grid_total.DataBind(); grid_other.DataBind(); lblfaz.Text = "دو"; glaze = "glaze2"; } } }
public PersianDateTime AddDays(int days) { return(PersianDateTime.FromGorgian(Calendar.AddDays(DateTime, days))); }
public PersianDate AddDays(int days) { return(new PersianDate(_pc.AddDays(_date, days))); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if ((((string)Session["level"] != "programer") || (Convert.ToInt32(Session["userid"]) != 15)) && (((string)Session["level"] != "mng_product") || (Convert.ToInt32(Session["userid"]) != 16)) && (((string)Session["level"] != "Bana") || (Convert.ToInt32(Session["userid"]) != 34)) && (((string)Session["level"] != "grade") || (Convert.ToInt32(Session["userid"]) != 8))) { Response.Redirect("../login.aspx"); Session.Clear(); } } System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar(); DateTime miladi; DateTime datetimeformat = DateTime.Now; PersianCalendar p = new PersianCalendar(); miladi = datetimeformat; datetimeformat = p.AddDays(miladi, -1); date_end = p.GetYear(datetimeformat).ToString("0000") + '/' + p.GetMonth(datetimeformat).ToString("00") + '/' + p.GetDayOfMonth(datetimeformat).ToString("00"); if (!Page.IsPostBack) { year = date_end.Substring(0, 4); dryearstart.SelectedValue = year; mounth = date_end.Substring(5, 2); drmounthstart.SelectedValue = mounth; day = date_end.Substring(8, 2); drdaystart.SelectedValue = day; year = date_end.Substring(0, 4); dryear.SelectedValue = year; mounth = date_end.Substring(5, 2); drmounth.SelectedValue = mounth; day = date_end.Substring(8, 2); drday.SelectedValue = day; } if (rdbglaze.SelectedValue == "1") { grid_total.DataSource = total1; grid_total_day.DataSource = totalday1; grid_tonazh.DataSource = tonazh1; gridtafkik.DataSource = tafkik1; gridtotaltafkik.DataSource = totaltafkik1; gridtotaltafkik.DataBind(); gridtafkik.DataBind(); grid_total.DataBind(); grid_total_day.DataBind(); grid_tonazh.DataBind(); lblfaz.Text = "یک"; glaze = "glaze1"; } else if (rdbglaze.SelectedValue == "2") { grid_total.DataSource = total2; grid_total_day.DataSource = totalday2; grid_tonazh.DataSource = tonazh2; gridtafkik.DataSource = tafkik2; gridtotaltafkik.DataSource = totaltafkik2; gridtotaltafkik.DataBind(); gridtafkik.DataBind(); grid_total.DataBind(); grid_total_day.DataBind(); grid_tonazh.DataBind(); lblfaz.Text = "دو"; glaze = "glaze2"; } else if (rdbglaze.SelectedValue == "3") { grid_total.DataSource = sumtotal; grid_total_day.DataSource = sumtotalday; grid_tonazh.DataSource = sumtonazh; gridtafkik.DataSource = sumtafkik; gridtotaltafkik.DataSource = sumtotaltafkik; gridtotaltafkik.DataBind(); gridtafkik.DataBind(); grid_total.DataBind(); grid_total_day.DataBind(); grid_tonazh.DataBind(); lblfaz.Text = "مجموع دو لعاب"; } }
public static DateTime FaAddDays(this DateTime src, int days) { return(PersianCalendar.AddDays(src, days)); }
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; } }