标签:时间 sql string oct base ace tcl 联系 sub
前台显示的界面:
<%@ 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(); }
标签:时间 sql string oct base ace tcl 联系 sub
原文地址:http://www.cnblogs.com/sunliyuan/p/6071849.html