ERP联系人查询和修改(十六)

查看和修改是同一个界面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LinkManUpdate.aspx.cs" Inherits="BioErpWeb.CRMSystem.LinkManUpdate"  %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/CalenderStyle.css" rel="stylesheet" type="text/css" />
  
    <script src="../JS/CustomerName.js" type="text/javascript"></script>
    <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function () {
        
            $("#btnSubmit").click(function () {

                return true;


            });

        });
    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
     <table class="maintable">
      <tr>
       <td colspan="4" class="titlebar">客户<span>联系人信息添加</span></td>
      </tr>
       <tr>
           <td>联系人姓名</td><td><asp:TextBox ID="txtLinkmanName" runat="server" CssClass="required"></asp:TextBox></td>
           <td>联系人昵称</td><td><asp:TextBox ID="txtNickname" runat="server"></asp:TextBox></td>
       </tr>
        <tr>
           <td>性别</td><td>
               <asp:DropDownList ID="ddlSex" runat="server">
                   <asp:ListItem Value="0">男</asp:ListItem>
                   <asp:ListItem Value="1">女</asp:ListItem>
               </asp:DropDownList>
           </td>
           <td>生日</td><td><asp:TextBox ID="txtBirthday" runat="server"></asp:TextBox></td>
       </tr>
        <tr>
           <td>部门</td><td><asp:TextBox ID="txtDepartment" runat="server"></asp:TextBox></td>
           <td>职务</td><td><asp:TextBox ID="txtHeadship" runat="server"></asp:TextBox></td>
       </tr>
        <tr>
           <td>是否是主联系人</td><td>
               <asp:DropDownList ID="ddlMainMan" runat="server">
                   <asp:ListItem Value="1">是</asp:ListItem>
                   <asp:ListItem Value="0">否</asp:ListItem>
               </asp:DropDownList>
           </td>
           <td>工作电话</td><td><asp:TextBox ID="txtWorkPhone" runat="server"></asp:TextBox></td>
       </tr>

      <tr>
          <td>
              个人手机
          </td>
          <td>
              <asp:TextBox ID="txtMobile" runat="server"></asp:TextBox>
          </td>
          <td>
              Email
          </td>
          <td>
              <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
          </td>
      </tr>
      <tr>
            <td>
              住址
          </td>
          <td>
              <asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
          </td>
          <td>
              邮编
          </td>
          <td>
              <asp:TextBox ID="txtPostcode" runat="server"></asp:TextBox>
          </td>
      </tr>
        <tr>
            <td>
              QQ号码
          </td>
          <td>
              <asp:TextBox ID="txtQQ" runat="server"></asp:TextBox>
          </td>
          <td>
              MSN
          </td>
          <td>
              <asp:TextBox ID="txtMsN" runat="server"></asp:TextBox>
          </td>
      </tr>
          <tr>
            <td>
              所属客户
          </td>
          <td>
              <asp:TextBox ID="txtCustomerID" runat="server"></asp:TextBox><input type="button" value="选择客户" style=" width:100px;" onclick="showCustomerDialog()" />
          </td> 
             <td>
              家庭电话
          </td>
          <td >
              <asp:TextBox ID="txtHomePhone" runat="server"></asp:TextBox>
          </td>
          
      </tr>
          <tr>
            <td>
                是否删除</td>
          <td>
               <asp:DropDownList ID="ddlSate" runat="server">
                   <asp:ListItem Value="1">是</asp:ListItem>
                   <asp:ListItem Value="0" Selected="True">否</asp:ListItem>
               </asp:DropDownList>
          </td> 
             <td>
                 &nbsp;</td>
          <td >
              &nbsp;</td>
          
      </tr>
         <tr>
             <td colspan="4" class="bottomtd">
             
                 <asp:Button ID="btnSubmit" runat="server" Text="客户联系人编辑" 
                     onclick="btnSubmit_Click" />
                                  
                 <asp:Button ID="btnReturn" runat="server" Text="返回列表" onclick="btnReturn_Click" 
                     />           
             </td>
         </tr>

     </table>
        <br />
    </div>
    </form>
</body>
</html>

后台代码:

 public partial class LinkManUpdate : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PageInfoBind();
            }
        }
       static BioCrmLinkmanInfo linkman = new BioCrmLinkmanInfo();
        protected void PageInfoBind()
        {
            if (Request.QueryString["ID"] == null)
            {
                Response.Redirect("LinkManListShow.aspx");
                return;
            }

            string id = Request.QueryString["ID"].ToString();
             LinkManInfoBLL linkbll = new LinkManInfoBLL();
             linkman = linkbll.getLinkManByID(id);
             this.txtLinkmanName.Text=linkman.LinkmanName;
          
              this.txtAddress.Text=linkman.Address;
               this.txtBirthday.Text=linkman.Birthday.ToString();
                this.txtWorkPhone.Text=linkman.WorkPhone;

                this.ddlSex.SelectedValue =Convert.ToBoolean(linkman.Sex)?"1":"0";
                 this.txtDepartment.Text=linkman.Department;
                 this.txtEmail.Text=linkman.Email;
                this.txtQQ.Text=linkman.QQ;
                 this.txtMsN.Text=linkman.MSN;
                 this.txtHeadship.Text=linkman.Headship;
                 this.txtHomePhone.Text = linkman.HomePhone;
                 this.txtMobile.Text=linkman.Mobile;
                 this.txtPostcode.Text=linkman.Postcode;
               this.txtNickname.Text=linkman.Nickname;
                this.ddlMainMan.SelectedValue=linkman.Nickname;
                this.txtCustomerID.Text = linkman.CustomerID.ToString();

        }
       
        
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BioCrmLinkmanInfo linkman = new BioCrmLinkmanInfo()
            {
                LinkmanID=int.Parse(Request.QueryString["ID"].ToString()),
                LinkmanName = this.txtLinkmanName.Text,
                Address = this.txtAddress.Text,
                Birthday = Convert.ToDateTime(this.txtBirthday.Text),
                WorkPhone = this.txtWorkPhone.Text,
                Sex = this.ddlSex.SelectedValue == "0" ? false : true,
                Department = this.txtDepartment.Text,
                Email = this.txtEmail.Text,
                QQ = this.txtQQ.Text,
                MSN = this.txtMsN.Text,
                Headship = this.txtHeadship.Text,
                HomePhone = this.txtHeadship.Text,
                Mobile = this.txtMobile.Text,
                Postcode = this.txtPostcode.Text,
                Nickname = this.txtNickname.Text,
                IsMain = this.ddlMainMan.SelectedValue == "1" ? true : false,
                CustomerID = int.Parse(this.txtCustomerID.Text),
                DeleteState=this.ddlSate.SelectedValue=="1"?true:false
            };

            LinkManInfoBLL linkbll = new LinkManInfoBLL();
            if (linkbll.LinkmanInfoUpdate(linkman) != 0)
            {
               Response.Redirect("LinkManListShow.aspx");
            }
           

        }

        protected void btnReturn_Click(object sender, EventArgs e)
        {
            Server.Transfer("CustomerListShow.aspx");
        }
       
    }

 jQuery验证的扩展方法:

jQuery.extend(
jQuery.validator.messages, {
required: "必选字段",
remote: "请修正该字段",
email: "请输入正确格式的电子邮件",
url: "请输入合法的网址",
date: "请输入合法的日期",
dateISO: "请输入合法的日期 (ISO).",
number: "请输入合法的数字",
digits: "只能输入整数",
creditcard: "请输入合法的信用卡号",
equalTo: "请再次输入相同的值",
accept: "请输入拥有合法后缀名的字符串",
maxlength: $.validator.format("请输入一个长度最多是 {0} 的字符串"),
minlength: $.validator.format("请输入一个长度最少是 {0} 的字符串"),
rangelength: $.validator.format("请输入一个长度介于 {0} 和 {1} 之间的字符串"),
range: $.validator.format("请输入一个介于 {0} 和 {1} 之间的值"),
max: $.validator.format("请输入一个最大为 {0} 的值"),
min: $.validator.format("请输入一个最小为 {0} 的值")
});

 

客户联系人添加:

添加的存储过程:
ALTER PROCEDURE [dbo].[BioCrmContactRecord_ADD] @Note nvarchar(1000), @ContactTime datetime, @CustomerID int, @LinkmanID int, @Type nvarchar(50), @Method nvarchar(100), @NoteTime datetime, @UserID int AS INSERT INTO [BioCrmContactRecord]( [Note],[ContactTime],[CustomerID],[LinkmanID],[Type],[Method],[NoteTime],[UserID] )VALUES( @Note,@ContactTime,@CustomerID,@LinkmanID,@Type,@Method,@NoteTime,@UserID )

 

客户关系管理系统——联系记录管理

修改的存储过程:

ALTER PROCEDURE [dbo].[BioCrmContactRecord_Update]
@NoteID int,
@Note nvarchar(1000),
@ContactTime datetime,
@CustomerID int,
@LinkmanID int,
@Type nvarchar(50),
@Method nvarchar(100),
@NoteTime datetime,
@UserID int,
@DeleteState bit
 AS 
	UPDATE [BioCrmContactRecord] SET 
	[Note] = @Note,[ContactTime] = @ContactTime,[CustomerID] = @CustomerID,[LinkmanID] = @LinkmanID,[Type] = @Type,[Method] = @Method,[NoteTime] = @NoteTime,[UserID] = @UserID,[DeleteState] = @DeleteState
	WHERE NoteID=@NoteID 

 得到实体对象的详细信息存储过程:

ALTER PROCEDURE [dbo].[GetContactRecordByID]
@NoteID int
 AS 
	SELECT 
	 NoteID,Note,ContactTime,CustomerID,LinkmanID,[Type],Method,NoteTime,UserID,DeleteState
	 FROM [BioCrmContactRecord]
	 WHERE NoteID=@NoteID 

 BLL层的代码:

public  class BioCrmContactRecordBLL
    {
      /// <summary>
      /// 添加一条记录信息
      /// </summary>
      /// <param name="record">记录信息对象</param>
      /// <returns>int</returns>
      public int BioCrmContactRecord_ADD(BioCrmContactRecord record)
      {
          SqlParameter[] pars = new SqlParameter[]{
           new SqlParameter("@Note",record.Note),
           new SqlParameter("@ContactTime",record.ContactTime),
           new SqlParameter("@CustomerID",record.CustomerID),
           new SqlParameter("@LinkmanID",record.LinkmanID),
           new SqlParameter("@Type",record.Type),
           new SqlParameter("@Method",record.Method),
           new SqlParameter("@NoteTime",record.NoteTime),
           new SqlParameter("@UserID",record.UserID)         
          };

          return DataBaseHelper.ExcuteSqlReturnInt("BioCrmContactRecord_ADD", CommandType.StoredProcedure, pars);
      
      }

      /// <summary>
      /// 修改record记录对象
      /// </summary>
      /// <param name="record"></param>
      /// <returns>int</returns>
      public int BioCrmContactRecord_Update(BioCrmContactRecord record)
      {
          SqlParameter[] pars = new SqlParameter[]{
          new SqlParameter("@NoteID",record.NoteID),
          new SqlParameter("@Note",record.Note),
           new SqlParameter("@ContactTime",record.ContactTime),
           new SqlParameter("@CustomerID",record.CustomerID),
           new SqlParameter("@LinkmanID",record.LinkmanID),
           new SqlParameter("@Type",record.Type),
           new SqlParameter("@Method",record.Method),
           new SqlParameter("@NoteTime",record.NoteTime),
           new SqlParameter("@UserID",record.UserID)         
          };
          return DataBaseHelper.ExcuteSqlReturnInt("BioCrmContactRecord_Update", CommandType.StoredProcedure, pars);
        
      }


      /// <summary>
      /// 根据Id返回record对象
      /// </summary>
      /// <param name="id">id</param>
      /// <returns>BioCrmContactRecord</returns>
      public BioCrmContactRecord GetContactRecordByID(int Noteid)
      {
          SqlParameter[] pars = new SqlParameter[]{
          new SqlParameter("@NoteID",Noteid)
          };

          BioCrmContactRecord record = new BioCrmContactRecord();
         DataTable dt= DataBaseHelper.SelectSQLReturnTable("GetContactRecordByID", CommandType.StoredProcedure, pars);
         if (dt != null && dt.Rows.Count > 0)
         {
             //NoteID,Note,ContactTime,CustomerID,LinkmanID,[Type],Method,NoteTime,UserID,DeleteState
             record.NoteID = Noteid;
             record.Note = dt.Rows[0]["Note"].ToString();
             record.NoteTime = Convert.ToDateTime(dt.Rows[0]["NoteTime"].ToString());
             record.ContactTime = Convert.ToDateTime(dt.Rows[0]["ContactTime"].ToString());
             record.CustomerID = int.Parse(dt.Rows[0]["CustomerID"].ToString());
             record.LinkmanID =int.Parse( dt.Rows[0]["LinkmanID"].ToString());
             record.Type = dt.Rows[0]["Type"].ToString();
             record.Method = dt.Rows[0]["Method"].ToString();
             record.UserID =int.Parse( dt.Rows[0]["UserID"].ToString());
             record.DeleteState =Convert.ToBoolean(dt.Rows[0]["DeleteState"].ToString());
         }
         return record;

      }
    }

 添加的前台界面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ContactRecordAdd.aspx.cs"
    Inherits="BioErpWeb.CRMSystem.ContactRecordAdd" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/CalenderStyle.css" rel="stylesheet" type="text/css" />
    <script src="../JS/CustomerName.js" type="text/javascript"></script>
    <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.validate.js" type="text/javascript"></script>
    <script src="../Scripts/ValidateMessage_ZW.js" type="text/javascript"></script>

    <style type="text/css">
        .style1
        {
            height: 22px;
        }
    </style>

    <script type="text/javascript">
        $().ready(function () {
            $("#form1").validate();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <table class="maintable">
            <tr>
                <td colspan="4" class="titlebar">
                    客户联系记录添加
                </td>
            </tr>
            <tr>
                <td class="style1">
                    客户编号
                </td>
                <td class="style1">
                    <asp:TextBox ID="txtCustomerID" CssClass="required number" runat="server" OnTextChanged="txtCustomerID_TextChanged"></asp:TextBox>
                    <asp:Button  ID="Button1" runat="server" Text="选择客户" OnClientClick="showCustomerDialog()" />
                </td>
                <td class="style1">
                    客户联系人
                </td>
                <td class="style1">
                    <asp:DropDownList ID="ddlLinkMan" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    联系时间
                </td>
                <td>
                  <asp:TextBox ID="txtContractTime" CssClass="required" runat="server"></asp:TextBox>
                    <cc1:CalendarExtender ID="CalendarExtender1" TargetControlID="txtContractTime" Format="yyyy-MM-dd" runat="server">
                    </cc1:CalendarExtender>
                </td>
                <td>
                    记录时间
                </td>
                <td>
                   <asp:Label ID="lbNoteTime" runat="server" Text="Label"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    联系类别
                </td>
                <td>
                    <asp:DropDownList ID="ddlType" runat="server">
                        <asp:ListItem>人工</asp:ListItem>
                        <asp:ListItem>自能</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    联系方式
                </td>
                <td>
                    <asp:DropDownList ID="ddlMethod" runat="server">
                        <asp:ListItem>电话</asp:ListItem>
                        <asp:ListItem>短信</asp:ListItem>
                        <asp:ListItem>Email</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    联系内容
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtContent" Width="552px" Height="101px" CssClass="required" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="4" class="bottomtd">
                    <asp:Button ID="btnSubmit" runat="server" Text="客户联系记录添加" OnClick="btnSubmit_Click" />
                    <asp:Button ID="btnReturn" runat="server" Text="返回列表" OnClick="btnReturn_Click" />
                </td>
            </tr>
        </table>
        <br />
    </div>
    </form>
</body>
</html>

 添加的后台代码:

 public partial class ContactRecordAdd : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            this.lbNoteTime.Text = DateTime.Now.ToShortDateString();
            Session["Userid"] = "29";
            if (Session["Userid"] == null)
            {
                Response.Redirect("~/Web/Desk.aspx");
            }
           
        
        }



        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BioCrmContactRecord record = new BioCrmContactRecord();
            BioCrmContactRecordBLL rbll = new BioCrmContactRecordBLL();
            record.CustomerID = int.Parse(this.txtCustomerID.Text.Trim());
            if (ddlLinkMan.SelectedValue == null || ddlLinkMan.SelectedValue == "0")
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('此客户没有联系人,请先添加联系人');", true);
                return;
            }
            record.LinkmanID = int.Parse(ddlLinkMan.SelectedValue.ToString());
            record.ContactTime = Convert.ToDateTime(this.txtContractTime.Text);
            record.NoteTime = Convert.ToDateTime(this.lbNoteTime.Text.Trim());
            record.Type = this.ddlType.SelectedValue.ToString();
            record.Method = this.ddlMethod.SelectedValue;
            record.Note = this.txtContent.Text;
            record.UserID = int.Parse(Session["Userid"].ToString());
            if (rbll.BioCrmContactRecord_ADD(record) != 0)
            {
                Response.Redirect("RecordListShow.aspx");
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('添加失败');", true);
            }


        }

        protected void btnReturn_Click(object sender, EventArgs e)
        {
            Server.Transfer("CustomerListShow.aspx");
        }

        protected void txtCustomerID_TextChanged(object sender, EventArgs e)
        {
         if(txtCustomerID.Text.Trim()!="" && txtCustomerID.Text.Trim().Length!=0&&txtCustomerID.Text.Trim()!="请选择")
            {
                string id=this.txtCustomerID.Text;
                System.Data.DataTable dt = SqlComm.GetDataByCondition("BioCrmLinkmanInfo", "LinkmanID,LinkmanName", "CustomerID=" + id).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    this.ddlLinkMan.DataSource = dt;
                    this.ddlLinkMan.DataTextField = "LinkmanName";
                    this.ddlLinkMan.DataValueField = "LinkmanID";
                    this.ddlLinkMan.DataBind();
                }
                else
                {
                    this.ddlLinkMan.Items.Clear();
                    this.ddlLinkMan.Items.Add(new ListItem("--请选择--", "0"));
                }

            }

        }
             
       
    }

 绑定相关的客户信息:

自定义视图:

SELECT   dbo.UserManager.UserName, dbo.BioCrmContactRecord.NoteID, dbo.BioCrmContactRecord.Note, 
                dbo.BioCrmContactRecord.ContactTime, dbo.BioCrmContactRecord.CustomerID, dbo.BioCrmContactRecord.LinkmanID, 
                dbo.BioCrmContactRecord.Type, dbo.BioCrmContactRecord.Method, dbo.BioCrmContactRecord.NoteTime, 
                dbo.BioCrmContactRecord.UserID, dbo.BioCrmContactRecord.DeleteState, dbo.BioCrmLinkmanInfo.LinkmanName, 
                dbo.BioCrmCustomer.CustomerName
FROM      dbo.BioCrmContactRecord INNER JOIN
                dbo.BioCrmCustomer ON dbo.BioCrmContactRecord.CustomerID = dbo.BioCrmCustomer.CustomerID INNER JOIN
                dbo.BioCrmLinkmanInfo ON dbo.BioCrmContactRecord.LinkmanID = dbo.BioCrmLinkmanInfo.LinkmanID INNER JOIN
                dbo.UserManager ON dbo.BioCrmContactRecord.UserID = dbo.UserManager.UserId

 绑定查询的结果页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RecordListShow.aspx.cs" Inherits="BioErpWeb.CRMSystem.RecordListShow" %>

<%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %>

<%@ Register src="../UserControl/CRMMenuBar.ascx" tagname="CRMMenuBar" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/AspNetPagerStyle.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    td{ text-align:center;}
    .tdsearch{ line-height:30px;}
    .menubar{ background:url(../Web/images/block_hd_bg.png); height:25px; width:100%;}
    .menubar ul{ margin:0px; padding:0px; list-style:none;}
    .menubar ul li{ display:inline; line-height:25px;}
    .menubar ul li a{display:inline-block;  text-align:center; width:100px; color:#0066CC; text-decoration:none;}

    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
 
        <uc1:CRMMenuBar ID="CRMMenuBar1" runat="server" />
 
    </div>
    <div>
         <table class="maintable" style=" width:900px;">
             <tr>
                 <td colspan="5" class="titlebar">
                     <span>客户联系记录管理</span>
                 </td>
             </tr>
             <tr>
                 <td class="tdsearch">
                     <asp:Label ID="Label1" runat="server" Text="联系人姓名:"></asp:Label>
                     <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                 </td>
                 <td class="tdsearch">
                     <asp:Label ID="Label2" runat="server" Text="客户名:"></asp:Label>
                      <asp:TextBox ID="txtCName" runat="server"></asp:TextBox>
              </td>
                 <td class="tdsearch">
                     <asp:Label ID="Label3" runat="server" Text="是否删除"></asp:Label>
                     <asp:DropDownList ID="ddlState" runat="server">
                         <asp:ListItem Value="0">否</asp:ListItem>
                         <asp:ListItem Value="1">是</asp:ListItem>
                     </asp:DropDownList>
                 </td>
                 
                 <td class="tdsearch">
                     <asp:ImageButton ID="imgbutnSearch" Width="60" Height="22" runat="server" 
                         ImageUrl="~/Web/images/Btnsearch.gif" onclick="imgbutnSearch_Click" /> 
                     <asp:ImageButton ID="imgbtnNew" runat="server"  Width="60" Height="22" 
                         ImageUrl="~/Web/images/btnadd.gif" onclick="imgbtnNew_Click"/>
                 </td>
             </tr>
             <tr>
                 <td colspan="5" class="bottomtd">
                     <asp:GridView ID="GridView1" Width="100%"  runat="server"  AutoGenerateColumns="False" DataKeyNames="NoteID">
                         <Columns>
                             <asp:TemplateField HeaderText="记录编号" HeaderStyle-HorizontalAlign="Center">
                                 <ItemTemplate>
                                     <asp:Label ID="Label4" runat="server" Text='<%# Eval("NoteID") %>'></asp:Label>
                                 </ItemTemplate>
                                 <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                 <ItemStyle HorizontalAlign="Center" />
                             </asp:TemplateField>
                             <asp:TemplateField HeaderText="联系人姓名" HeaderStyle-HorizontalAlign="Center">
                                 <ItemTemplate>
                                     <asp:Label ID="Label5" runat="server" Text='<%# Eval("LinkmanName") %>'></asp:Label>
                                 </ItemTemplate>
                                 <ItemStyle Width="120px" HorizontalAlign="Center" />
                                 <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                 <ItemStyle HorizontalAlign="Center" />
                             </asp:TemplateField>
                             <asp:TemplateField HeaderText="所属客户(公司)" HeaderStyle-HorizontalAlign="Center">
                                 <ItemTemplate>
                                     <asp:Label ID="Label6" runat="server" Text='<%# Eval("CustomerName") %>'></asp:Label>
                                 </ItemTemplate>
                                 <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                 <ItemStyle HorizontalAlign="Center" />
                             </asp:TemplateField>
                             <asp:TemplateField HeaderText="联系时间" HeaderStyle-HorizontalAlign="Center">
                                 <ItemTemplate>
                                     <asp:Label ID="Label7" runat="server" Text='<%# Eval("ContactTime") %>'></asp:Label>
                                 </ItemTemplate>
                                 <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                 <ItemStyle HorizontalAlign="Center" />
                             </asp:TemplateField>
                             <asp:TemplateField HeaderText="联系方式" HeaderStyle-HorizontalAlign="Center">
                                 <ItemTemplate>
                                     <asp:Label ID="Label9" runat="server" Text='<%# Eval("Method") %>'></asp:Label>
                                 </ItemTemplate>
                                 <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                 <ItemStyle HorizontalAlign="Center" />
                             </asp:TemplateField>
                             <asp:TemplateField HeaderText="操作员工" HeaderStyle-HorizontalAlign="Center">
                                 <ItemTemplate>
                                     <asp:Label ID="Label10" runat="server" Text='<%#Eval("UserName") %>'></asp:Label>
                                 </ItemTemplate>
                                 <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                 <ItemStyle HorizontalAlign="Center" />
                             </asp:TemplateField>
                             <asp:TemplateField HeaderText="联系内容" HeaderStyle-HorizontalAlign="Center">
                                 <ItemTemplate>
                                     <asp:Label ID="Label10" runat="server" Text='<%#Eval("Note").ToString().Length>5?Eval("Note").ToString().Substring(0,5)+"…":Eval("Note").ToString()  %>'></asp:Label>
                                 </ItemTemplate>
                                 <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                 <ItemStyle HorizontalAlign="Center" />
                             </asp:TemplateField>
                        

                                                 
                             <asp:HyperLinkField DataNavigateUrlFields="NoteID" 
                                 DataNavigateUrlFormatString="ContactRecordUpdate.aspx?ID={0}" HeaderText="操作" 
                                 Text="查看并修改">
                             <HeaderStyle HorizontalAlign="Center" />
                             <ItemStyle HorizontalAlign="Center" />
                             </asp:HyperLinkField>
                         </Columns>
                     </asp:GridView>
                 </td>
             </tr>
             <tr>
              <td  colspan="5">
                  <webdiyer:AspNetPager ID="AspNetPager1" runat="server"   CssClass="paginator" CurrentPageButtonClass="cpb"
                      onpagechanged="AspNetPager1_PageChanged">
                  </webdiyer:AspNetPager>
                 </td>
             </tr>

     </table>

    </div>
    </form>
</body>
</html>

 后台代码:

   /// <summary>
        /// 查询所有联系人信息
        /// </summary>
        private void getallPageList()
        {
            this.AspNetPager1.RecordCount = SqlComm.getDataCountByCondition("dbo.View_CRMContactRecordInfo", condition);
            this.AspNetPager1.PageSize = pagesize;
            this.GridView1.DataSource = SqlComm.getDataByPageIndex("dbo.View_CRMContactRecordInfo", "*", "NoteID", condition, pageindex, pagesize);
            this.GridView1.DataBind();           
        }

 

posted @ 2016-10-27 21:32  石shi  阅读(441)  评论(0编辑  收藏  举报