public void ProcessRequest(HttpContext context) { try { Utils.WriteTraceLog("DeleteSelectedVehicleThroughDriver start"); StreamReader reader = new StreamReader(context.Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); string ResultCode = string.Empty; BLLDrivers bLLDrivers = new BLLDrivers(); BLLBus bLLBus = new BLLBus(); BLLUsers bLLUsers = new BLLUsers(); Dictionary <string, object> dict = new Dictionary <string, object>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); RequestData requestData = jsSerializer.Deserialize <RequestData>(str); if (requestData == null) { ResultCode = "3301"; } else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null) { ResultCode = "3302"; } else if (requestData.DriverID == string.Empty || requestData.DriverID == null) { ResultCode = "3303"; } else if (!bLLDrivers.verifyDriverID(requestData.DriverID, requestData.AccessToken)) { ResultCode = "3304"; } else if (requestData.BusID == string.Empty || requestData.BusID == null) { ResultCode = "3305"; } else { bool result = false; string[] userIDList = bLLBus.getUserIDListByBusID(requestData.BusID); if (userIDList == null) { result = bLLBus.deleteBusInfoByBusID(requestData.BusID); ResultCode = "0000"; } else { for (int i = 0; i < userIDList.Length; i++) { bLLUsers.deleteSelectedVehicle(userIDList[i], requestData.BusID); } result = bLLBus.deleteBusInfoByBusID(requestData.BusID); ResultCode = "0000"; } } dict.Add("ResultCode", ResultCode); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("DeleteSelectedVehicleThroughDriver ResultCode====" + ResultCode); Utils.WriteTraceLog("DeleteSelectedVehicleThroughDriver end"); } catch (Exception ex) { Dictionary <string, string> dict = new Dictionary <string, string>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); dict.Add("ResultCode", "9991"); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("DeleteSelectedVehicleThroughDriver Exception " + ex); Utils.WriteTraceLog("DeleteSelectedVehicleThroughDriver ResultCode====9991"); Utils.WriteTraceLog("DeleteSelectedVehicleThroughDriver end"); } }
public void ProcessRequest(HttpContext context) { try { Utils.WriteTraceLog("GetStudentsSort start"); StreamReader reader = new StreamReader(context.Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); string ResultCode = string.Empty; BLLDrivers bLLDrivers = new BLLDrivers(); BLLBus bLLBus = new BLLBus(); BLLUsers bLLUsers = new BLLUsers(); Dictionary <string, object> dict = new Dictionary <string, object>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); RequestData requestData = jsSerializer.Deserialize <RequestData>(str); if (requestData == null) { ResultCode = "2401"; } else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null) { ResultCode = "2402"; } else if (requestData.DriverID == string.Empty || requestData.DriverID == null) { ResultCode = "2403"; } else if (!bLLDrivers.verifyDriverID(requestData.DriverID, requestData.AccessToken)) { ResultCode = "2404"; } else if (requestData.BusID == string.Empty || requestData.BusID == null) { ResultCode = "2405"; } else { string[] userIDArray = bLLBus.getUserIDListByBusID(requestData.BusID); if (userIDArray == null) { ResultCode = "2406"; } else { ResultCode = "0000"; string[] userInfoArray = new string[userIDArray.Length]; for (int i = 0; i < userIDArray.Length; i++) { UserInfo userInfo = bLLUsers.GetuserInfo(userIDArray[i]); Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("StudentID", userInfo.userid); dictionary.Add("StudentName", userInfo.username); dictionary.Add("FamilyAddress", userInfo.address); userInfoArray[i] = jsSerializer.Serialize(dictionary); } dict.Add("StudentsSortArray", userInfoArray); } } dict.Add("ResultCode", ResultCode); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("GetStudentsSort ResultCode====" + ResultCode); Utils.WriteTraceLog("GetStudentsSort end"); } catch (Exception ex) { Dictionary <string, string> dict = new Dictionary <string, string>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); dict.Add("ResultCode", "9991"); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("GetStudentsSort Exception " + ex); Utils.WriteTraceLog("GetStudentsSort ResultCode====9991"); Utils.WriteTraceLog("GetStudentsSort end"); } }
public void ProcessRequest(HttpContext context) { try { Utils.WriteTraceLog("GetDriverAddedVehicles start"); StreamReader reader = new StreamReader(context.Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); string ResultCode = string.Empty; BLLDrivers bLLDrivers = new BLLDrivers(); BLLBus bLLBus = new BLLBus(); Dictionary <string, object> dict = new Dictionary <string, object>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); RequestData requestData = jsSerializer.Deserialize <RequestData>(str); if (requestData == null) { ResultCode = "2201"; } else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null) { ResultCode = "2202"; } else if (requestData.DriverID == string.Empty || requestData.DriverID == null) { ResultCode = "2203"; } else if (!bLLDrivers.verifyDriverID(requestData.DriverID, requestData.AccessToken)) { ResultCode = "2204"; } else if (bLLBus.getBusInfoByDriverID(requestData.DriverID) == null) { ResultCode = "2205"; } else { ResultCode = "0000"; List <BusInfo> busList = bLLBus.getBusInfoByDriverID(requestData.DriverID); string[] busArray = new string[busList.Count]; for (int i = 0; i < busArray.Length; i++) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("BusID", busList[i].busid); dictionary.Add("BusPWD", busList[i].buspwd); dictionary.Add("BusName", busList[i].busname); busArray[i] = jsSerializer.Serialize(dictionary); } dict.Add("VehiclesArray", busArray); } dict.Add("ResultCode", ResultCode); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("GetDriverAddedVehicles ResultCode====" + ResultCode); Utils.WriteTraceLog("GetDriverAddedVehicles end"); } catch (Exception ex) { Dictionary <string, string> dict = new Dictionary <string, string>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); dict.Add("ResultCode", "9991"); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("GetDriverAddedVehicles Exception " + ex); Utils.WriteTraceLog("GetDriverAddedVehicles ResultCode====9991"); Utils.WriteTraceLog("GetDriverAddedVehicles end"); } }
public void ProcessRequest(HttpContext context) { try { Utils.WriteTraceLog("UploadStudentsSort start"); StreamReader reader = new StreamReader(context.Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); string ResultCode = string.Empty; BLLDrivers bLLDrivers = new BLLDrivers(); BLLBus bLLBus = new BLLBus(); Dictionary <string, object> dict = new Dictionary <string, object>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); RequestData requestData = jsSerializer.Deserialize <RequestData>(str); if (requestData == null) { ResultCode = "2501"; } else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null) { ResultCode = "2502"; } else if (requestData.DriverID == string.Empty || requestData.DriverID == null) { ResultCode = "2503"; } else if (!bLLDrivers.verifyDriverID(requestData.DriverID, requestData.AccessToken)) { ResultCode = "2504"; } else if (requestData.BusID == string.Empty || requestData.BusID == null) { ResultCode = "2505"; } else if (requestData.StudentsSortArray == null || requestData.StudentsSortArray.Count == 0) { ResultCode = "2506"; } else { ArrayList tmpArrList = new ArrayList(); foreach (object item in requestData.StudentsSortArray) { RequestArrayData requestArrayData = jsSerializer.Deserialize <RequestArrayData>(item.ToString()); tmpArrList.Add(requestArrayData); } requestData.StudentsSortData = tmpArrList; int j = 0; string[] useridList = new string[requestData.StudentsSortData.Count]; foreach (RequestArrayData dataItem in requestData.StudentsSortData) { useridList[j] = dataItem.StudentID; j++; } int row = bLLBus.updateUseridList(requestData.BusID, useridList); if (row > 0) { ResultCode = "0000"; } else { ResultCode = "2507"; } } dict.Add("ResultCode", ResultCode); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("UploadStudentsSort ResultCode====" + ResultCode); Utils.WriteTraceLog("UploadStudentsSort end"); } catch (Exception ex) { Dictionary <string, string> dict = new Dictionary <string, string>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); dict.Add("ResultCode", "9991"); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("UploadStudentsSort Exception " + ex); Utils.WriteTraceLog("UploadStudentsSort ResultCode====9991"); Utils.WriteTraceLog("UploadStudentsSort end"); } }
public void ProcessRequest(HttpContext context) { try { Utils.WriteTraceLog("UploadDriverAddVehicle start"); StreamReader reader = new StreamReader(context.Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); string ResultCode = string.Empty; BLLDrivers bLLDrivers = new BLLDrivers(); BLLBus bLLBus = new BLLBus(); Dictionary <string, string> dict = new Dictionary <string, string>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); RequestData requestData = jsSerializer.Deserialize <RequestData>(str); if (requestData == null) { ResultCode = "2301"; } else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null) { ResultCode = "2302"; } else if (requestData.DriverID == string.Empty || requestData.DriverID == null) { ResultCode = "2303"; } else if (!bLLDrivers.verifyDriverID(requestData.DriverID, requestData.AccessToken)) { ResultCode = "2304"; } else if (requestData.BusName == string.Empty || requestData.BusName == null) { ResultCode = "2306"; } else if (bLLBus.IsBusNameExists(requestData.BusName)) { ResultCode = "2307"; } else { BusInfo newBusInfo = bLLBus.driverAddVehicle(requestData.DriverID, requestData.BusName); if (newBusInfo == null) { ResultCode = "2305"; } else { ResultCode = "0000"; dict.Add("BusID", newBusInfo.busid); dict.Add("BusPWD", newBusInfo.buspwd); dict.Add("BusName", newBusInfo.busname); } } dict.Add("ResultCode", ResultCode); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("UploadDriverAddVehicle ResultCode====" + ResultCode); Utils.WriteTraceLog("UploadDriverAddVehicle end"); } catch (Exception ex) { Dictionary <string, string> dict = new Dictionary <string, string>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); dict.Add("ResultCode", "9991"); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("UploadDriverAddVehicle Exception " + ex); Utils.WriteTraceLog("UploadDriverAddVehicle ResultCode====9991"); Utils.WriteTraceLog("UploadDriverAddVehicle end"); } }