protected string ShowDate(Object SubmitDate) { DateTime Date = Convert.ToDateTime(SubmitDate); Classes.Time t = new Classes.Time(); Date = Convert.ToDateTime(t.ConvertToIranTimeString(Date)); string Value = Date.Year.ToString() + "/" + Date.Month.ToString() + "/" + Date.Day.ToString(); return Value; }
protected string ShowDate(Object SubmitDate) { DateTime Date = Convert.ToDateTime(SubmitDate); Classes.Time t = new Classes.Time(); return t.ConvertToIranTimeString(Date); }
protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); DataTable dtPervious = new DataTable(); DataTable dtNext = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_blogInfo", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@EntryId", SqlDbType.Int).Value = Convert.ToInt32(Page.RouteData.Values["EntryId"]); try { sda.Fill(ds); dt = ds.Tables[0]; dtPervious = ds.Tables[1]; dtNext = ds.Tables[2]; if (dt.Rows.Count == 0) //doesn't exist { sda.Dispose(); sqlConn.Dispose(); Response.Redirect("~/Blog"); } else //blog exists { Classes.Time t = new Classes.Time(); LabelDate.Text = t.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString())); LabelTitle.Text = dt.Rows[0]["Title"].ToString(); LabelCategory.Text = dt.Rows[0]["CategoryName"].ToString(); LabelBody.Text = dt.Rows[0]["Body"].ToString(); ImageImage.ImageUrl = dt.Rows[0]["PhotoLink"].ToString(); Page.Title = "بلاگ : " + dt.Rows[0]["Title"].ToString(); } if (dtPervious.Rows.Count != 0) { PanelPervious.Visible = true; HyperLinkPervious.NavigateUrl = "~/Blog/" + dtPervious.Rows[0]["BlogId"].ToString() + "/" + dtPervious.Rows[0]["BrowserTitle"].ToString(); HyperLinkPervious.Text = dtPervious.Rows[0]["Title"].ToString(); } if (dtNext.Rows.Count != 0) { PanelNext.Visible = true; HyperLinkNext.NavigateUrl = "~/Blog/" + dtNext.Rows[0]["BlogId"].ToString() + "/" + dtNext.Rows[0]["BrowserTitle"].ToString(); HyperLinkNext.Text = dtNext.Rows[0]["Title"].ToString(); } } catch (Exception ex) { } finally { sqlConn.Close(); sda.Dispose(); sqlConn.Dispose(); } }