/// <summary> /// ��ü�¼��Ϣ�� /// </summary> /// <param name="id"></param> /// <returns></returns> public static selfresEntity getcusnoteInfo(string id) { selfresEntity note = new selfresEntity(); string sql = "select * from self_res where id=" + id; using (SqlDataReader dr = SqlHelper.ExecuteReader(DataBll.conString.constr, CommandType.Text, sql)) { if (dr.Read()) { note.Pname = dr["pname"].ToString(); note.Plink = dr["plink"].ToString(); note.Rtype = dr["rtype"].ToString(); note.Rtel = dr["rtel"].ToString(); note.Rtitle = dr["rtitle"].ToString(); note.Rcontent = dr["rcontent"].ToString(); note.Rruelst = dr["rruelst"].ToString(); note.Rcusj = dr["rcusj"].ToString(); note.Rdate = dr["rdate"].ToString(); note.Rker = dr["rker"].ToString(); note.Roper = dr["roper"].ToString(); note.Sreader = dr["sreader"].ToString(); note.Soper = dr["soper"].ToString(); } } return note; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { this.txtcid.Text = Request.QueryString["id"].ToString(); oper = selfresBll.getcusnoteInfo(Request.QueryString["id"]); } } }
public static int getCommcount(string mark, selfresEntity custinfo) { string strWhere = ""; if (mark == "begin") { strWhere = ""; } else { strWhere = " pname like '" + custinfo.Pname + "%' and convert(datetime,rdate) >= convert(datetime, '" + custinfo.Btime + "') and convert(datetime,rdate) <= convert(datetime,'" + custinfo.Etime + "') and rtitle like '" + custinfo.Rtitle + "%'"; } return conString.Getcommentcount("self_res", "id", strWhere); }
public static DataSet getCusnoteinfo(string mark, int pi, int ps, selfresEntity custinfo) { string tablename = " self_res "; string sortfld = " id "; string selecfld = " *"; string PrimaryKey = "id"; int pageindex = pi; int pagesize = ps; int sortType = 1; string strWhere = ""; if (mark == "begin") { strWhere = ""; } else { strWhere = " pname like '" + custinfo.Pname + "%' and convert(datetime,rdate) >= convert(datetime, '" + custinfo.Btime + "') and convert(datetime,rdate) <= convert(datetime,'" + custinfo.Etime + "') and rtitle like '" + custinfo.Rtitle + "%'"; } string strM = "id"; return conString.GetcommdataSource(tablename, PrimaryKey, sortfld, pagesize, pageindex, sortType, strWhere, strM, selecfld); }
protected void btnconfirm_Click(object sender, EventArgs e) { selfresEntity self = new selfresEntity(); self.Pname = this.txtpname.Text; self.Plink = this.txtplink.Text; self.Rtype = this.droprtype.SelectedItem.Text; self.Rtel = this.txtrtel.Text; self.Rtitle = this.txtrtitle.Text; self.Rcontent = this.txtrcontent.Text; self.Rruelst = this.txtrruelst.Text; self.Rcusj = this.droprcusj.SelectedItem.Text; self.Rdate = this.txtrdate.Text; self.Rker = this.txtrker.Text; self.Roper = this.droproper.SelectedItem.Text; self.Sreader = Session["username"].ToString();//"honey";//session if (Request.QueryString["action"] == "update") { self.Id = cid; int i = selfresBll.updateCusnote(self); if (i > 0) { js("更新成功!"); action = ""; } } else { int i = selfresBll.insertCusnote(self); if (i > 0) { js("录入成功!"); } } Response.Redirect("selfresList.aspx"); }
void bindlikedata(int pi, int ps,selfresEntity custinfo) { this.Repeater1.DataSource = selfresBll.getCusnoteinfo("", pi, ps, custinfo); this.Repeater1.DataBind(); int pagecount = selfresBll.getCommcount("", custinfo); this.AspNetPager1.PageSize = pageSize; this.AspNetPager1.RecordCount = pagecount; this.AspNetPager1.CustomInfoHTML = "总:" + AspNetPager1.RecordCount.ToString() + "条,每页:%PageSize%条,当前:%CurrentPageIndex%/%PageCount%"; }
/// <summary> /// �������� /// </summary> /// <param name="note"></param> /// <returns></returns> public static int updateCusnote(selfresEntity note) { string sql = "update self_res set pname='" + note.Pname + "',plink='" + note.Plink + "',rtype='" + note.Rtype + "',rtel='" + note.Rtel + "',rtitle='" + note.Rtitle + "',rcontent='" + note.Rcontent + "',rruelst='" + note.Rruelst + "',rcusj='" + note.Rcusj + "',rdate='" + note.Rdate + "',rker='" + note.Rker + "',roper='" + note.Roper + "',sreader='" + note.Sreader + "',soper='" + note.Soper + "' where id=" + note.Id.ToString(); return SqlHelper.ExecuteNonQuery(DataBll.conString.constr, CommandType.Text, sql); }
/// <summary> //�����¼��Ϣ /// </summary> /// <param name="note"></param> /// <returns></returns> public static int insertCusnote(selfresEntity note) { string sql = "insert into self_res ( pname,plink,rtype,rtel,rtitle,rcontent,rruelst,rcusj,rdate,rker,roper,sreader,soper) values"; sql += "('" + note.Pname + "','" + note.Plink + "','" + note.Rtype + "','" + note.Rtel + "','" + note.Rtitle + "','" + note.Rcontent + "','" + note.Rruelst + "','" + note.Rcusj + "','" + note.Rdate + "','" + note.Rker + "','" + note.Roper + "','" + note.Sreader + "','" + note.Soper + "')"; return SqlHelper.ExecuteNonQuery(DataBll.conString.constr, CommandType.Text, sql); }