/// <summary> /// ��ÿͻ���ϵ����Ϣ /// </summary> /// <param name="id"></param> /// <returns></returns> public static custlinkEtity getCuslinkinfo(string id) { string sql = "select * from custom_link where id="+id; custlinkEtity cus = new custlinkEtity(); using (SqlDataReader dr = SqlHelper.ExecuteReader(DataBll.conString.constr, CommandType.Text, sql)) { if (dr.Read()) { cus.Pname = dr["pname"].ToString(); cus.Puser = dr["puser"].ToString(); cus.Sex = dr["sex"].ToString(); cus.Insection = dr["insection"].ToString(); cus.Duty = dr["duty"].ToString(); cus.Manageoper = dr["manageoper"].ToString(); cus.Linktel = dr["linktel"].ToString(); cus.Hometel = dr["hometel"].ToString(); cus.Homeaddress = dr["homeaddress"].ToString(); cus.Fax = dr["fax"].ToString(); cus.Brithday = dr["brithday"].ToString(); cus.Likes = dr["likes"].ToString(); cus.Msn = dr["msn"].ToString(); cus.Email = dr["email"].ToString(); cus.Mark = dr["mark"].ToString(); cus.Movetel = dr["movetel"].ToString(); } } return cus; }
protected void btnconfirm_Click(object sender, EventArgs e) { custlinkEtity cuslink = new custlinkEtity(); cuslink.Pname = this.txtpname.Text; cuslink.Puser = this.txtlinkname.Text; cuslink.Likes = this.txtlike.Text; cuslink.Linktel = this.txtlinktel.Text; cuslink.Movetel = this.txtmovetel.Text; cuslink.Hometel = this.txthometel.Text; cuslink.Homeaddress = this.txthomeaddress.Text; cuslink.Insection = this.DropDownList2.SelectedItem.Text; cuslink.Sex = this.DropDownList1.SelectedItem.Text; cuslink.Msn = this.txtqq.Text; cuslink.Manageoper = this.txtmanageoper.Text; cuslink.Mark = this.txtmark.Text; cuslink.Fax = this.txtfax.Text; cuslink.Brithday = this.txtendtime.Text; cuslink.Duty = this.txtduty.Text; cuslink.Email = this.txtemail.Text; if (cid != "") { cuslink.Id = Convert.ToInt32(cid); int iu = cuslinkBll.updateCuslink(cuslink); if (iu > 0) { js("成功增加客户联系人!"); } } else { cuslink.Cinfoid = Convert.ToInt32(this.txtcid.Text == "" ? "0" : this.txtcid.Text); int i = cuslinkBll.addCuslink(cuslink); if (i > 0) { js("成功增加客户联系人!"); } } Response.Redirect("cuslinkList.aspx"); }
/// <summary> /// ��ÿͻ���ϵ�� /// </summary> /// <param name="cinfoid">cinfoid</param> /// <returns></returns> public static string getCuslinkinfos(string cinfoid) { System.Text.StringBuilder list = new StringBuilder(); int index =1; string sql = "select * from custom_link where cinfoid=" + cinfoid; custlinkEtity cus = new custlinkEtity(); using (SqlDataReader dr = SqlHelper.ExecuteReader(DataBll.conString.constr, CommandType.Text, sql)) { while(dr.Read()) { list.Append("<tr height=\"25\">"); list.Append("<td>"+index.ToString()+"</td>"); list.Append("<td>"+dr["puser"].ToString()+"</td>") ; list.Append("<td>"+dr["sex"].ToString()+"</td>"); list.Append("<td>"+dr["insection"].ToString()+"</td>"); list.Append("<td>"+dr["duty"].ToString()+"</td>"); list.Append("<td>"+dr["manageoper"].ToString()+"</td>"); list.Append("<td>"+dr["linktel"].ToString()+"</td>"); list.Append("<td>"+dr["movetel"].ToString()+"</td>"); list.Append("<td>"+dr["hometel"].ToString()+"</td>"); list.Append("<td>"+dr["homeaddress"].ToString()+"</td>"); list.Append("<td>"+dr["fax"].ToString()+"</td>"); list.Append("<td>"+dr["email"].ToString()+"</td>"); list.Append("<td>"+dr["msn"].ToString()+"</td>"); list.Append("<td>"+dr["likes"].ToString()+"</td>"); list.Append("<td>"+dr["mark"].ToString()+"</td>"); list.Append("</tr>"); index++; } } return list.ToString(); }
/// <summary> /// ���ӿͻ���ϵ�� /// </summary> /// <param name="cuslink"></param> /// <returns></returns> public static int addCuslink(custlinkEtity cuslink) { string sql = " insert into custom_link (pname,puser,sex,insection,duty,manageoper,linktel,hometel,homeaddress,fax,likes,msn,email,brithday,mark,movetel,cinfoid) values"; sql += "('"+cuslink.Pname+"','"+cuslink.Puser+"','"+cuslink.Sex+"','"+cuslink.Insection+"','"+cuslink.Duty+"','"+cuslink.Manageoper+"','"+cuslink.Linktel+"','"+cuslink.Hometel+"','"+cuslink.Homeaddress+"','"+cuslink.Fax+"','"+cuslink.Likes+"','"+cuslink.Msn+"','"+cuslink.Email+"','"+cuslink.Brithday+"','"+cuslink.Mark+"','"+cuslink.Movetel+"','"+cuslink.Cinfoid+"')"; return SqlHelper.ExecuteNonQuery(DataBll.conString.constr,CommandType.Text,sql); }
/// <summary> /// �Ŀͻ���Ϣ /// </summary> /// <param name="cus"></param> /// <returns></returns> public static int updateCuslink(custlinkEtity cus) { string sql = " update custom_link set pname='"+cus.Pname+"',puser='******',sex='"+cus.Sex+"',insection='"+cus.Insection+"',duty='"+cus.Duty+"',manageoper='"+cus.Manageoper+"',linktel='"+cus.Linktel+"',hometel='"+cus.Hometel+"',homeaddress='"+cus.Homeaddress+"',fax='"+cus.Fax+"',likes='"+cus.Likes+"',msn='"+cus.Msn+"',email='"+cus.Email+"',brithday='"+cus.Brithday+"',mark='"+cus.Mark+"',movetel='"+cus.Movetel+"' where id="+cus.Id.ToString(); return SqlHelper.ExecuteNonQuery(DataBll.conString.constr, CommandType.Text, sql); }
/// <summary> /// /// </summary> /// <param name="mark"></param> /// <param name="pi"></param> /// <param name="ps"></param> /// <param name="cus"></param> /// <returns></returns> public static DataSet getCustominfo(string mark, int pi, int ps, custlinkEtity cus) { string tablename = " custom_link "; 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 '" + cus.Pname + "%' and puser like '" + cus.Puser + "%'"; } string strM = "id"; return conString.GetcommdataSource(tablename, PrimaryKey, sortfld, pagesize, pageindex, sortType, strWhere, strM, selecfld); }
/// <summary> /// ������� /// </summary> /// <param name="mark"></param> /// <param name="custinfo"></param> /// <returns></returns> public static int Getcustinfocount(string mark, custlinkEtity cus) { string strWhere = ""; if (mark == "begin") { strWhere = ""; } else { strWhere = " pname like '" + cus.Pname + "%' and puser like '" + cus.Puser + "%'"; } return conString.Getcommentcount("custom_link", "id", strWhere); }
void bindlikedata(int pi, int ps, custlinkEtity custinfo) { ds = cuslinkBll.getCustominfo("", pi, ps, custinfo); this.Repeater1.DataSource = ds; this.Repeater1.DataBind(); int pagecount = cuslinkBll.Getcustinfocount("", custinfo); this.AspNetPager1.PageSize = pageSize; this.AspNetPager1.RecordCount = pagecount; this.AspNetPager1.CustomInfoHTML = "总:" + AspNetPager1.RecordCount.ToString() + "条,每页:%PageSize%条,当前:%CurrentPageIndex%/%PageCount%"; }