我有一个订单提交页面。在该页面上有一个提交订单的按钮。我希望客户只能在约会时提交一次订单 [英] I have a order submit page. On that page there is a button to submit order. I want customer can only submit order once on a date

查看:170
本文介绍了我有一个订单提交页面。在该页面上有一个提交订单的按钮。我希望客户只能在约会时提交一次订单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个订单提交页面。在该页面上有一个提交订单的按钮。我的业务规则是客户只能在约会时提交一次订单。例如,如果客户c1在2017年10月29日提交订单,那么c1将无法在2017年10月29日再次提交。我希望该按钮在该日为该用户禁用。请让我知道我该怎么做



我尝试过:



i have a order submit page. on that page there is a button to submit order. my business rule is that a customer can only submit order once on a date. for example if a customer c1 submit order on 29 Oct 2017 then c1 cannot submit again on 29 oct 2017. i want that button to be disable for that day for that user. please let me know how can i do this

What I have tried:

i have a order submit page. on that page there is a button to submit order. my business rule is that a customer can only submit order once on a date. for example if a customer c1 submit order on 29 Oct 2017 then c1 cannot submit again on 29 oct 2017. i want that button to be disable for that day for that user. please let me know how can i do this 

推荐答案

解决方案很简单。



您可能将订单存储在数据库表中。打开订单页面时,调用数据库并检查数据库表中是否存在当前日期和登录用户的订单。如果您在数据库中找到订单详细信息,只需禁用该按钮。如果您在数据库中找不到订单详细信息,则应启用该按钮。您可以在JS中使用button.disabled = true来禁用该按钮。
The solution is very simple.

You might be storing orders in a database table. while order page is being opened, make a call to database and check if there is an order in database table for the current date and logged in user. If you find order details in database, just disable the button. If you do not find order details in database then the button should be enabled. You can use button.disabled = true in JS to disable the button.


使用以下SQL存储过程来检查,更改适当的列。



Use following SQL Store Procedure to check , Change the columns appropriated.

CREATE PROCEDURE CHECK_ORDER
(
   @DATE DATETIME,
   @USER_ID BIGINT
)
AS
BEGIN
   IF EXISTS(SELECT USER_ID FROM TBL_ORDER WHERE CREATED_DATE = @DATE AND CREATED_BY=@USER_ID)
   BEGIN
        SELECT 'NOT ALLOW' AS [STATUS_TEXT]
   END
   ELSE
   BEGIN
        SELECT 'ALLOW' AS [STATUS_TEXT]
   END
END





在页面加载事件中使用[STATUS_TEXT]来禁用该按钮。





Use [STATUS_TEXT] in page load event to disable the button.

/// C#
/// SQL STORE PROCEDURE CALLING
/// string _result = (string)objCommand.ExecuteScalar();

protected void load(object sender,EventArgs e)
{
   // SQL STORE PROCEDURE CALLING
   // SQL CALLING STUFF
   string _result = (string)objCommand.ExecuteScalar();
   if(_result=="ALLOW")
   {
      btnSubmitOrder.Enabled = true;
   }
   else
   {
      btnSubmitOrder.Enabled = false;
   }   
}
<pre>


这篇关于我有一个订单提交页面。在该页面上有一个提交订单的按钮。我希望客户只能在约会时提交一次订单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆