protected void LoadData() { DataTable bus = BLLBus.getAllBusByStatus(true); ddlBus.DataSource = bus; ddlBus.DataTextField = "BusName"; ddlBus.DataValueField = "BusPlate"; ddlBus.DataBind(); ddlBus.SelectedValue = listBus.BusPlate; DataTable router = BLLRouter.getAllRouterByStatus(true); ddlRouter.DataSource = router; ddlRouter.DataTextField = "RouterName"; ddlRouter.DataValueField = "RouterID"; ddlRouter.DataBind(); ddlRouter.SelectedValue = listBus.RouterID.ToString(); txtDeparture.Text = listBus.Departure.ToShortDateString().ToString(); ddlStartTime.SelectedValue = listBus.Departure.ToShortTimeString().ToString(); txtArrival.Text = listBus.Arrival.ToShortDateString().ToString(); ddlEndTime.SelectedValue = listBus.Arrival.ToShortTimeString().ToString(); txtPrice.Text = listBus.Price.ToString(); cbStatus.Checked = listBus.Status; }
protected void lnkBtnUpdate_Click(object sender, EventArgs e) { string busName = BusName.Text; string seat = Seat.Text; string busTypeId = ddlBusType.SelectedValue.ToString(); string categoryID = ddlCategory.SelectedValue.ToString(); Bus newBus = new Bus(); newBus.BusPlate = bus.BusPlate; newBus.BusName = busName; newBus.Seat = Int32.Parse(seat); newBus.BusTypeID = Int32.Parse(busTypeId); newBus.CategoryID = Int32.Parse(categoryID); if (cbStatus.Checked) { newBus.Status = true; } else { newBus.Status = false; } BLLBus.UpdateBus(newBus); Response.Redirect("BusList.aspx"); }
protected void lnkBtnSave_Click(object sender, EventArgs e) { string busPlate = BusPlate.Text; string busName = BusName.Text; string seat = Seat.Text; string busTypeId = ddlBusType.SelectedValue.ToString(); string categoryID = ddlCategory.SelectedValue.ToString(); if (BLLBus.checkBusPlateExist(busPlate) != 0) { ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Bus Plate existed. Please try again');", true); } else { Bus bus = new Bus(); bus.BusPlate = busPlate; bus.BusName = busName; bus.Seat = Int32.Parse(seat); bus.BusTypeID = Int32.Parse(busTypeId); bus.CategoryID = Int32.Parse(categoryID); bus.Status = true; BLLBus.InsertBus(bus); Response.Redirect("BusList.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { busPlate = Request.QueryString["BusPlate"].ToString(); bus = BLLBus.getBusByID(busPlate)[0]; if (!IsPostBack) { FillData(); } }
protected override void OnPreRender(EventArgs e) { if (MultiView1.ActiveViewIndex == 1) { int listBusID = int.Parse(_listbusID.Value.ToString()); ListBus listbus = BLLListBus.getListBusByID(listBusID); Bus bus = BLLBus.getBusByID(listbus.BusPlate); Ticket[] ticket = BLLTicket.getTicketByListBusID(listBusID); int count = 1; if (chkSeat.Items.Count == 0) { for (int i = 0; i < bus.Seat; i++) { chkSeat.Items.Add(count.ToString()); for (int j = 0; j < ticket.Length; j++) { if (count == ticket[j].NumberSeat) { chkSeat.Items[i].Selected = true; chkSeat.Items[i].Enabled = false; } } count++; } } } else if (MultiView1.ActiveViewIndex == 2) { lbRouterName1.Text = lbRouterName.Text; lbDeparture2.Text = lbDeparture.Text; lbArrival2.Text = lbArrival.Text; lbPrice2.Text = lbPrice.Text; ArrayList arrSeat = new ArrayList(); for (int i = 0; i < chkSeat.Items.Count; i++) { if (chkSeat.Items[i].Selected == true & chkSeat.Items[i].Enabled == false) { int numberSeat = Int32.Parse(chkSeat.Items[i].Text); arrSeat.Add(numberSeat); } } ViewState["CountSeat"] = arrSeat; } //else if (MultiView1.ActiveViewIndex == 3) //{ // litCustomerNameStep4.Text = txtcustomername.Text; // litSeatStep4.Text = litSeat.Text; // litPriceStep4.Text = litPrices.Text; //} base.OnPreRender(e); }
protected void LoadData() { DataTable dt = BLLBus.getAllBus(); dv = new DataView(dt); dv.Sort = "BusName ASC"; total.Text = dv.Count.ToString(); gvBusList.DataSource = dv; gvBusList.DataBind(); if (gvBusList.HeaderRow != null) { gvBusList.HeaderRow.TableSection = TableRowSection.TableHeader; } }
protected void LoadData() { DataTable bus = BLLBus.getAllBusByStatus(true); ddlBus.DataSource = bus; ddlBus.DataTextField = "BusName"; ddlBus.DataValueField = "BusPlate"; ddlBus.DataBind(); DataTable router = BLLRouter.getAllRouterByStatus(true); ddlRouter.DataSource = router; ddlRouter.DataTextField = "RouterName"; ddlRouter.DataValueField = "RouterID"; ddlRouter.DataBind(); }
protected void gvListBusList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblRouter = (Label)e.Row.FindControl("Label1"); Label lblBus = (Label)e.Row.FindControl("Label2"); HiddenField hfRouterID = (HiddenField)e.Row.FindControl("HiddenField1"); HiddenField hfBusID = (HiddenField)e.Row.FindControl("HiddenField2"); int routerID = Int32.Parse(hfRouterID.Value); string busID = hfBusID.Value; Router router = BLLRouter.getRouterByID(routerID)[0]; Bus bus = BLLBus.getBusByID(busID)[0]; lblRouter.Text = router.RouterName; lblBus.Text = bus.BusName + " (" + bus.BusPlate + ")"; } }
protected void lnkDelete_Click(object sender, EventArgs e) { int test = 0; foreach (GridViewRow row in gvBusList.Rows) { CheckBox cb = (CheckBox)row.FindControl("chkSel"); if (cb.Checked) { ++test; string id = row.Cells[2].Text; int k = BLLBus.DeleteBus(id); } } if (test == 0) { ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Please select a Bus from the list to delete');", true); } else { Response.Redirect("BusList.aspx"); } }
public void ProcessRequest(HttpContext context) { try { Utils.WriteTraceLog("GetAbsentState start"); StreamReader reader = new StreamReader(context.Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); string ResultCode = string.Empty; BLLBus bLLBus = new BLLBus(); BLLUsers bLLUsers = new BLLUsers(); BLLAbsent bLLAbsent = new BLLAbsent(); Dictionary <string, object> dict = new Dictionary <string, object>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); RequestData requestData = jsSerializer.Deserialize <RequestData>(str); if (requestData == null) { ResultCode = "3101"; } else if (requestData.StudentID == string.Empty || requestData.StudentID == null) { ResultCode = "3102"; } else if (requestData.CurrentDate == string.Empty || requestData.CurrentDate == null) { ResultCode = "3103"; } else { ResultCode = "0000"; AbsentInfo absentInfo = new AbsentInfo(); absentInfo.absentdate = requestData.CurrentDate; absentInfo.absentuserid = requestData.StudentID; bool isExist = bLLAbsent.isRecordExist(absentInfo); if (isExist) { dict.Add("AbsentStatus", "true"); } else { dict.Add("AbsentStatus", "false"); } } dict.Add("ResultCode", ResultCode); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("GetAbsentState ResultCode====" + ResultCode); Utils.WriteTraceLog("GetAbsentState 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("GetAbsentState Exception " + ex); Utils.WriteTraceLog("GetAbsentState ResultCode====9991"); Utils.WriteTraceLog("GetAbsentState end"); } }
public void ProcessRequest(HttpContext context) { try { Utils.WriteTraceLog("GetParentAddedVehicles start"); StreamReader reader = new StreamReader(context.Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); string ResultCode = string.Empty; 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 = "2701"; } else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null) { ResultCode = "2702"; } else if (requestData.ParentID == string.Empty || requestData.ParentID == null) { ResultCode = "2703"; } else if (!bLLUsers.verifyUserID(requestData.ParentID, requestData.AccessToken)) { ResultCode = "2704"; } else { UserInfo userInfo = bLLUsers.GetuserInfo(requestData.ParentID); if (userInfo.busarray == null) { ResultCode = "2705"; } else { ResultCode = "0000"; string[] buss = userInfo.busarray.Split(','); List <string> busArray = new List <string>(); for (int i = 0; i < buss.Length; i++) { if (!buss[i].Equals(string.Empty)) { BusInfo busInfo = bLLBus.getBusInfoByBusID(buss[i]); if (busInfo != null) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("BusID", busInfo.busid); dictionary.Add("BusName", busInfo.busname); busArray.Add(jsSerializer.Serialize(dictionary)); } } } dict.Add("AddedVehiclesArray", busArray.ToArray()); dict.Add("SelectedVehicleBusID", userInfo.selectbusid); } } dict.Add("ResultCode", ResultCode); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("GetParentAddedVehicles ResultCode====" + ResultCode); Utils.WriteTraceLog("GetParentAddedVehicles 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("GetParentAddedVehicles Exception " + ex); Utils.WriteTraceLog("GetParentAddedVehicles ResultCode====9991"); Utils.WriteTraceLog("GetParentAddedVehicles end"); } }
public void ProcessRequest(HttpContext context) { try { Utils.WriteTraceLog("DeleteSelectedVehicleThroughParent start"); StreamReader reader = new StreamReader(context.Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); string ResultCode = string.Empty; 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 = "3401"; } else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null) { ResultCode = "3402"; } else if (requestData.ParentID == string.Empty || requestData.ParentID == null) { ResultCode = "3403"; } else if (!bLLUsers.verifyUserID(requestData.ParentID, requestData.AccessToken)) { ResultCode = "3404"; } else if (requestData.BusID == string.Empty || requestData.BusID == null) { ResultCode = "3405"; } else { bool result = bLLUsers.deleteSelectedVehicle(requestData.ParentID, requestData.BusID); if (result) { result = bLLBus.deleteSelectedVehicleByPatient(requestData.ParentID, requestData.BusID); ResultCode = "0000"; } else { ResultCode = "3406"; } } dict.Add("ResultCode", ResultCode); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("DeleteSelectedVehicleThroughParent ResultCode====" + ResultCode); Utils.WriteTraceLog("DeleteSelectedVehicleThroughParent 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("DeleteSelectedVehicleThroughParent Exception " + ex); Utils.WriteTraceLog("DeleteSelectedVehicleThroughParent ResultCode====9991"); Utils.WriteTraceLog("DeleteSelectedVehicleThroughParent 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("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("UploadParentSelectedVehicle start"); StreamReader reader = new StreamReader(context.Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); string ResultCode = string.Empty; 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 = "2901"; } else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null) { ResultCode = "2902"; } else if (requestData.ParentID == string.Empty || requestData.ParentID == null) { ResultCode = "2903"; } else if (!bLLUsers.verifyUserID(requestData.ParentID, requestData.AccessToken)) { ResultCode = "2904"; } else if (requestData.BusID == string.Empty || requestData.BusID == null) { ResultCode = "2905"; } else { UserInfo userInfo = bLLUsers.GetuserInfo(requestData.ParentID); string[] userids = bLLBus.getUserIDListByBusID(userInfo.selectbusid); if (userids != null) { if (userids.Contains(requestData.ParentID)) { List <string> arrayList = userids.ToList(); for (int i = 0; i < arrayList.Count; i++) { if (arrayList[i].Equals(requestData.ParentID)) { arrayList.RemoveAt(i); } } string[] newuserids = arrayList.ToArray(); int row1 = bLLBus.updateUseridList(userInfo.selectbusid, newuserids); if (row1 == 0) { ResultCode = "2906"; } } } if (!ResultCode.Equals("2906")) { int row = bLLUsers.updateSelectBusID(requestData.ParentID, requestData.BusID); if (row == 0) { ResultCode = "2906"; } else { string stringUserids = bLLBus.getStringUserIDListByBusID(requestData.BusID); if (stringUserids == null) { stringUserids = requestData.ParentID; } else { string[] oldUserids = stringUserids.Split(','); if (!oldUserids.Contains(requestData.ParentID)) { stringUserids = stringUserids + "," + requestData.ParentID; } } int row2 = bLLBus.updateStringUseridList(requestData.BusID, stringUserids); if (row2 == 0) { ResultCode = "2906"; } else { ResultCode = "0000"; } } } } dict.Add("ResultCode", ResultCode); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("UploadParentSelectedVehicle ResultCode====" + ResultCode); Utils.WriteTraceLog("UploadParentSelectedVehicle 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("UploadParentSelectedVehicle Exception " + ex); Utils.WriteTraceLog("UploadParentSelectedVehicle ResultCode====9991"); Utils.WriteTraceLog("UploadParentSelectedVehicle 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"); } }
public void ProcessRequest(HttpContext context) { try { Utils.WriteTraceLog("UploadParentAddVehicle start"); StreamReader reader = new StreamReader(context.Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); string ResultCode = string.Empty; 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 = "2801"; } else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null) { ResultCode = "2802"; } else if (requestData.ParentID == string.Empty || requestData.ParentID == null) { ResultCode = "2803"; } else if (!bLLUsers.verifyUserID(requestData.ParentID, requestData.AccessToken)) { ResultCode = "2804"; } else if (!bLLBus.verifyBusPwd(requestData.BusID, requestData.BusPWD)) { ResultCode = "2805"; } else { string useridListString = bLLBus.getStringUserIDListByBusID(requestData.BusID); if (useridListString == null) { useridListString = requestData.ParentID; } else { string[] userids = useridListString.Split(','); if (!userids.Contains(requestData.ParentID)) { useridListString = useridListString + "," + requestData.ParentID; } } int row = bLLBus.updateStringUseridList(requestData.BusID, useridListString); if (row == 0) { ResultCode = "2806"; } else { UserInfo userInfo = bLLUsers.GetuserInfo(requestData.ParentID); if (userInfo.busarray == null || userInfo.busarray == string.Empty) { userInfo.busarray = requestData.BusID; } else { string[] busArray = userInfo.busarray.Split(','); if (!busArray.Contains(requestData.BusID)) { userInfo.busarray = userInfo.busarray + "," + requestData.BusID; } } int row1 = bLLUsers.updateBusArray(requestData.ParentID, userInfo.busarray); if (row1 == 0) { ResultCode = "2807"; } else { ResultCode = "0000"; } } } dict.Add("ResultCode", ResultCode); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("UploadParentAddVehicle ResultCode====" + ResultCode); Utils.WriteTraceLog("UploadParentAddVehicle 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("UploadParentAddVehicle Exception " + ex); Utils.WriteTraceLog("UploadParentAddVehicle ResultCode====9991"); Utils.WriteTraceLog("UploadParentAddVehicle end"); } }
public void ProcessRequest(HttpContext context) { try { Utils.WriteTraceLog("UploadAbsentState start"); StreamReader reader = new StreamReader(context.Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); string ResultCode = string.Empty; BLLBus bLLBus = new BLLBus(); BLLUsers bLLUsers = new BLLUsers(); BLLAbsent bLLAbsent = new BLLAbsent(); Dictionary <string, object> dict = new Dictionary <string, object>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); RequestData requestData = jsSerializer.Deserialize <RequestData>(str); if (requestData == null) { ResultCode = "3001"; } else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null) { ResultCode = "3002"; } else if (requestData.ParentID == string.Empty || requestData.ParentID == null) { ResultCode = "3003"; } else if (!bLLUsers.verifyUserID(requestData.ParentID, requestData.AccessToken)) { ResultCode = "3004"; } else if (requestData.CurrentDate == string.Empty || requestData.CurrentDate == null) { ResultCode = "3005"; } else if (requestData.AbsentState == string.Empty || requestData.AbsentState == null) { ResultCode = "3007"; } else { AbsentInfo absentInfo = new AbsentInfo(); absentInfo.absentdate = requestData.CurrentDate; absentInfo.absentuserid = requestData.ParentID; bool result = false; if (requestData.AbsentState.Equals("true")) { result = bLLAbsent.insertAbsentInfo(absentInfo); } else if (requestData.AbsentState.Equals("false")) { result = bLLAbsent.deleteAbsentInfo(absentInfo); } if (!result) { ResultCode = "3006"; } else { ResultCode = "0000"; } } dict.Add("ResultCode", ResultCode); context.Response.ContentType = "text/html"; context.Response.Write(jsSerializer.Serialize(dict)); Utils.WriteTraceLog("UploadAbsentState ResultCode====" + ResultCode); Utils.WriteTraceLog("UploadAbsentState 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("UploadAbsentState Exception " + ex); Utils.WriteTraceLog("UploadAbsentState ResultCode====9991"); Utils.WriteTraceLog("UploadAbsentState end"); } }
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("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"); } }