protected void Page_Load(object sender, EventArgs e) { CKFinder.FileBrowser fileBrowser = new CKFinder.FileBrowser(); fileBrowser.BasePath = "../ckfinder/"; //设置CKFinder的基路径 fileBrowser.SetupCKEditor(txtContent); if (!IsPostBack) { flag = true; //id = int.Parse(Request.QueryString["pro_id"].ToString()); #region 绑定前台数据 //BindNew(); //BindTop(); //BindTally(); if (Request.QueryString["pro_id"] != null) { SqlDataReader proclassname = AcgService.select(int.Parse(Request.QueryString["pro_id"].ToString())); proclassname.Read(); string classname = proclassname["Pro_Class"].ToString(); DataTable dt = AcgService.select1(int.Parse(Request.QueryString["pro_id"].ToString())); if (classname == "视频") { shiping.Visible = true; otheracg.Visible = false; acgdetall.DataSource = dt; acgdetall.DataBind(); } else { shiping.Visible = false; otheracg.Visible = true; Repeater2.DataSource = dt; Repeater2.DataBind(); } BindBC(); //显示总共多少评论 num.Text = CommentService.num(int.Parse(Request.QueryString["pro_id"].ToString())).ToString(); } #endregion #region 举报收藏 if (Session["User_ID"] != null && Request.QueryString["pro_id"].ToString() != null) { SqlDataReader colletdt = CollectionBll.seletcCollect(int.Parse(Session["User_ID"].ToString()), int.Parse(Request.QueryString["pro_id"].ToString())); colletdt.Read(); SqlDataReader informdt = InformBll.seletcInform(int.Parse(Session["User_ID"].ToString()), int.Parse(Request.QueryString["pro_id"].ToString())); informdt.Read(); if (colletdt != null && colletdt.HasRows == true) { collectbutton.CssClass = "btn btn-large"; collectbutton.Text = "已收藏"; collectflag = true; } else { collectbutton.CssClass = "btn btn-primary btn-large"; collectbutton.Text = "收藏"; collectflag = false; } if (informdt != null && informdt.HasRows == true) { informbutton.CssClass = "btn btn-large"; informbutton.Text = "已举报"; informflag = true; } else { informbutton.CssClass = "btn btn-danger btn-large"; informbutton.Text = "举报"; informflag = false; } } #endregion } }
void GetUserDetail() { string email = ApplicationSession.Current.user.Email; UserBO.GetUserDatail(email); lName.InnerText = ApplicationSession.Current.user.Name; lEmail.InnerText = ApplicationSession.Current.user.Email; lMobile.InnerText = ApplicationSession.Current.user.Mobile; lQualification.InnerText = ApplicationSession.Current.user.Qualification; lInstitute.InnerText = ApplicationSession.Current.user.Institute; lMarks.InnerText = ApplicationSession.Current.user.Marks; lCity.InnerText = ApplicationSession.Current.user.Add.City; //lLocation.InnerText = ApplicationSession.Current.user.Add.Location; lCompany.InnerText = ApplicationSession.Current.user.Company; lExp.InnerText = ApplicationSession.Current.user.Experience; lAbout.InnerText = ApplicationSession.Current.user.Query; lblProgress.InnerText = ApplicationSession.Current.user.ProgressBar.ToString(); if (Convert.ToInt32(ApplicationSession.Current.user.ProgressBar.ToString().Substring(0, ApplicationSession.Current.user.ProgressBar.ToString().Length - 1)) <= 50) { progressBar.Attributes.Add("Class", "progress-bar progress-bar-danger"); } else if (Convert.ToInt32(ApplicationSession.Current.user.ProgressBar.ToString().Substring(0, ApplicationSession.Current.user.ProgressBar.ToString().Length - 1)) == 100) { progressBar.Attributes.Add("Class", "progress-bar progress-bar-success"); } //User Plan if (ApplicationSession.Current.user.UserPricingPlan != null) { if (!string.IsNullOrEmpty(ApplicationSession.Current.user.UserPricingPlan.PlanName)) { noUserPlanTaken.Visible = false; userPlanTaken.Visible = true; lPlanName.InnerText = ApplicationSession.Current.user.UserPricingPlan.PlanName.ToString(); lPlanExpireDate.InnerText = ApplicationSession.Current.user.UserPricingPlan.PlanExpireDate.ToString(); lReferralsLeft.InnerText = ApplicationSession.Current.user.UserPricingPlan.ReferralsLeft.ToString(); lJobsAppliedCount.InnerText = ApplicationSession.Current.user.UserPricingPlan.JobsAppliedCount.ToString(); } else { userPlanTaken.Visible = false; noUserPlanTaken.Visible = true; } } else { userPlanTaken.Visible = false; noUserPlanTaken.Visible = true; } //User Plan if (ApplicationSession.Current.user.ResumeSubmitted.ToString() == "Y") { lUploadResume.InnerText = ApplicationSession.Current.user.ResumePath.ToString().Substring(ApplicationSession.Current.user.ResumePath.ToString().LastIndexOf("_") + 1); } string fileName = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["FileSavePath"].ToString()) + "Resume" + ApplicationSession.Current.user.ResumePath.ToString(); if (File.Exists(fileName)) { resumeUpLoaded.Text = ApplicationSession.Current.user.ResumePath.ToString().Substring(ApplicationSession.Current.user.ResumePath.ToString().IndexOf("/") + 1); } progressBar.Style.Add("width", lblProgress.InnerText); jobAppliedCount.Text = ApplicationSession.Current.user.AppliedJobs.Count.ToString(); // jobAppliedCount.Style.Add("class", "label label-primary"); if (ApplicationSession.Current.user.AppliedJobs.Count > 0) { jobAppliedWarning.Visible = false; Repeater1.Visible = true; Repeater1.DataSource = ApplicationSession.Current.user.AppliedJobs; Repeater1.DataBind(); } else { jobAppliedWarning.Visible = true; Repeater1.Visible = false; } if (ApplicationSession.Current.user.PostedJobs.Count > 0) { Repeater2.Visible = true; Repeater2.DataSource = ApplicationSession.Current.user.PostedJobs; Repeater2.DataBind(); } else { Repeater2.Visible = false; } showProfile.Visible = true; editProfie.Visible = false; btnEdit.Visible = true; btnSubmit.Visible = false; //MakeControlsReadable(); }
protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(@"Data Source=.\sqlexpress;Initial Catalog=demo;Integrated Security=True"); string sQuery = ""; if (Request["id"] != null) { sQuery = "select * from sp where id=" + Request["id"]; SqlDataAdapter lst = new SqlDataAdapter(sQuery, con); DataTable sp = new DataTable(); lst.Fill(sp); txt_name.Text = sp.Rows[0]["name"].ToString(); Image1.Visible = true; Image1.ImageUrl = "~/img/" + sp.Rows[0]["img"].ToString(); ddl_stt.SelectedValue = sp.Rows[0]["stt"].ToString(); btn_submit.Text = "Update"; } sQuery = "Select * from sanpham"; if (Request["key"] != null) { sQuery = sQuery + " where name like '%" + Request["key"].ToString() + "%'"; } SqlDataAdapter da = new SqlDataAdapter(sQuery, con); DataTable dt = new DataTable(); da.Fill(dt); int so_item_1trang = 3; int so_trang = dt.Rows.Count / so_item_1trang + (dt.Rows.Count % so_item_1trang == 0?0:1); int page = Request["page"] == null?1:Convert.ToInt32(Request["page"]); int from = (page - 1) * 3; int to = page * 3 - 1; for (int i = dt.Rows.Count - 1; i >= 0; i--) { if (i < from || i > to) { dt.Rows.RemoveAt(i); } } Repeater1.DataSource = dt; Repeater1.DataBind(); DataTable dtPage = new DataTable(); dtPage.Columns.Add("index"); dtPage.Columns.Add("active"); for (int i = 1; i <= so_trang; i++) { DataRow dr = dtPage.NewRow(); dr["index"] = i; if ((Request["page"] == null && i == 1) || (Request["page"] != null && Convert.ToInt32(Request["page"]) == i)) { dr["active"] = 1; } else { dr["active"] = 0; } dtPage.Rows.Add(dr); } Repeater2.DataSource = dtPage; Repeater2.DataBind(); }