protected void LinkButtonStats_Click(object sender, EventArgs e) { PanelManage.Visible = false; PanelSearch.Visible = false; PanelStats.Visible = true; LinkButtonManage.Enabled = true; LinkButtonSearch.Enabled = true; LinkButtonStats.Enabled = false; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_statsUsers", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.Fill(ds); dt = ds.Tables[0]; TimeClass tc = new TimeClass(); LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["UsersDate"].ToString())); LabelStatsUsers.Text = dt.Rows[0]["UsersCount"].ToString(); LabelStatsGenderFemale.Text = "زن: " + dt.Rows[0]["UsersGenderFemale"].ToString(); LabelStatsGenderMale.Text = " مرد: " + dt.Rows[0]["UsersGenderMale"].ToString(); LabelStatsLogin.Text = dt.Rows[0]["UsersLoginMonth"].ToString(); sda.Dispose(); sqlConn.Close(); }
protected void LinkButtonOffers_Click(object sender, EventArgs e) { PanelUsers.Visible = false; PanelOffers.Visible = true; PanelCredit.Visible = false; PanelCoupons.Visible = false; LinkButtonUsers.Enabled = true; LinkButtonOffers.Enabled = false; LinkButtonCredit.Enabled = true; LinkButtonCoupons.Enabled = true; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_statsOffers", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.Fill(ds); dt = ds.Tables[0]; TimeClass tc = new TimeClass(); LabelOffersDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["OffersDate"].ToString())); LabelOffersOffers.Text = dt.Rows[0]["OffersCount"].ToString(); LabelOffersActive.Text = dt.Rows[0]["OffersActive"].ToString(); LabelOffersPast.Text = dt.Rows[0]["OffersPast"].ToString(); LabelOffersSold.Text = dt.Rows[0]["OffersSoldCount"].ToString(); LabelOffersAverage.Text = (Convert.ToInt32(dt.Rows[0]["OffersSoldCount"].ToString()) / Convert.ToInt32(dt.Rows[0]["OffersPast"].ToString())).ToString(); sda.Dispose(); sqlConn.Close(); }
protected string ShowDate(Object SubmitDate) { DateTime Date = Convert.ToDateTime(SubmitDate); TimeClass tc = new TimeClass(); return(tc.ConvertToIranTimeString(Date)); }
protected void LinkButtonCoupons_Click(object sender, EventArgs e) { PanelUsers.Visible = false; PanelOffers.Visible = false; PanelCredit.Visible = false; PanelCoupons.Visible = true; LinkButtonUsers.Enabled = true; LinkButtonOffers.Enabled = true; LinkButtonCredit.Enabled = true; LinkButtonCoupons.Enabled = false; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_statsCoupons", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.Fill(ds); dt = ds.Tables[0]; TimeClass tc = new TimeClass(); LabelCouponsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["CouponsDate"].ToString())); LabelOffersOffers.Text = dt.Rows[0]["CouponsCount"].ToString(); LabelOffersActive.Text = dt.Rows[0]["CouponsActive"].ToString(); LabelOffersPast.Text = dt.Rows[0]["CouponsPast"].ToString(); sda.Dispose(); sqlConn.Close(); }
protected void LinkButtonStatsRefresh_Click(object sender, EventArgs e) { StatsRefresh sr = new StatsRefresh(); sr.refreshStats("Users"); ImageStatsRefresh.ImageUrl = "~/images/icons/check16.png"; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_statsUsers", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.Fill(ds); dt = ds.Tables[0]; TimeClass tc = new TimeClass(); LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["UsersDate"].ToString())); LabelStatsUsers.Text = dt.Rows[0]["UsersCount"].ToString(); LabelStatsGenderFemale.Text = "زن: " + dt.Rows[0]["UsersGenderFemale"].ToString(); LabelStatsGenderMale.Text = " مرد: " + dt.Rows[0]["UsersGenderMale"].ToString(); LabelStatsLogin.Text = dt.Rows[0]["UsersLoginMonth"].ToString(); sda.Dispose(); sqlConn.Close(); }
protected void Page_Load(object sender, EventArgs e) { //check premissions AdminPremissions ap = new AdminPremissions(); bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Blog"); if (!AdminPremission) { Response.Redirect("~/Error.aspx?Code=404"); } if (!IsPostBack) { switch (Request.QueryString["Mode"]) { case "Edit": { PanelEdit.Visible = true; Page.Title = "Salestan : بلاگ"; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_blogInfo", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@BlogId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["BlogId"]); sda.Fill(ds); dt = ds.Tables[0]; if (dt.Rows.Count == 0) //news doesn't exist { //LabelName.Text = "خبری با این شناسه موجود نمی باشد!"; } else //news exists { TimeClass tc = new TimeClass(); LabelDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString())); TextBoxTitle.Text = dt.Rows[0]["Title"].ToString(); TextBoxBrief.Text = dt.Rows[0]["Brief"].ToString(); TextBoxBody.Text = dt.Rows[0]["Body"].ToString(); TextBoxPhotoLink.Text = dt.Rows[0]["PhotoLink"].ToString(); //Location DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString(); } sda.Dispose(); sqlConn.Close(); break; } } } }
protected void LinkButtonStats_Click(object sender, EventArgs e) { PanelUsers.Visible = false; PanelManage.Visible = false; PanelLog.Visible = false; PanelStats.Visible = true; PanelRequests.Visible = false; LinkButtonUsers.Enabled = true; LinkButtonManage.Enabled = true; LinkButtonLog.Enabled = true; LinkButtonStats.Enabled = false; LinkButtonRequests.Enabled = true; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_statsCredit", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.Fill(ds); dt = ds.Tables[0]; PanelManageUser.Visible = true; LabelMessage.Visible = false; TimeClass tc = new TimeClass(); LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["CreditDate"].ToString())); LabelStatsActiveCredit.Text = dt.Rows[0]["CreditSum"].ToString(); LabelStatsGiftCredit.Text = dt.Rows[0]["CreditGiftCredit"].ToString(); LabelStatsSpentCredit.Text = dt.Rows[0]["CreditSpent"].ToString(); LabelStatsSpentGift.Text = dt.Rows[0]["CreditGiftSpent"].ToString(); LabelStatsActiveCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditSum"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); LabelStatsGiftCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditGiftCredit"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); LabelStatsSpentCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditSpent"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); LabelStatsSpentGiftAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditGiftSpent"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); sda.Dispose(); sqlConn.Close(); }
protected void Page_Load(object sender, EventArgs e) { //check premissions AdminPremissions ap = new AdminPremissions(); bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Offers"); if (!AdminPremission) { Response.Redirect("~/Error.aspx?Code=404"); } if (!IsPostBack) { switch (Request.QueryString["Mode"]) { case "Edit": { PanelEdit.Visible = true; Page.Title = "Salestan : تغییر مشخصات پیشنهاد"; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_offerInfo", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@OfferId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OfferId"]); sda.Fill(ds); dt = ds.Tables[0]; //Descriptions StringBuilder sbDescriptions = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Descriptions"].ToString())); sbDescriptions.Replace("<", "<"); sbDescriptions.Replace(">", ">"); string descriptions = sbDescriptions.ToString(); //Highlights StringBuilder sbHighlights = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Highlights"].ToString())); sbHighlights.Replace("<", "<"); sbHighlights.Replace(">", ">"); string highlights = sbHighlights.ToString(); //Details StringBuilder sbDetails = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Details"].ToString())); sbDetails.Replace("<", "<"); sbDetails.Replace(">", ">"); string details = sbDetails.ToString(); DropDownListCompany.SelectedValue = dt.Rows[0]["CompanyId"].ToString(); TextBoxTitle.Text = dt.Rows[0]["Title"].ToString(); TextBoxBrowserTitle.Text = dt.Rows[0]["BrowserTitle"].ToString(); DropDownListCategory.SelectedValue = dt.Rows[0]["CategoryId"].ToString(); TextBoxHighlights.Text = highlights; TextBoxDetails.Text = details; TextBoxDescriptions.Text = descriptions; TextBoxPriceOffer.Text = dt.Rows[0]["PriceOffer"].ToString(); TextBoxPriceNormal.Text = dt.Rows[0]["PriceNormal"].ToString(); TextBoxPriceGift.Text = dt.Rows[0]["PriceGift"].ToString(); TextBoxPriceOurs.Text = dt.Rows[0]["PriceOurs"].ToString(); TextBoxPricePercent.Text = dt.Rows[0]["PriceDiscountPercent"].ToString(); TextBoxMinBuy.Text = dt.Rows[0]["MinBuy"].ToString(); TextBoxMaxBuy.Text = dt.Rows[0]["MaxBuy"].ToString(); TextBoxMinUser.Text = dt.Rows[0]["MinUser"].ToString(); TextBoxMaxUser.Text = dt.Rows[0]["MaxUser"].ToString(); LabelShowDateValue.Text = dt.Rows[0]["ShowDate"].ToString(); LabelEndDateValue.Text = dt.Rows[0]["EndDate"].ToString(); DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString(); TextBoxLink1Name.Text = dt.Rows[0]["Link1Name"].ToString(); TextBoxLink1Url.Text = dt.Rows[0]["Link1Url"].ToString(); TextBoxLink2Name.Text = dt.Rows[0]["Link2Name"].ToString(); TextBoxLink2Url.Text = dt.Rows[0]["Link2Url"].ToString(); //locations for (int i = 0; i < CheckBoxListLocations.Items.Count; i++) { if (dt.Rows[0]["Locations"].ToString().Contains(CheckBoxListLocations.Items[i].Value + ",")) { CheckBoxListLocations.Items[i].Selected = true; } } sda.Dispose(); sqlConn.Dispose(); break; } case "Buyers": { PanelBuyers.Visible = true; Page.Title = "Salestan : فهرست خریداران پیشنهاد"; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_offerBuyers", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@OfferId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OfferId"]); sda.Fill(ds); dt = ds.Tables[0]; LabelBuyersCompanyName.Text = dt.Rows[0]["Name"].ToString(); LabelBuyersCompanyId.Text = dt.Rows[0]["CompanyId"].ToString(); LabelBuyersOfferId.Text = Request.QueryString["OfferId"]; LabelBuyersTitle.Text = dt.Rows[0]["Title"].ToString(); LabelBuyersSold.Text = dt.Rows[0]["PurchasedCount"].ToString(); TimeClass tc = new TimeClass(); LabelBuyersDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["ShowDate"].ToString())); sda.Dispose(); sqlConn.Dispose(); break; } case "Photos": { PanelPhotos.Visible = true; Page.Title = "Salestan : تصاویر پیشنهاد"; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_offersPhotos", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@OfferId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OfferId"]); sda.Fill(ds); dt = ds.Tables[0]; LabelPhotosCompanyName.Text = dt.Rows[0]["Name"].ToString(); LabelPhotosCompanyId.Text = dt.Rows[0]["CompanyId"].ToString(); LabelPhotosOfferId.Text = Request.QueryString["OfferId"]; LabelPhotosOfferTitle.Text = dt.Rows[0]["Title"].ToString(); if (dt.Rows[0]["MainPhoto"].ToString() == "0") { ImageMainPhoto.ImageUrl = "NoPhoto.jpg"; } else { ImageMainPhoto.ImageUrl = "~/Files/Photos/" + dt.Rows[0]["MainPhoto"].ToString() + ".jpg"; } sda.Dispose(); sqlConn.Dispose(); break; } } } }
protected string ShowDate(Object SubmitDate) { DateTime Date = Convert.ToDateTime(SubmitDate); TimeClass tc = new TimeClass(); return tc.ConvertToIranTimeString(Date); }
protected void Page_Load(object sender, EventArgs e) { //check premissions AdminPremissions ap = new AdminPremissions(); bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Users"); if (!AdminPremission) { Response.Redirect("~/Error.aspx?Code=404"); } if (!IsPostBack) { switch (Request.QueryString["Mode"]) { case "Info": { PanelInfo.Visible = true; Page.Title = "Salestan : مشخصات کاربر"; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_userInfo", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["UserId"]); sda.Fill(ds); dt = ds.Tables[0]; if (dt.Rows.Count == 0) //admin doesn't exist { LabelMessage.Text = "کاربری با این شناسه موجود نمی باشد!"; LabelMessage.CssClass = "ErrorMessage"; LabelMessage.Visible = true; PanelUserInfo.Visible = false; } else //user exists { LabelMessage.Visible = false; PanelUserInfo.Visible = true; LabelUserIdValue.Text = Request.QueryString["UserId"].ToString(); LabelEmailValue.Text = dt.Rows[0]["Email"].ToString(); LabelFirstNameValue.Text = dt.Rows[0]["FirstName"].ToString(); LabelLastNameValue.Text = dt.Rows[0]["LastName"].ToString(); LabelBirthValue.Text = dt.Rows[0]["BirthDate"].ToString(); ImageGender.ImageUrl = "~/images/icons/gender24" + dt.Rows[0]["Gender"].ToString() + ".png"; LabelJobValue.Text = dt.Rows[0]["Job"].ToString(); LabelEducationValue.Text = dt.Rows[0]["Education"].ToString(); LabelHomePhoneValue.Text = dt.Rows[0]["HomeTel"].ToString(); LabelWorkPhoneValue.Text = dt.Rows[0]["WorkTel"].ToString(); LabelMobileValue.Text = dt.Rows[0]["Mobile"].ToString(); LabelAddressValue.Text = dt.Rows[0]["Address"].ToString(); LabelCredit.Text = dt.Rows[0]["Credit"].ToString(); LabelGiftCredit.Text = dt.Rows[0]["GiftCredit"].ToString(); LabelSpentCredit.Text = dt.Rows[0]["SpentCredit"].ToString(); LabelSpendGift.Text = dt.Rows[0]["SpentGift"].ToString(); LabelStatsOffersPurchased.Text = dt.Rows[0]["PurchasedOffersCount"].ToString(); LabelStatsUsersInvite.Text = dt.Rows[0]["InvitedUsersCount"].ToString(); DropDownListStatus.SelectedValue = dt.Rows[0]["Status"].ToString(); TimeClass tc = new TimeClass(); LabelMemberSinceValue.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["MemberSince"].ToString())); LabelLastLoginValue.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["LastLogin"].ToString())); } sda.Dispose(); sqlConn.Close(); break; } } } }
protected void LinkButtonStatsRefresh_Click(object sender, EventArgs e) { StatsRefresh sr = new StatsRefresh(); sr.refreshStats("Credit"); ImageStatsRefresh.ImageUrl = "~/images/icons/check16.png"; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_statsCredit", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.Fill(ds); dt = ds.Tables[0]; PanelManageUser.Visible = true; LabelMessage.Visible = false; TimeClass tc = new TimeClass(); LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["CreditDate"].ToString())); LabelStatsActiveCredit.Text = dt.Rows[0]["CreditSum"].ToString(); LabelStatsGiftCredit.Text = dt.Rows[0]["CreditGiftCredit"].ToString(); LabelStatsSpentCredit.Text = dt.Rows[0]["CreditSpent"].ToString(); LabelStatsSpentGift.Text = dt.Rows[0]["CreditGiftSpent"].ToString(); LabelStatsActiveCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditSum"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); LabelStatsGiftCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditGiftCredit"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); LabelStatsSpentCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditSpent"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); LabelStatsSpentGiftAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditGiftSpent"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); sda.Dispose(); sqlConn.Close(); }
protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); DataTable dtPervious = new DataTable(); DataTable dtNext = new DataTable(); DataTable dtComments = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_blogInfo", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@BlogId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["BlogId"]); sda.Fill(ds); dt = ds.Tables[0]; dtPervious = ds.Tables[1]; dtNext = ds.Tables[2]; dtComments = ds.Tables[3]; if (dt.Rows.Count == 0) //news doesn't exist { sda.Dispose(); sqlConn.Close(); Response.Redirect("~/Blog.aspx"); } else //blog exists { TimeClass tc = new TimeClass(); LabelDate.Text = tc.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 = "Salestan : بلاگ : " + dt.Rows[0]["Title"].ToString(); HyperLinkShareFacebook.NavigateUrl = "http://www.facebook.com/share.php?u=" + Request.Url.AbsoluteUri + "&t=" + dt.Rows[0]["Title"].ToString(); HyperLinkShareTwitter.NavigateUrl = "http://twitter.com/home?status=" + dt.Rows[0]["Title"].ToString() + " " + Request.Url.AbsoluteUri; HyperLinkShareEmail.NavigateUrl = "mailto:?subject=" + dt.Rows[0]["Title"].ToString() + "&body=" + Request.Url.AbsoluteUri; } if (dtPervious.Rows.Count != 0) //news doesn't exist { PanelPervious.Visible = true; HyperLinkPervious.NavigateUrl = "~/ShowBlog.aspx?BlogId=" + dtPervious.Rows[0]["BlogId"].ToString() + "&Title=" + dtPervious.Rows[0]["BrowserTitle"].ToString(); HyperLinkPervious.Text = dtPervious.Rows[0]["Title"].ToString(); } if (dtNext.Rows.Count != 0) //news doesn't exist { PanelNext.Visible = true; HyperLinkNext.NavigateUrl = "~/ShowBlog.aspx?BlogId=" + dtNext.Rows[0]["BlogId"].ToString() + "&Title=" + dtNext.Rows[0]["BrowserTitle"].ToString(); HyperLinkNext.Text = dtNext.Rows[0]["Title"].ToString(); } //Comment StringBuilder sb3 = new StringBuilder(); if (dtComments.Rows.Count != 0) { for (int i = 0; i < dtComments.Rows.Count; i++) { sb3.AppendLine("<br/>"); sb3.AppendLine("<div class='FormLabel' style='direction:rtl;'>"); sb3.AppendLine(dtComments.Rows[i]["Comment"].ToString()); if (dtComments.Rows[i]["Answer"].ToString() != "") { sb3.AppendLine("<br/><br/>"); sb3.AppendLine("<img alt='' height='20' src='images/logosmall.png' width='60' /><br/>"); sb3.AppendLine("<strong>" + dtComments.Rows[i]["Answer"].ToString() + "</strong>"); } sb3.AppendLine("</div>"); sb3.AppendLine("<br/>"); sb3.AppendLine("<hr style='color:#CAE1E6' />"); } LiteralComments.Text = sb3.ToString(); } sda.Dispose(); sqlConn.Close(); }
protected void Page_Load(object sender, EventArgs e) { //check premissions AdminPremissions ap = new AdminPremissions(); bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Charity"); if (!AdminPremission) { Response.Redirect("~/Error.aspx?Code=404"); } if (!IsPostBack) { switch (Request.QueryString["Mode"]) { case "NewsAdd": { PanelNews.Visible = true; Page.Title = "Salestan : اخبار خیریه"; ImageButtonNewsSubmit.ImageUrl = "~/images/Buttons/add-off.png"; LabelDate.Text = DateTime.Now.ToShortDateString(); break; } case "OrganizationsAdd": { PanelOrganizations.Visible = true; Page.Title = "Salestan : موسسات خیریه"; ImageButtonOrganizations.ImageUrl = "~/images/Buttons/add-off.png"; break; } case "NewsEdit": { PanelNews.Visible = true; Page.Title = "Salestan : اخبار خیریه"; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_charityNewsInfo", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@NewsId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["NewsId"]); sda.Fill(ds); dt = ds.Tables[0]; if (dt.Rows.Count == 0) //news doesn't exist { //LabelName.Text = "خبری با این شناسه موجود نمی باشد!"; } else //news exists { TimeClass tc = new TimeClass(); LabelDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString())); TextBoxNewsSubject.Text = dt.Rows[0]["Subject"].ToString(); TextBoxNewsBrief.Text = dt.Rows[0]["Brief"].ToString(); TextBoxNewsBody.Text = dt.Rows[0]["Body"].ToString(); //Location DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString(); ImageButtonNewsSubmit.ImageUrl = "~/images/Buttons/edit-off.png"; } sda.Dispose(); sqlConn.Close(); break; } case "OrganizationsEdit": { PanelOrganizations.Visible = true; Page.Title = "Salestan : موسسات خیریه"; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_charityOrganizationsInfo", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@OrganizationId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OrganizationId"]); sda.Fill(ds); dt = ds.Tables[0]; if (dt.Rows.Count == 0) //news doesn't exist { //LabelName.Text = "موسسه ای با این شناسه موجود نمی باشد!"; } else //news exists { TextBoxName.Text = dt.Rows[0]["Name"].ToString(); TextBoxAbout.Text = dt.Rows[0]["About"].ToString(); TextBoxEmail.Text = dt.Rows[0]["Email"].ToString(); TextBoxWebsite.Text = dt.Rows[0]["Website"].ToString(); TextBoxPhone.Text = dt.Rows[0]["Phone"].ToString(); TextBoxFax.Text = dt.Rows[0]["Fax"].ToString(); TextBoxAddress.Text = dt.Rows[0]["Address"].ToString(); ImageButtonOrganizations.ImageUrl = "~/images/Buttons/edit-off.png"; //Location } sda.Dispose(); sqlConn.Close(); break; } } } }