private void BreakDriver() { if (ddl_Driver.SelectedValue == null) { return; } try { if (General.GetQueryable <Fleet_DriverQueueList>(null).Count(c => c.Status == true && c.DriverId == ddl_Driver.SelectedValue.ToInt()) == 0) { return; } // ddl_Driver.DropDownListElement.AutoCompleteSuggest.SU.AutoCompleteSuggest.SuggestMode int statusId = Enums.Driver_WORKINGSTATUS.ONBREAK; using (TaxiDataContext db = new TaxiDataContext()) { var obj = db.Fleet_DriverQueueLists.FirstOrDefault(c => c.Status == true && c.DriverId == ddl_Driver.SelectedValue.ToInt()); if (obj != null && (obj.DriverWorkStatusId == Enums.Driver_WORKINGSTATUS.AVAILABLE || obj.DriverWorkStatusId == Enums.Driver_WORKINGSTATUS.ONBREAK)) { if (obj.DriverWorkStatusId == Enums.Driver_WORKINGSTATUS.ONBREAK) { statusId = Enums.Driver_WORKINGSTATUS.AVAILABLE; } db.stp_ChangeDriverStatus(ddl_Driver.SelectedValue.ToInt(), statusId); new BroadcasterData().BroadCastToAll(RefreshTypes.REFRESH_DASHBOARD_DRIVER); try { int loopCnt = 1; while (loopCnt < 3) { bool success = General.SendMessageToPDA("request pda=" + ddl_Driver.SelectedValue.ToInt() + "=" + 0 + "=" + "Message>>" + "onbreak--x" + ">>" + String.Format("{0:dd/MM/yyyy HH:mm:ss}", DateTime.Now) + "=4").Result.ToBool(); if (success) { break; } else { loopCnt++; } } } catch (Exception ex) { } } } } catch { } }