2016-08-08 6 views
1

予約ページで、多くのユーザーが同じトラックを同時に選択しないようにする方法 ? 2ユーザーは、私はほんの数ミリ秒の顧客の前にある唯一の最初のユーザーを許可する必要がありimediately利用可能であるトラックを選択されたシナリオで予約ページで、多くのユーザーが同じトラックを同時に選択することを防ぐ方法を教えてください。

..

System.Web.UI.WebControls.Button lnkreport1 = (System.Web.UI.WebControls.Button)e.CommandSource; 

    string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ';' }); 
    truckid.Text = commandArgs[0]; 
    temp_memory_id.Text = commandArgs[1]; 


    string status=string.Empty; 
    SqlConnection con12 = new SqlConnection(ConfigurationManager.ConnectionStrings["BUM"].ConnectionString); 
    SqlCommand cmd12 = new SqlCommand(" select Tr_status from TruckRegistration where Id='" + truckid.Text + "' ", con12); 
    con12.Open(); 
    SqlDataReader dr = cmd12.ExecuteReader(); 

    while(dr.Read()) 
    { 
     status = dr["Tr_status"].ToString(); 
    } 
    con12.Close(); 


    if (temp_memory_id.Text == "Immediate") 
     { 
      if (status != "In_process") 
      { 
       mp1.Show(); 

      } 
      else 
      { 
       ShowMessage("Another customer has choosen Just before you, kindly choose another Trailor!", MessageType.Warning); 
      } 
     } 

答えて

-1

予約して確認するトラックのサーバー側に共有ロックオブジェクトを作成します。

+2

これはもっとコメントですね。 – Marco

関連する問題