Ejemplo n.º 1
0
        public void UserLocationHistory(string PhoneUID, int RecordNumners)
        {
            DBConnection         DBop = new DBConnection();
            ResponsePhoneInfo    messeageResponsePhoneInfo = new ResponsePhoneInfo();
            DataTable            dataTable = new DataTable();
            JavaScriptSerializer ser       = new JavaScriptSerializer();

            dataTable = DBop.NewConectionDLL.SelectDataSet("Tracking", "top " + RecordNumners + " *", "PhoneUID = '" + PhoneUID + "'", " DateRecord desc").Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                PhonesInfo[] phonelist = new PhonesInfo[dataTable.Rows.Count];
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    phonelist[i] = new PhonesInfo(null, null,
                                                  (int)dataTable.Rows[i]["BatteryLevel"],
                                                  Convert.ToDouble(dataTable.Rows[i]["Latitude"]),
                                                  Convert.ToDouble(dataTable.Rows[i]["longitude"]),
                                                  Convert.ToString(dataTable.Rows[i]["DateRecord"]));
                }
                messeageResponsePhoneInfo.UsersPhonesInfo = phonelist;
                messeageResponsePhoneInfo.ErrorID         = (int)ErrorNumbers.Found;
                HttpContext.Current.Response.Write(ser.Serialize(messeageResponsePhoneInfo));
                return;
            }
            else
            {
                messeageResponsePhoneInfo.ErrorID = (int)ErrorNumbers.NotFound;
                HttpContext.Current.Response.Write(ser.Serialize(messeageResponsePhoneInfo));
                return;
            }
        }
Ejemplo n.º 2
0
        public void UsersPhoneLocations(string UserUID)
        {
            DBConnection         DBop = new DBConnection();
            ResponsePhoneInfo    messeageResponsePhoneInfo = new ResponsePhoneInfo();
            DataTable            dataTable = new DataTable();
            JavaScriptSerializer ser       = new JavaScriptSerializer();


            dataTable = DBop.NewConectionDLL.SelectDataSet("Admins", " UserID ", " UserUID = '" + UserUID + "'").Tables[0];
            if ((dataTable == null) || (dataTable.Rows.Count == 0))
            {
                messeageResponsePhoneInfo.ErrorID = (int)ErrorNumbers.NotFound;
                HttpContext.Current.Response.Write(ser.Serialize(messeageResponsePhoneInfo));
                return;
            }

            int UserID = (int)dataTable.Rows[0]["UserID"];

            ColProcedureParam[] Coloumns1 = new ColProcedureParam[1];
            Coloumns1[0] = new ColProcedureParam("UserID", Convert.ToString(UserID));
            dataTable    = DBop.NewConectionDLL.SelectDataSetProcedureTable("GetUpdateLocation", Coloumns1).Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                PhonesInfo[] phonelist = new PhonesInfo[dataTable.Rows.Count];
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    phonelist[i] = new PhonesInfo(
                        Convert.ToString(dataTable.Rows[i]["PhoneUID"]),
                        Convert.ToString(dataTable.Rows[i]["PhoneName"]),
                        (int)dataTable.Rows[i]["BatteryLevel"],
                        Convert.ToDouble(dataTable.Rows[i]["Latitude"]),
                        Convert.ToDouble(dataTable.Rows[i]["longitude"]),
                        Convert.ToString(dataTable.Rows[i]["DateRecord"]));
                }
                messeageResponsePhoneInfo.UsersPhonesInfo = phonelist;
                messeageResponsePhoneInfo.ErrorID         = (int)ErrorNumbers.Found;
                HttpContext.Current.Response.Write(ser.Serialize(messeageResponsePhoneInfo));
                return;
            }
            else
            {
                messeageResponsePhoneInfo.ErrorID = (int)ErrorNumbers.NotFound;
                HttpContext.Current.Response.Write(ser.Serialize(messeageResponsePhoneInfo));
                return;
            }
        }