protected void btnconfirm_Click(object sender, EventArgs e) { customoperEntity oper = new customoperEntity(); oper.Copername = this.txtopername.Text; oper.Coperemail = this.txtemail.Text; oper.Copercode = this.txtcode.Text; oper.Coperbrith = this.txtendtime.Text; oper.Coperaddress = this.txtaddress.Text; oper.Cface = this.txtface.Text; oper.Copertel = this.txttel.Text; oper.Copersction = this.dropsection.SelectedItem.Text; oper.Csex = this.dropsex.SelectedItem.Text; oper.Cbackgroup = this.txtcolloge.Text; if (action == "update") { oper.Id = Convert.ToInt32(cid); int i = custoperBll.updateCusnote(oper); if (i>0) { action = ""; Response.Redirect("operlist.aspx"); } } else { int i = custoperBll.insertCusnote(oper); if (i > 0) { Response.Redirect("operlist.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { this.txtcid.Text = Request.QueryString["id"].ToString(); oper = custoperBll.getcusnoteInfo(Request.QueryString["id"]); } } }
public static int getCommcount(string mark, customoperEntity custinfo) { string strWhere = ""; if (mark == "begin") { strWhere = ""; } else { strWhere = " copername like '" + custinfo.Copername + "%' and convert(datetime,coperbrith) >= convert(datetime, '" + custinfo.Btime + "') and convert(datetime,coperbrith) <= convert(datetime,'" + custinfo.Etime + "') and copersction = '" + custinfo.Copersction + "'"; } return conString.Getcommentcount("custom_oper", "id", strWhere); }
/// <summary> /// ��ü�¼��Ϣ�� /// </summary> /// <param name="id"></param> /// <returns></returns> public static customoperEntity getcusnoteInfo(string id) { customoperEntity note = new customoperEntity(); string sql = "select * from custom_oper where id=" + id; using (SqlDataReader dr = SqlHelper.ExecuteReader(DataBll.conString.constr, CommandType.Text, sql)) { if (dr.Read()) { note.Cface = dr["cface"].ToString(); note.Coperaddress = dr["coperaddress"].ToString(); note.Csex = dr["csex"].ToString(); note.Copertel = dr["copertel"].ToString(); note.Copersction = dr["copersction"].ToString(); note.Coperbrith = dr["coperbrith"].ToString(); note.Coperemail = dr["coperemail"].ToString(); note.Copername = dr["copername"].ToString(); note.Cbackgroup = dr["cbackgroup"].ToString(); note.Copercode = dr["copercode"].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, customoperEntity custinfo) { string tablename = " custom_oper "; 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 = " copername like '" + custinfo.Copername + "%' and convert(datetime,coperbrith) >= convert(datetime, '" + custinfo.Btime + "') and convert(datetime,coperbrith) <= convert(datetime,'" + custinfo.Etime + "') and copersction like '" + custinfo.Copersction + "%'"; } 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(customoperEntity note) { string sql = "update custom_oper set copername='" + note.Copername + "',csex='" + note.Csex + "',copertel='" + note.Copertel + "',coperbrith='" + note.Coperbrith + "',copercode='" + note.Copercode + "',copersction = '" + note.Copersction + "',coperemail='" + note.Coperemail + "',coperaddress='" + note.Coperaddress + "',cface='" + note.Cface + "',Cbackgroup='" + note.Cbackgroup + "' 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(customoperEntity note) { string sql = "insert into custom_oper ( copername,csex,copertel,coperbrith,copercode,copersction,coperemail,coperaddress,cface ,cbackgroup) values"; sql += "('" + note.Copername + "','" + note.Csex + "','" + note.Copertel + "','" + note.Coperbrith + "','" + note.Copercode + "','" + note.Copersction + "','" + note.Coperemail + "','" + note.Coperaddress + "','" + note.Cface + "','"+note.Cbackgroup+"')"; return SqlHelper.ExecuteNonQuery(DataBll.conString.constr, CommandType.Text, sql); }
void bindlikedata(int pi, int ps, customoperEntity custinfo) { this.Repeater1.DataSource = custoperBll.getCusnoteinfo("", pi, ps, custinfo); this.Repeater1.DataBind(); int pagecount = custoperBll.getCommcount("", custinfo); this.AspNetPager1.PageSize = pageSize; this.AspNetPager1.RecordCount = pagecount; this.AspNetPager1.CustomInfoHTML = "总:" + AspNetPager1.RecordCount.ToString() + "条,每页:%PageSize%条,当前:%CurrentPageIndex%/%PageCount%"; }