ERP反馈信息管理(十九)

前台显示的界面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomerFeedback.aspx.cs"
    Inherits="BioErpWeb.CRMSystem.CustomerFeedback" %>
<!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>
    <script src="../Scripts/cld.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">
    <div>
        <table class="maintable">
            <tr>
                <td colspan="2" class="titlebar">
                    客户反馈信息记录
                </td>
            </tr>
            <tr>
                <td class="style1">
                    主题</td>
                <td class="style1">
                    <asp:TextBox ID="txtSubJect" runat="server"></asp:TextBox>
                </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="选择客户" CausesValidation="false" UseSubmitBehavior="false" OnClientClick="showCustomerDialog()" />
                </td>
            </tr>
            <tr>
                <td class="style1">
                    反馈人</td>
                <td class="style1">
                    <asp:DropDownList ID="ddlLinkMan" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    调查时间
                </td>
                <td>
                  <asp:TextBox ID="txtInvestigateTime" CssClass="required" onfocus="setday(this);" onclick="setday(this);"  runat="server"></asp:TextBox>
                   

                </td>
            </tr>
            <tr>
                <td>
                    回复时间</td>
                <td>
                  <asp:TextBox ID="txtRevertTime" onfocus="setday(this);" onclick="setday(this);" CssClass="required" runat="server"></asp:TextBox>
                  
                </td>
            </tr>
            <tr>
                <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>
                    <asp:TextBox ID="txtRemark" Width="552px" Height="101px" CssClass="required" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2" 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>

 存储过程(添加):

ALTER PROCEDURE [dbo].[BioCrmCustomerFeedback_ADD]
@Subject nvarchar(100),
@UserID int,
@CustomerID int,
@LinkmanID int,
@FeedbackType nvarchar(100),
@InvestigateTime datetime,
@RevertTime datetime,
@Remark nvarchar(200)
 AS 
	INSERT INTO [BioCrmCustomerFeedback](
	[Subject],[UserID],[CustomerID],[LinkmanID],[FeedbackType],[InvestigateTime],[RevertTime],[Remark]
	)VALUES(
	@Subject,@UserID,@CustomerID,@LinkmanID,@FeedbackType,@InvestigateTime,@RevertTime,@Remark
	)

 修改的存储过程:

ALTER PROCEDURE [dbo].[BioCrmCustomerFeedback_Update]
@FeedbackID int,
@Subject nvarchar(100),
@UserID int,
@CustomerID int,
@LinkmanID int,
@FeedbackType nvarchar(100),
@InvestigateTime datetime,
@RevertTime datetime,
@Remark nvarchar(200),
@DeleteState bit
 AS 
	UPDATE [BioCrmCustomerFeedback] SET 
	[Subject] = @Subject,[UserID] = @UserID,[CustomerID] = @CustomerID,[LinkmanID] = @LinkmanID,[FeedbackType]
= @FeedbackType,[InvestigateTime] = @InvestigateTime,[RevertTime] = @RevertTime,[Remark] = @Remark,[DeleteState] = @DeleteState WHERE FeedbackID=@FeedbackID

添加的后台代码:

  protected void Page_Load(object sender, EventArgs e)
        {
          
            Session["Userid"] = "29";
            if (Session["Userid"] == null)
            {
                Response.Redirect("~/Web/Desk.aspx");
            }
           
        
        }



        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BioCrmCustomerFeedback feedback = new BioCrmCustomerFeedback()
            {
                Subject=this.txtSubJect.Text,
                UserID = int.Parse(Session["Userid"].ToString()),
                RevertTime= Convert.ToDateTime(this.txtRevertTime.Text),
                Remark=this.txtRemark.Text,
                LinkmanID= int.Parse(ddlLinkMan.SelectedValue.ToString()),
                CustomerID=int.Parse(this.txtCustomerID.Text),
                FeedbackType=this.ddlMethod.SelectedItem.Text,
                InvestigateTime=Convert.ToDateTime(this.txtInvestigateTime.Text)                 
                         
             
            };
            BioCrmCustomerFeedbackBLL feedbackbll = new BioCrmCustomerFeedbackBLL();
            if (feedbackbll.BioCrmCustomerFeedbackAdd(feedback) != 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('反馈记录保存成功')", true);
            }
        }

 定义一个查询视图:

SELECT   dbo.BioCrmCustomerFeedback.FeedbackID, dbo.BioCrmCustomerFeedback.Subject, 
                dbo.BioCrmCustomerFeedback.UserID, dbo.BioCrmCustomerFeedback.CustomerID, 
                dbo.BioCrmCustomerFeedback.LinkmanID, dbo.BioCrmCustomerFeedback.FeedbackType, 
                dbo.BioCrmCustomerFeedback.InvestigateTime, dbo.BioCrmCustomerFeedback.RevertTime, 
                dbo.BioCrmCustomerFeedback.Remark, dbo.BioCrmCustomerFeedback.DeleteState, 
                dbo.BioCrmCustomer.CustomerName, dbo.BioCrmLinkmanInfo.LinkmanName, dbo.UserManager.UserName
FROM      dbo.BioCrmCustomerFeedback INNER JOIN
                dbo.BioCrmCustomer ON dbo.BioCrmCustomerFeedback.CustomerID = dbo.BioCrmCustomer.CustomerID INNER JOIN
                dbo.BioCrmLinkmanInfo ON dbo.BioCrmCustomerFeedback.LinkmanID = dbo.BioCrmLinkmanInfo.LinkmanID INNER JOIN
                dbo.UserManager ON dbo.BioCrmCustomerFeedback.UserID = dbo.UserManager.UserId

 显示的界面:

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

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

<%@ 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>
    <script src="../JS/CustomerName.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
 
        <uc1:CRMMenuBar ID="CRMMenuBar1" runat="server" />
 
    </div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <div>
         <table class="maintable" style=" width:900px;">
             <tr>
                 <td colspan="4" class="titlebar">
                     <span>客户反馈记录信息管理</span>
                 </td>
             </tr>
             <tr>
                 <td class="tdsearch">
                       <asp:Label ID="Label2" runat="server" Text="客户名:"></asp:Label>
                      <asp:TextBox ID="txtCustomerID" runat="server"></asp:TextBox>
                     <input ID="Button1" value="选择客户" type="button" Width="60px"  onclick="showCustomerDialog()" />
                 </td>
                 <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="Label3" runat="server" Text="联系时间"></asp:Label>
                     <asp:TextBox ID="txtContactTime" runat="server"></asp:TextBox>
                     <cc1:CalendarExtender ID="CalendarExtender1" TargetControlID="txtContactTime" Format="yyyy-MM-dd" runat="server">
                     </cc1:CalendarExtender>

                 </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="4" class="bottomtd">
                     <asp:GridView ID="GridView1" Width="100%"  runat="server"  AutoGenerateColumns="False" DataKeyNames="FeedbackID">
                         <Columns>
                             <asp:TemplateField HeaderText="记录编号" HeaderStyle-HorizontalAlign="Center">
                                 <ItemTemplate>
                                     <asp:Label ID="Label4" runat="server" Text='<%# Eval("FeedbackID") %>'></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("Subject") %>'></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="Label6" runat="server" Text='<%# Eval("LinkmanName") %>'></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("FeedbackType") %>'></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='<%# Convert.ToDateTime(Eval("InvestigateTime")).ToString("yyyy-MM-dd") %>'></asp:Label>
                                 </ItemTemplate>
                                 <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                 <ItemStyle HorizontalAlign="Center" />
                             </asp:TemplateField>

                                <asp:TemplateField HeaderText="回复时间" HeaderStyle-HorizontalAlign="Center">
                                 <ItemTemplate>
                                     <asp:Label ID="lbreverttime" runat="server" Text='<%# Convert.ToDateTime(Eval("RevertTime")).ToString("yyyy-MM-dd") %>'></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="lbremark" runat="server" Text='<%#Eval("Remark").ToString().Length>5?Eval("Remark").ToString().Substring(0,5)+"…":Eval("Remark").ToString()  %>'></asp:Label>
                                 </ItemTemplate>
                                 <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                 <ItemStyle HorizontalAlign="Center" />
                             </asp:TemplateField>
                             <asp:HyperLinkField DataNavigateUrlFields="FeedbackID" 
                                 DataNavigateUrlFormatString="ContactRecordUpdate.aspx?ID={0}" HeaderText="操作" 
                                 Text="查看并修改">
                             <HeaderStyle HorizontalAlign="Center" />
                             <ItemStyle HorizontalAlign="Center" />
                             </asp:HyperLinkField>
                         </Columns>
                     </asp:GridView>
                 </td>
             </tr>
             <tr>
              <td  colspan="4">
                  <webdiyer:AspNetPager ID="AspNetPager1" runat="server"   CssClass="paginator" CurrentPageButtonClass="cpb"
                      onpagechanged="AspNetPager1_PageChanged">
                  </webdiyer:AspNetPager>
                 </td>
             </tr>

     </table>

    </div>
    
    </ContentTemplate>
    </asp:UpdatePanel>
    
    </form>
</body>
</html>

查询的代码:

  public static int pageindex = 0;
        public static int pagesize = 10;
        public static string condition = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            
           if (!IsPostBack)
            {

               getallPageList();
            }
        }

   

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

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            pageindex = this.AspNetPager1.CurrentPageIndex - 1;
            getallPageList();
        }

        protected void imgbutnSearch_Click(object sender, ImageClickEventArgs e)
        {
            pageindex = 0;
            condition = "";
           

            getallPageList();
        }

 修改的BLL层:

  /// <summary>
      /// 修改业务
      /// </summary>
      /// <param name="model">BioCrmCustomerFeedback</param>
      /// <returns>int</returns>
      public int BioCrmCustomerFeedbackUpdate(BioCrmCustomerFeedback model)
      {
          SqlParameter[] parameters = {
					new SqlParameter("@FeedbackID", SqlDbType.Int,4),
					new SqlParameter("@Subject", SqlDbType.NVarChar,100),
					new SqlParameter("@UserID", SqlDbType.Int,4),
					new SqlParameter("@CustomerID", SqlDbType.Int,4),
					new SqlParameter("@LinkmanID", SqlDbType.Int,4),
					new SqlParameter("@FeedbackType", SqlDbType.NVarChar,100),
					new SqlParameter("@InvestigateTime", SqlDbType.DateTime),
					new SqlParameter("@RevertTime", SqlDbType.DateTime),
					new SqlParameter("@Remark", SqlDbType.NVarChar,200),
					new SqlParameter("@DeleteState", SqlDbType.Bit,1)};
          parameters[0].Value = model.FeedbackID;
          parameters[1].Value = model.Subject;
          parameters[2].Value = model.UserID;
          parameters[3].Value = model.CustomerID;
          parameters[4].Value = model.LinkmanID;
          parameters[5].Value = model.FeedbackType;
          parameters[6].Value = model.InvestigateTime;
          parameters[7].Value = model.RevertTime;
          parameters[8].Value = model.Remark;
          parameters[9].Value = model.DeleteState;
        return  DataBaseHelper.ExcuteSqlReturnInt("BioCrmCustomerFeedback_Update", CommandType.StoredProcedure, parameters);

      }

 修改的界面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomerFeedbackEdit.aspx.cs"
    Inherits="BioErpWeb.CRMSystem.CustomerFeedbackEdit" %>
<!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>
    <script src="../Scripts/cld.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">
    <div>
        <table class="maintable">
            <tr>
                <td colspan="2" class="titlebar">
                    客户反馈信息记录
                </td>
            </tr>
            <tr>
                <td class="style1">
                    主题</td>
                <td class="style1">
                    <asp:TextBox ID="txtSubJect" runat="server"></asp:TextBox>
                </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="选择客户" CausesValidation="false" UseSubmitBehavior="false" OnClientClick="showCustomerDialog()" />
                </td>
            </tr>
            <tr>
                <td class="style1">
                    反馈人</td>
                <td class="style1">
                    <asp:DropDownList ID="ddlLinkMan" runat="server">
                    </asp:DropDownList>
                    <asp:HyperLink ID="HyperLink1" NavigateUrl="~/CRMSystem/LinkManAdd.aspx" runat="server">添加联系人</asp:HyperLink>
                </td>
            </tr>
            <tr>
                <td>
                    调查人</td>
                <td>
                    <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
                    <asp:Button ID="btn" runat="server" Text="选择员工"  OnClientClick="showDialog()" UseSubmitBehavior="false"/>

                </td>
            </tr>
            <tr>
                <td>
                    调查时间
                </td>
                <td>
                  <asp:TextBox ID="txtInvestigateTime" CssClass="required" onfocus="setday(this);" onclick="setday(this);"  runat="server"></asp:TextBox>
                   

                </td>
            </tr>
            <tr>
                <td>
                    回复时间</td>
                <td>
                  <asp:TextBox ID="txtRevertTime" onfocus="setday(this);" onclick="setday(this);" CssClass="required" runat="server"></asp:TextBox>
                  
                </td>
            </tr>
            <tr>
                <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>
                    <asp:TextBox ID="txtRemark" Width="552px" Height="101px" CssClass="required" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    删除状态</td>
                <td>
                    <asp:CheckBox ID="cbDelete" Text="是" runat="server" />
                </td>
            </tr>
            <tr>
                <td colspan="2" class="bottomtd">
                    <asp:Button ID="btnSubmit" runat="server" Text="客户反馈信息记录保存" OnClick="btnSubmit_Click" />
                    <asp:Button ID="btnReturn" runat="server" Text="返回列表" OnClick="btnReturn_Click" UseSubmitBehavior="false" />
                </td>
            </tr>
        </table>
        <br />
    </div>
    </form>
</body>
</html>

 后台修改的代码:

 public partial class CustomerFeedbackEdit: System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
          
            Session["Userid"] = "29";
            if (Session["Userid"] == null)
            {
                Response.Redirect("~/Web/Desk.aspx");
            }
            if (!IsPostBack)
            {
                getpageInfobind();
            }
        
        }

        /// <summary>
        /// 绑定页面基本信息
        /// </summary>
        private void getpageInfobind()
        {
            if (Request.QueryString["ID"] == null)
            {
                Response.Redirect("CustomerFeedbackList.aspx");
                return;
            }

         
            string id=Request.QueryString["ID"].ToString();
           
            System.Data.SqlClient.SqlDataReader reader= SqlComm.GetDataReaderByCondition("BioCrmCustomerFeedback", "*", " FeedbackID=" + id);

          
           while (reader.Read())
           {
               this.txtSubJect.Text = reader["Subject"].ToString();
               this.txtRevertTime.Text = reader["RevertTime"].ToString();
               this.txtRemark.Text = reader["Remark"].ToString();
               this.txtInvestigateTime.Text = reader["InvestigateTime"].ToString();
               this.txtCustomerID.Text = reader["CustomerID"].ToString();
               //绑定反馈信息的联系人
               ddlLinkManband(reader["LinkmanID"].ToString());               
               this.ddlMethod.SelectedItem.Text = reader["FeedbackType"].ToString();
               this.cbDelete.Checked =Convert.ToBoolean( reader["DeleteState"].ToString());
               this.txtUserName.Text = reader["UserID"].ToString();
           } 

        
        }

        /// <summary>
        /// 绑定反馈信息的联系人
        /// </summary>
        /// <param name="linkmanid"></param>
        private void ddlLinkManband(string linkmanid)
        {
            ddlLinkMan.DataSource = SqlComm.GetDataByCondition("BioCrmLinkmanInfo","LinkmanID,LinkmanName"," LinkmanID="+linkmanid);
            ddlLinkMan.DataTextField = "LinkmanName";
            ddlLinkMan.DataValueField = "LinkmanID";
            ddlLinkMan.DataBind();
            ddlLinkMan.SelectedValue = linkmanid;
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BioCrmCustomerFeedback feedback = new BioCrmCustomerFeedback()
            {
                FeedbackID=int.Parse(Request.QueryString["ID"].ToString()),
                Subject=this.txtSubJect.Text,
                UserID = int.Parse(Session["Userid"].ToString()),
                RevertTime= Convert.ToDateTime(this.txtRevertTime.Text),
                Remark=this.txtRemark.Text,
                LinkmanID= int.Parse(ddlLinkMan.SelectedValue.ToString()),
                CustomerID=int.Parse(this.txtCustomerID.Text),
                FeedbackType=this.ddlMethod.SelectedItem.Text,
                InvestigateTime=Convert.ToDateTime(this.txtInvestigateTime.Text),
                DeleteState=cbDelete.Checked                        
             
            };
            BioCrmCustomerFeedbackBLL feedbackbll = new BioCrmCustomerFeedbackBLL();
            if (feedbackbll.BioCrmCustomerFeedbackUpdate(feedback) != 0)
            {
                Response.Redirect("CustomerFeedbackList.aspx");
            }

        }

        protected void btnReturn_Click(object sender, EventArgs e)
        {
            Server.Transfer("CustomerFeedbackList.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"));
                }
            }
        }
    }

 查询拼结的代码:

   protected void imgbutnSearch_Click(object sender, ImageClickEventArgs e)
        {
            pageindex = 0;
            condition = "";
            if (this.txtSubject.Text.Trim() != null && this.txtSubject.Text.Trim().Length != 0)
            {
                condition = condition + " and Subject like '" + txtSubject.Text + "%'";
            }

            if (this.txtCustomerID.Text.Trim() != null && this.txtCustomerID.Text.Trim().Length != 0)
            {
                condition = condition + " and CustomerID  ='" + this.txtCustomerID.Text + "'";
            }

            if (this.txts.Text != "" && this.txtend.Text != "")
            {
                condition = condition + " and (InvestigateTime  >='" + this.txts.Text + "' and InvestigateTime<'" + this.txtend.Text + "')";
            }
            getallPageList();
        }

 自已定义js验证的扩展方法:

jQuery.extend(
jQuery.validator.messages, {
required: "必选字段",
remote: "请修正该字段",
email: "请输入正确格式的电子邮件",
url: "请输入合法的网址",
date: "请输入合法的日期",
dateISO: "请输入合法的日期 (如:2011-11-02).",
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} 的值")
});

 

posted @ 2016-11-16 22:39  石shi  阅读(220)  评论(0编辑  收藏  举报