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("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");
     }
 }
Exemplo n.º 4
0
 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("GetAllVehicles 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 = "2601";
         }
         else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null)
         {
             ResultCode = "2602";
         }
         else if (requestData.ParentID == string.Empty || requestData.ParentID == null)
         {
             ResultCode = "2603";
         }
         else if (!bLLUsers.verifyUserID(requestData.ParentID, requestData.AccessToken))
         {
             ResultCode = "2604";
         }
         else
         {
             List <BusInfo> busInfoList = bLLBus.getAllBusInfo();
             if (busInfoList == null)
             {
                 ResultCode = "2605";
             }
             else
             {
                 ResultCode = "0000";
                 string[] busArray = new string[busInfoList.Count];
                 for (int i = 0; i < busArray.Length; i++)
                 {
                     Dictionary <string, string> dictionary = new Dictionary <string, string>();
                     dictionary.Add("BusID", busInfoList[i].busid);
                     dictionary.Add("BusName", busInfoList[i].busname);
                     busArray[i] = jsSerializer.Serialize(dictionary);
                 }
                 dict.Add("AllVehiclesArray", busArray);
             }
         }
         dict.Add("ResultCode", ResultCode);
         context.Response.ContentType = "text/html";
         context.Response.Write(jsSerializer.Serialize(dict));
         Utils.WriteTraceLog("GetAllVehicles ResultCode====" + ResultCode);
         Utils.WriteTraceLog("GetAllVehicles 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("GetAllVehicles Exception " + ex);
         Utils.WriteTraceLog("GetAllVehicles ResultCode====9991");
         Utils.WriteTraceLog("GetAllVehicles end");
     }
 }
Exemplo n.º 6
0
 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");
     }
 }