public static int getCommcount(string mark, cuslnoteEntity custinfo) { string strWhere = ""; if (mark == "begin") { strWhere = ""; } else { strWhere = " pname like '" + custinfo.Pname + "%' and convert(datetime,lastlinkdate) >= convert(datetime, '" + custinfo.Btime + "') and convert(datetime,lastlinkdate) <= convert(datetime,'" + custinfo.Etime + "') "; } return conString.Getcommentcount("custom_linknote","id",strWhere); }
protected void btnconfirm_Click(object sender, EventArgs e) { cuslnoteEntity note = new cuslnoteEntity(); note.Pname = this.txtpname.Text; note.Puser = this.txtpuser.Text; note.Linkdate = this.txtlinkdate.Text; note.Linktitle = this.txttitle.Text; note.Linkcontent = this.txtcontent.Text; note.Lastlinkdate = this.txtlasttime.Text; note.Istrycath = this.DropDownList2.SelectedItem.Text; note.TryCatch = this.DropDownList1.SelectedItem.Text; note.Nreader = Session["username"].ToString();//"honey";//session note.Newmoney = this.txtnewmoney.Text; note.Ndate = DateTime.Now.ToString(); if (action == "update") { note.Id = Convert.ToInt32(cid); int icount = cusnoteBll.updateCusnote(note); if (icount >0) { js("联系记录更新成功!"); Response.Redirect("linknoteList.aspx"); } } else { note.Cid = this.txtcid.Text; int icount = cusnoteBll.insertCusnote(note); if (icount > 0) { js("联系记录录入成功!"); Response.Redirect("linknoteList.aspx"); } } }
/// <summary> /// ��ü�¼��Ϣ�� /// </summary> /// <param name="id"></param> /// <returns></returns> public static cuslnoteEntity getcusnoteInfo(string id) { cuslnoteEntity note = new cuslnoteEntity(); string sql = "select * from custom_linknote where id="+id; using (SqlDataReader dr = SqlHelper.ExecuteReader(DataBll.conString.constr,CommandType.Text,sql)) { if (dr.Read()) { note.Pname = dr["pname"].ToString(); note.Puser = dr["puser"].ToString(); note.TryCatch = dr["trycatch"].ToString(); note.Linkcontent = dr["linkcontent"].ToString(); note.Lastlinkdate = dr["lastlinkdate"].ToString(); note.Istrycath = dr["istrycath"].ToString(); note.Newmoney = dr["newmoney"].ToString(); note.Linktitle = dr["linktitle"].ToString(); note.Linkdate = dr["linkdate"].ToString(); note.Ndate = dr["ndate"].ToString(); note.Nreader = dr["nreader"].ToString(); } } return note; }
/// <summary> /// /// </summary> /// <param name="mark">begin �����ʼ��</param> /// <param name="pi"></param> /// <param name="ps"></param> /// <param name="custinfo"></param> /// <returns></returns> public static DataSet getCusnoteinfo(string mark, int pi, int ps, cuslnoteEntity custinfo) { string tablename = " custom_linknote "; 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,lastlinkdate) >= convert(datetime, '" + custinfo.Btime + "') and convert(datetime,lastlinkdate) <= convert(datetime,'" + custinfo.Etime + "') "; } string strM = "id"; return conString.GetcommdataSource(tablename, PrimaryKey, sortfld, pagesize, pageindex, sortType, strWhere, strM, selecfld); }
/// <summary> /// �������� /// </summary> /// <param name="note"></param> /// <returns></returns> public static int updateCusnote(cuslnoteEntity note) { string sql = "update custom_linknote set pname='"+note.Pname+"',puser='******',newmoney='"+note.Newmoney+"',linkcontent='"+note.Linkcontent+"',lastlinkdate='"+note.Lastlinkdate+"',trycatch = '"+note.TryCatch+"',istrycath='"+note.Istrycath+"',linkdate='"+note.Linkdate+"',nreader='"+note.Nreader+"',ndate='"+note.Ndate+"',linktitle='"+note.Linktitle+"' 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(cuslnoteEntity note) { string sql = "insert into custom_linknote (pname,puser,newmoney,linkcontent,lastlinkdate,trycatch,istrycath,linkdate,nreader,ndate,linktitle,cid) values"; sql += "('"+note.Pname+"','"+note.Puser+"','"+note.Newmoney+"','"+note.Linkcontent+"','"+note.Lastlinkdate+"','"+note.TryCatch+"','"+note.Istrycath+"','"+note.Linkdate+"','"+note.Nreader+"','"+note.Ndate+"','"+note.Linktitle+"','"+note.Cid+"')"; return SqlHelper.ExecuteNonQuery(DataBll.conString.constr, CommandType.Text, sql); }
void bindlikedata(int pi, int ps, cuslnoteEntity custinfo) { this.Repeater1.DataSource = cusnoteBll.getCusnoteinfo("", pi, ps, custinfo); this.Repeater1.DataBind(); int pagecount = cusnoteBll.getCommcount("", custinfo); this.AspNetPager1.PageSize = pageSize; this.AspNetPager1.RecordCount = pagecount; this.AspNetPager1.CustomInfoHTML = "总:" + AspNetPager1.RecordCount.ToString() + "条,每页:%PageSize%条,当前:%CurrentPageIndex%/%PageCount%"; }