presentproject.aspx

来自「动易SiteFactory&#8482 网上商店系统1.0源代码」· ASPX 代码 · 共 180 行

ASPX
180
字号
<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true"
    Inherits="PowerEasy.WebSite.Admin.Shop.PresentProjectUI" Title="促销方案管理" Codebehind="PresentProject.aspx.cs" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CphNavigation" runat="server">
    <pe:ExtendedSiteMapPath ID="SmpNavigator" SiteMapProvider="AdminMapProvider" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CphContent" runat="Server">

    <script language="javascript" type="text/javascript">
      function AddPresent()
      {
//            var arr=showModalDialog("ProductList.aspx?ProductType=4&ModelID=0","","dialogWidth:600px; dialogHeight:450px; help: no; scroll: yes; status: no");
            var newwin=window.open('PresentList.aspx?ReturnFunction=ReturnValue','','width=670,height=400,resizable=0,scrollbars=yes');
            newwin.focus();
      }
      
      function ReturnValue(strText,strValue)
      {
            var list = document.getElementById('<%=LstPresent.ClientID %>')
            var presentExists = false;

                if(list.options.length ==0)
                {
                    list.options[list.length] = new Option(strText,strValue);
                }
                else
                {
                    for(i=0;i<list.options.length;i++)
                    {   
                        if(strValue == list.options[i].value)
                        {
                            alert(strText+" 已经存在,请选择不同的礼品!");
                            presentExists = true ;
                            break;
                        }
                     }
                     if(presentExists == false)
                     {
                        list.options[list.length] = new Option(strText,strValue);
                     }
                }
      }
      
      function DelPresent()
      {
        var list = document.getElementById('<%=LstPresent.ClientID %>');
        if(list.length==0){return false;} 
        
        for(i=0;i<list.length;i++)
        {
            while(list.options[i] != null && list.options[i].selected)
            {
                list.options[i] = null;
            }

        }

        //lsit.options[list.selectedIndex]=null;
      }
      function SetHdnPresentValue()
      {
        var hdnPresent = document.getElementById('<%=HdnPresent.ClientID %>');
        var dependentList = document.getElementById('<%=LstPresent.ClientID %>');
        var idList = "";
        for(i=0;i<dependentList.options.length;i++)
        {
            if(idList =="") 
            {
                idList = dependentList.options[i].value;
            }
            else
            {
                idList = idList + "," + dependentList.options[i].value;
            }
        } 
         hdnPresent.value = idList;
      }
    </script>

    <div style="text-align: center">
        <table style="width: 100%" cellpadding="2" cellspacing="1" class="border">
            <tr align="center">
                <td colspan="2" class="spacingtitle">
                    <b>
                        <asp:Label ID="LblTitle" runat="server" Text="添加促销方案"></asp:Label></b>
                </td>
            </tr>
            <tr class="tdbg">
                <td align="right">
                    <strong>方案名称:</strong></td>
                <td align="left" style="width: 80%; height: 32px;">
                    &nbsp;&nbsp;<asp:TextBox ID="TxtProjectName" runat="server"></asp:TextBox>
                    <pe:RequiredFieldValidator ID="ValrProjectName" runat="server" ErrorMessage="方案名称不能为空"
                        ControlToValidate="TxtProjectName" Display="Dynamic"></pe:RequiredFieldValidator></td>
            </tr>
            <tr class="tdbg">
                <td align="right">
                    <strong>有效期:</strong></td>
                <td align="left" style="height: 21px; width: 80%;">
                    &nbsp;&nbsp;
                    <pe:DatePicker ID="DpkBeginDate" Width="70px" runat="server"></pe:DatePicker>
                    &nbsp;至&nbsp;
                    <pe:DatePicker ID="DpkEndDate" Width="70px" runat="server"></pe:DatePicker>
                    &nbsp;<asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="开始日期不能大于结束日期"
                        ControlToCompare="DpkBeginDate" ControlToValidate="DpkEndDate" Display="Dynamic"
                        Operator="GreaterThanEqual" Type="Date"></asp:CompareValidator>
                </td>
            </tr>
            <tr class="tdbg">
                <td align="right">
                    <strong>价格区间:</strong></td>
                <td align="left" style="height: 21px; width: 80%;">
                    &nbsp;&nbsp;<asp:TextBox ID="TxtMinMoney" runat="server" Width="40px"></asp:TextBox>
                    <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TxtMinMoney"
                        Display="Dynamic" ErrorMessage="指定金额下限不对" MaximumValue="999999" MinimumValue="0" Type="Double"></asp:RangeValidator><b style="color: blue">≤</b> 购物总金额
                    <b style="color: blue">&lt;</b>&nbsp;<asp:TextBox ID="TxtMaxMoney" runat="server"
                        Width="40px"></asp:TextBox>
                    <pe:RequiredFieldValidator ID="ValrMaxMoney" runat="server" ErrorMessage="请指定金额上限"
                        ControlToValidate="TxtMaxMoney" Display="Dynamic" RequiredText="" />
                    <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToCompare="TxtMinMoney"
                        ControlToValidate="TxtMaxMoney" Display="Dynamic" ErrorMessage="金额上限必须大于下限" Operator="GreaterThanEqual"
                        Type="Double"></asp:CompareValidator>
                    <asp:Label ID="LblMsg1" runat="server" Text="不同促销方案的价格区间必须不同,否则会产生冲突" ForeColor="blue"></asp:Label></td>
            </tr>
            <tr class="tdbg">
                <td align="right" rowspan="4">
                    <strong>促销内容:</strong></td>
                <td align="left" style="height: 21px; width: 80%;">
                    &nbsp;&nbsp;<asp:CheckBox ID="ChkPresentContent1" runat="server" />可以<asp:TextBox
                        ID="TxtPrice" runat="server" Width="40px"></asp:TextBox>元超值换购以下商品中任一款:<br />
                    <table width="100%" border="0" cellspacing="5" cellpadding="0">
                        <tr>
                            <td style="width: 20px;">
                            </td>
                            <td style="width: 200px;">
                                <asp:ListBox Width="200" Height="70" DataTextField="value" DataValueField="key" ID="LstPresent"
                                    runat="server" SelectionMode="Multiple">
                                </asp:ListBox>
                                <asp:HiddenField ID="HdnPresent" runat="server" />
                            </td>
                            <td>
                                <input type="button" class="inputbutton" onclick="AddPresent()" value="添加促销礼品" />
                                <br />
                                <br />
                                <input type="button" class="inputbutton" onclick="DelPresent()" value="删除" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr class="tdbg">
                <td align="left" style="height: 21px; width: 80%;">
                    &nbsp;&nbsp;<asp:CheckBox ID="ChkPresentContent2" runat="server" />返还<asp:TextBox
                        ID="TxtCash" runat="server" Width="40px"></asp:TextBox>元现金券</td>
            </tr>
            <tr class="tdbg">
                <td align="left" style="height: 21px; width: 80%;">
                    &nbsp;&nbsp;<asp:CheckBox ID="ChkPresentContent3" runat="server" />可以得到<asp:TextBox
                        ID="TxtPresentExp" runat="server" Width="40px"></asp:TextBox>点积分</td>
            </tr>
            <tr class="tdbg">
                <td align="left" style="height: 21px; width: 80%;">
                    &nbsp;&nbsp;<asp:CheckBox ID="ChkPresentContent4" runat="server" />可以得到<asp:TextBox
                        ID="TxtPresentPoint" runat="server" Width="40px"></asp:TextBox><%=PointUnit%><%=PointName%></td>
            </tr>
            <tr class="tdbg">
                <td colspan="2">
                    <asp:Label ID="LblMsg" Visible="false" runat="server" Text="Label" ForeColor="Red"></asp:Label>
                </td>
            </tr>
            <tr class="tdbg">
                <td colspan="2">
                    <pe:ExtendedButton IsChecked="true" OperateCode="PromotionProject" ID="BtnSubmit"
                        OnClientClick="SetHdnPresentValue();" runat="server" Text="保存方案" OnClick="BtnSubmit_Click" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?