c# - In my booking page how to prevent many users to select same truck at same time? -
in booking page how prevent many users select same truck @ same time ?
in scenario when 2 user selecting truck imediately available have allow first user few milliseconds before second customer..
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 truckregistration 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 before you, kindly choose trailor!", messagetype.warning); } }
create shared lock object on server side truck reserve , check it.
Comments
Post a Comment