//绑定数据 public void bind(int questionstatus, string searchVal) { XHD.Model.hr_employee empModel = new GetEmpInfo().GetEmpModel(Request); string Total = string.Empty; string filedOrder = " q_time desc"; //this.AspNetPager1.StartRecordIndex, string strWhere = string.Empty; strWhere = " isdeleted = 0 and q_uid=" + empModel.ID; if (questionstatus != -1) { strWhere += " and status=" + questionstatus; } if (!string.IsNullOrEmpty(searchVal)) { strWhere += " and title like '%" + searchVal + "%'"; } this.repCustomer.DataSource = question.GetList(this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex, strWhere, filedOrder, out Total); this.repCustomer.DataBind(); this.AspNetPager1.RecordCount = Convert.ToInt32(Total); if (questionstatus == -1) { //this.Label1.Text = Total.ToString(); this.All.Text = "全部提问(" + Total + ")".ToString(); } this.AspNetPager1.CustomInfoHTML = "<span style=\"float:left;padding-left:14px;\">信息总数:<font color=\"Red\"><b>" + AspNetPager1.RecordCount.ToString() + "</b></font>"; AspNetPager1.CustomInfoHTML += " 总页数:<font color=\"Red\"><b>" + AspNetPager1.PageCount.ToString() + "</b></font></span>"; }
protected void Page_Load(object sender, EventArgs e) { XHD.Model.hr_employee empModel = new GetEmpInfo().GetEmpModel(Request); if (!IsPostBack) { if (!string.IsNullOrEmpty(empModel.title)) { this.Image1.ImageUrl = "http://172.178.1.211:8087/images/upload/portrait/" + empModel.title; this.Image2.ImageUrl = "http://172.178.1.211:8087/images/upload/portrait/" + empModel.title; } else { this.Image1.ImageUrl = "../file/user/unset.jpg"; this.Image2.ImageUrl = "../file/user/unset.jpg"; } this.lblNmae.Text = empModel.name; this.lblName1.Text = empModel.name; //this.lblSum.Text = "39"; //this.lblUnread.Text = "您有26条未读消息"; //this.lblReply.Text = "您有13条回复消息"; this.lblWelcome.Text = "您好," + empModel.name + ",欢迎使用SSN问答中心。"; this.lblScore.Text = "88"; this.lblQuestion.Text = "156"; this.lblAnswer.Text = "250"; this.lblRate.Text = "39.95%"; this.lblGood.Text = "56"; } }
protected void Page_Load(object sender, EventArgs e) { XHD.Model.hr_employee empModel = new GetEmpInfo().GetEmpModel(Request); XHD.BLL.ssn_question question = new XHD.BLL.ssn_question(); if (!IsPostBack) { if (!string.IsNullOrEmpty(empModel.title)) { this.Image1.ImageUrl = "http://172.178.1.211:8087/images/upload/portrait/" + empModel.title; this.Image2.ImageUrl = "http://172.178.1.211:8087/images/upload/portrait/" + empModel.title; } else { this.Image1.ImageUrl = "../file/user/unset.jpg"; this.Image2.ImageUrl = "../file/user/unset.jpg"; } this.lblNmae.Text = empModel.name; this.lblName1.Text = empModel.name; //this.lblSum.Text = "39"; //this.lblUnread.Text = "您有26条未读消息"; //this.lblReply.Text = "您有13条回复消息"; this.lblWelcome.Text = "您好," + empModel.name + ",欢迎使用SSN问答中心。"; DataSet ds = question.GetQAInfo(empModel.ID); int qNum = Convert.ToInt32(ds.Tables[0].Rows[0]["qNum"].ToString()); int aNum = Convert.ToInt32(ds.Tables[0].Rows[0]["aNum"].ToString()); int bNum = Convert.ToInt32(ds.Tables[0].Rows[0]["bNum"].ToString()); int gNum = Convert.ToInt32(ds.Tables[0].Rows[0]["gNum"].ToString()); this.lblScore.Text = "0"; this.lblQuestion.Text = qNum.ToString(); this.lblAnswer.Text = aNum.ToString(); if (aNum == 0 || bNum == 0) { this.lblRate.Text = "0"; } else { double rate = bNum * 100.0 / aNum; this.lblRate.Text = Math.Round(rate, 2).ToString() + "%"; } if (gNum == 0 || bNum == 0) { this.lblGood.Text = "0"; } else { double rate = gNum * 100.0 / bNum; this.lblGood.Text = Math.Round(rate, 2).ToString() + "%"; } } }
//页面显示问题信息 public void bindData() { XHD.Model.hr_employee empModel = new GetEmpInfo().GetEmpModel(Request); Session["empID"] = empModel.ID; qid = Request["question_id"] == null ? Session["h_qid"].ToString() : Request["question_id"]; DataSet q_ds = question.GetQuestion("q.id=" + qid + " and isdeleted=0"); if (q_ds != null && q_ds.Tables[0].Rows.Count > 0) { DataRow dr = q_ds.Tables[0].Rows[0]; string q_pid = dr["q_uid"].ToString(); string q_pname = dr["q_name"].ToString(); string q_title = dr["title"].ToString(); string q_content = dr["content"].ToString(); string q_time = dr["q_time"] != null?Convert.ToDateTime(dr["q_time"]).ToString("yyyy-MM-dd HH:mm:ss") : ""; string q_imgepath = dr["headImg"].ToString(); Session["h_qid"] = qid; Session["q_pid"] = q_pid; m_img.Src = q_imgepath == "" ? "../file/user/unset.jpg" : "http://172.178.1.211:8087/images/upload/portrait/" + q_imgepath; dq_name.InnerHtml = "<h5 class=\"text-gray\">" + q_pname + "</h5>"; dq_title.InnerHtml = "<strong style=\"font-size: 18px\">" + q_title + "</strong>" + q_content; dq_time.InnerHtml = "<span>发表时间:" + q_time + "</span>"; //获取附件值,分组 if (!string.IsNullOrEmpty(dr["att_file"].ToString())) { string urlList = dr["att_file"].ToString().Remove(dr["att_file"].ToString().Length - 1, 1); List <string> lstImg = urlList.Split(',').ToList(); List <MyImage> lstMyImage = new List <MyImage>(); foreach (string item in lstImg) { lstMyImage.Add(new MyImage { ImgUrl = item }); } this.repImage.DataSource = lstMyImage; //创建dataset //DataSet ds = new DataSet(); //System.Data.DataTable dt = new System.Data.DataTable(); //DataColumn dcSj = new DataColumn("ImgUrl", typeof(string)); //dt.Columns.Add(dcSj); //for (int i = 0; i < img.Length; i++) //{ // DataRow drs = dt.NewRow(); // drs[0] = img[i]; // dt.Rows.Add(drs); //} //ds.Tables.Add(dt); //this.repImage.DataSource = ds; this.repImage.DataBind(); } this.bind(); } else { Session["h_qid"] = qid; m_img.Src = "../images/system.jpg"; dq_name.InnerHtml = "<h5 class=\"text-gray\">系统提示</h5>"; dq_title.InnerHtml = "<strong style=\"font-size: 18px\">此问题已被发布者删除!</strong>"; } }