Esempio n. 1
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                uid = res["UID"].ToString().Trim();
                VehicleManager      vm            = new VehicleManager();
                SystemImagesManager sim           = new SystemImagesManager();
                OPUserManager       opUserManager = new OPUserManager();
                Hashtable           vehicle       = opUserManager.GetVehicleInfoByOperator(uid);
                OrdersManager       om            = new OrdersManager();
                string thumbImg   = string.Empty;
                string detailsImg = string.Empty;
                if (vehicle == null || vehicle.Keys.Count <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "车辆数据为空"));
                }
                else
                {
                    DataTable dt = sim.GetImagesByVehicleID(vehicle["ID"].ToString());
                    if (dt != null)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["Type"].ToString().Trim() == ((int)ImagesType.Thumbnail).ToString().Trim())
                            {
                                thumbImg += SiteHelper.GetFileServer() + dr["ImageUrl"].ToString().Trim() + ";";
                            }

                            if (dr["Type"].ToString().Trim() == ((int)ImagesType.Details).ToString().Trim())
                            {
                                detailsImg += SiteHelper.GetFileServer() + dr["ImageUrl"].ToString().Trim() + ";";
                            }
                        }
                    }
                    vehicle["THUMBIMG"]   = thumbImg;
                    vehicle["DETAILSIMG"] = detailsImg;

                    string lng = vehicle["LONGITUDE"].ToString();
                    string lat = vehicle["LATITUDE"].ToString();
                    if (!string.IsNullOrEmpty(lng) && !string.IsNullOrEmpty(lat))
                    {
                        LatLng latlng = new LatLng(double.Parse(lat), double.Parse(lng));
                        latlng = SiteHelper.TransformFromWGSToGCJ(latlng);
                        if (latlng != null)
                        {
                            vehicle["LATITUDE"]  = latlng.latitude;
                            vehicle["LONGITUDE"] = latlng.longitude;
                            if (vehicle["ADDRESS"].ToString().Length <= 0)
                            {
                                vehicle["ADDRESS"] = SiteHelper.GetLocationByGPS(vehicle["LONGITUDE"].ToString(), vehicle["LATITUDE"].ToString(), "gcj02ll");
                            }
                        }
                    }
                    decimal electricity = 0;
                    decimal.TryParse(vehicle["ELECTRICITY"].ToString(), out electricity);
                    int dianliang = Decimal.ToInt32(electricity);
                    vehicle["ELECTRICITY"] = dianliang + "%";

                    Hashtable order_ht = om.GetLatestUserByVehicleID(vehicle["ID"].ToString());
                    if (order_ht != null && order_ht.Keys.Count > 0)
                    {
                        vehicle["OrderUserName"] = order_ht["REALNAME"];
                        vehicle["OrderUserTel"]  = order_ht["BINDPHONE"];
                        vehicle["HeadPortrait"]  = SiteHelper.GetFileServer() + order_ht["HEADPORTRAIT"];
                        vehicle["OrderState"]    = order_ht["ORDERSTATE"];
                        vehicle["UserType"]      = order_ht["USERTYPE"];
                    }
                    else
                    {
                        vehicle["OrderUserName"] = "";
                        vehicle["OrderUserTel"]  = "";
                        vehicle["HeadPortrait"]  = "";
                        vehicle["OrderState"]    = "";
                        vehicle["UserType"]      = "";
                    }

                    return(SiteHelper.GetJsonFromHashTable(vehicle, "success", "获取数据成功", "GetCurrentVehicle"));
                }
            }
        }
Esempio n. 2
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["VehicleID"] == null ||
                res["Latitude"] == null ||
                res["Longitude"] == null ||
                res["VehicleID"].ToString().Trim().Length <= 0 ||
                res["Latitude"].ToString().Trim().Length <= 0 ||
                res["Longitude"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                vehicleID = res["VehicleID"].ToString().Trim();
                weidu     = res["Latitude"].ToString().Trim();
                jingdu    = res["Longitude"].ToString().Trim();
                VehicleManager      vm  = new VehicleManager();
                SystemImagesManager sim = new SystemImagesManager();

                //如何扫码内容为url地址则从地址中取出车辆id
                if (vehicleID != null && (vehicleID.StartsWith("http://") || vehicleID.StartsWith("https://")))
                {
                    //http://api.qingniaokeji.cn/download/app.aspx?no=xxxxxxxxxxxxx
                    Uri uri = new Uri(vehicleID);
                    System.Collections.Specialized.NameValueCollection coll = System.Web.HttpUtility.ParseQueryString(uri.Query);
                    vehicleID = coll.Get("no");
                }
                Hashtable vehicle = vm.GetVehicleInfoByID(vehicleID, weidu, jingdu);
                if (vehicle == null || vehicle.Keys.Count <= 0)
                {
                    vehicle = vm.GetVehicleInfoByName(vehicleID, weidu, jingdu);
                }

                string thumbImg   = string.Empty;
                string detailsImg = string.Empty;
                if (vehicle == null || vehicle.Keys.Count <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "车辆数据为空"));
                }
                else
                {
                    DataTable dt = sim.GetImagesByVehicleID(vehicleID);
                    if (dt != null)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["Type"].ToString().Trim() == ((int)ImagesType.Thumbnail).ToString().Trim())
                            {
                                thumbImg += SiteHelper.GetFileServer() + dr["ImageUrl"].ToString().Trim() + ";";
                            }

                            if (dr["Type"].ToString().Trim() == ((int)ImagesType.Details).ToString().Trim())
                            {
                                detailsImg += SiteHelper.GetFileServer() + dr["ImageUrl"].ToString().Trim() + ";";
                            }
                        }
                    }
                    vehicle["THUMBIMG"]   = thumbImg;
                    vehicle["DETAILSIMG"] = detailsImg;

                    string lng = vehicle["LONGITUDE"].ToString();
                    string lat = vehicle["LATITUDE"].ToString();
                    if (!string.IsNullOrEmpty(lng) && !string.IsNullOrEmpty(lat))
                    {
                        LatLng latlng = new LatLng(double.Parse(lat), double.Parse(lng));
                        if (res["Client"] != null && "iOS" == res["Client"].ToString())
                        {
                            latlng = new LatLng(double.Parse(lat), double.Parse(lng));
                            latlng = SiteHelper.TransformFromWGSToGCJ(latlng);
                            vehicle["LONGITUDE"] = latlng.longitude;
                            vehicle["LATITUDE"]  = latlng.latitude;
                        }
                        else
                        {
                            /*latlng = SiteHelper.GetBaiduByGPS(lat, lng);
                             * if (latlng != null)
                             * {
                             *  vehicle["LATITUDE"] = latlng.latitude;
                             *  vehicle["LONGITUDE"] = latlng.longitude;
                             *  if (vehicle["ADDRESS"].ToString().Length <= 0)
                             *  {
                             *      vehicle["ADDRESS"] = SiteHelper.GetLocationByGPS(vehicle["LATITUDE"].ToString(), vehicle["LONGITUDE"].ToString());
                             *  }
                             * }*/
                            latlng = new LatLng(double.Parse(lat), double.Parse(lng));
                            latlng = SiteHelper.TransformFromWGSToGCJ(latlng);
                            vehicle["LONGITUDE"] = latlng.longitude;
                            vehicle["LATITUDE"]  = latlng.latitude;
                            string citycode = "", cityname = "";
                            vehicle["ADDRESS"] = SiteHelper.GetAddressInfoByGPS(latlng.longitude.ToString(), latlng.latitude.ToString(), out citycode, out cityname);
                        }
                    }
                    decimal electricity = 0;
                    decimal.TryParse(vehicle["ELECTRICITY"].ToString(), out electricity);
                    int dianliang = Decimal.ToInt32(electricity);
                    vehicle["ELECTRICITY"] = dianliang + "%";

                    vehicle["PRICESYSTEM"]          = SiteHelper.GetFileServer() + "/AppPage/BusinessInfo.aspx?id=" + SiteHelper.GetHashTableValueByKey(vehicle, "ID") + "&type=" + BusinessType.Vehicle.GetHashCode() + "&field=" + BusinessFieldType.PRICESYSTEM.GetHashCode();
                    vehicle["VEHICLEREMARK"]        = SiteHelper.GetFileServer() + "/AppPage/BusinessInfo.aspx?id=" + SiteHelper.GetHashTableValueByKey(vehicle, "ID") + "&type=" + BusinessType.Vehicle.GetHashCode() + "&field=" + BusinessFieldType.VEHICLEREMARK.GetHashCode();
                    vehicle["TRANSPORTINFORMATION"] = SiteHelper.GetFileServer() + "/AppPage/BusinessInfo.aspx?id=" + SiteHelper.GetHashTableValueByKey(vehicle, "ID") + "&type=" + BusinessType.Vehicle.GetHashCode() + "&field=" + BusinessFieldType.TRANSPORTINFORMATION.GetHashCode();
                    return(SiteHelper.GetJsonFromHashTable(vehicle, "success", "获取数据成功", "VehicleInfo"));
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 获取附近车辆详细信息
        /// </summary>
        /// <param name="context"></param>
        private void GetVehicleByID(HttpContext context)
        {
            string vehicleID = string.Empty;
            string weidu     = string.Empty;
            string jingdu    = string.Empty;

            if (context.Request["VehicleID"] == null ||
                context.Request["Latitude"] == null ||
                context.Request["Longitude"] == null ||
                context.Request["VehicleID"].ToString().Trim().Length <= 0 ||
                context.Request["Latitude"].ToString().Trim().Length <= 0 ||
                context.Request["Longitude"].ToString().Trim().Length <= 0)
            {
                context.Response.Write(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
                context.Response.End();
            }
            else
            {
                vehicleID = context.Request["VehicleID"].ToString().Trim();
                weidu     = context.Request["Latitude"].ToString().Trim();
                jingdu    = context.Request["Longitude"].ToString().Trim();
                VehicleManager      vm      = new VehicleManager();
                SystemImagesManager sim     = new SystemImagesManager();
                Hashtable           vehicle = vm.GetVehicleInfoByID(vehicleID, weidu, jingdu);
                string thumbImg             = string.Empty;
                string detailsImg           = string.Empty;
                if (vehicle == null || vehicle.Keys.Count <= 0)
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable(null, "faild", "车辆数据为空"));
                }
                else
                {
                    DataTable dt = sim.GetImagesByVehicleID(vehicleID);
                    if (dt != null)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["Type"].ToString().Trim() == ((int)ImagesType.Thumbnail).ToString().Trim())
                            {
                                thumbImg += SiteHelper.GetFileServer() + dr["ImageUrl"].ToString().Trim() + ";";
                            }

                            if (dr["Type"].ToString().Trim() == ((int)ImagesType.Details).ToString().Trim())
                            {
                                detailsImg += SiteHelper.GetFileServer() + dr["ImageUrl"].ToString().Trim() + ";";
                            }
                        }
                    }
                    vehicle["THUMBIMG"]   = thumbImg;
                    vehicle["DETAILSIMG"] = detailsImg;

                    string lng = vehicle["LONGITUDE"].ToString();
                    string lat = vehicle["LATITUDE"].ToString();
                    if (!string.IsNullOrEmpty(lng) && !string.IsNullOrEmpty(lat))
                    {
                        /*LatLng latlng = SiteHelper.GetBaiduByGPS(lat, lng);
                         * vehicle["LATITUDE"] = latlng.latitude;
                         * vehicle["LONGITUDE"] = latlng.longitude;
                         * if (vehicle["ADDRESS"].ToString().Length <= 0)
                         * {
                         *  vehicle["ADDRESS"] = SiteHelper.GetLocationByGPS(vehicle["LONGITUDE"].ToString(), vehicle["LATITUDE"].ToString());
                         * }*/
                        LatLng latlng = new LatLng(double.Parse(lat), double.Parse(lng));
                        latlng = SiteHelper.TransformFromWGSToGCJ(latlng);
                        vehicle["LATITUDE"]  = latlng.latitude;
                        vehicle["LONGITUDE"] = latlng.longitude;
                    }


                    decimal electricity = 0;
                    decimal.TryParse(vehicle["ELECTRICITY"].ToString(), out electricity);
                    int dianliang = Decimal.ToInt32(electricity);
                    vehicle["ELECTRICITY"] = dianliang + "%";

                    vehicle["PRICESYSTEM"]          = SiteHelper.GetFileServer() + "/AppPage/BusinessInfo.aspx?id=" + SiteHelper.GetHashTableValueByKey(vehicle, "ID") + "&type=" + BusinessType.Vehicle.GetHashCode() + "&field=" + BusinessFieldType.PRICESYSTEM.GetHashCode();
                    vehicle["VEHICLEREMARK"]        = SiteHelper.GetFileServer() + "/AppPage/BusinessInfo.aspx?id=" + SiteHelper.GetHashTableValueByKey(vehicle, "ID") + "&type=" + BusinessType.Vehicle.GetHashCode() + "&field=" + BusinessFieldType.VEHICLEREMARK.GetHashCode();
                    vehicle["TRANSPORTINFORMATION"] = SiteHelper.GetFileServer() + "/AppPage/BusinessInfo.aspx?id=" + SiteHelper.GetHashTableValueByKey(vehicle, "ID") + "&type=" + BusinessType.Vehicle.GetHashCode() + "&field=" + BusinessFieldType.TRANSPORTINFORMATION.GetHashCode();
                    context.Response.Write(SiteHelper.GetJsonFromHashTable(vehicle, "success", "获取数据成功", "VehicleInfo"));
                }
            }
        }
Esempio n. 4
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["VehicleID"] == null || res["VehicleID"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                vehicleID = res["VehicleID"].ToString().Trim();
                VehicleManager      vm  = new VehicleManager();
                SystemImagesManager sim = new SystemImagesManager();

                //如何扫码内容为url地址则从地址中取出车辆id
                if (vehicleID != null && (vehicleID.StartsWith("http://") || vehicleID.StartsWith("https://")))
                {
                    //http://api.qingniaokeji.cn/download/app.aspx?no=xxxxxxxxxxxxx
                    Uri uri = new Uri(vehicleID);
                    System.Collections.Specialized.NameValueCollection coll = System.Web.HttpUtility.ParseQueryString(uri.Query);
                    vehicleID = coll.Get("no");
                }
                Hashtable     vehicle    = vm.GetVehicleInfoByIDORNumber(vehicleID);
                OrdersManager om         = new OrdersManager();
                string        thumbImg   = string.Empty;
                string        detailsImg = string.Empty;
                if (vehicle == null || vehicle.Keys.Count <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "车辆数据为空"));
                }
                else
                {
                    DataTable dt = sim.GetImagesByVehicleID(vehicleID);
                    if (dt != null)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["Type"].ToString().Trim() == ((int)ImagesType.Thumbnail).ToString().Trim())
                            {
                                thumbImg += SiteHelper.GetFileServer() + dr["ImageUrl"].ToString().Trim() + ";";
                            }

                            if (dr["Type"].ToString().Trim() == ((int)ImagesType.Details).ToString().Trim())
                            {
                                detailsImg += SiteHelper.GetFileServer() + dr["ImageUrl"].ToString().Trim() + ";";
                            }
                        }
                    }
                    vehicle["THUMBIMG"]   = thumbImg;
                    vehicle["DETAILSIMG"] = detailsImg;

                    string lng = vehicle["LONGITUDE"].ToString();
                    string lat = vehicle["LATITUDE"].ToString();
                    if (!string.IsNullOrEmpty(lng) && !string.IsNullOrEmpty(lat))
                    {
                        LatLng latlng = new LatLng(double.Parse(lat), double.Parse(lng));
                        latlng = SiteHelper.TransformFromWGSToGCJ(latlng);
                        if (latlng != null)
                        {
                            vehicle["LATITUDE"]  = latlng.latitude;
                            vehicle["LONGITUDE"] = latlng.longitude;
                            if (vehicle["ADDRESS"].ToString().Length <= 0)
                            {
                                vehicle["ADDRESS"] = SiteHelper.GetLocationByGPS(vehicle["LONGITUDE"].ToString(), vehicle["LATITUDE"].ToString(), "gcj02ll");
                            }
                        }
                    }
                    decimal electricity = 0;
                    decimal.TryParse(vehicle["ELECTRICITY"].ToString(), out electricity);
                    int dianliang = Decimal.ToInt32(electricity);
                    vehicle["ELECTRICITY"] = dianliang + "%";

                    vehicle["AbnormalState"] = 0;
                    Hashtable abht = null;// vm.GetAbnormalVehicle(vehicle["ID"].ToString());
                    if (abht != null && abht.Keys.Count > 0)
                    {
                        vehicle["AbnormalState"] = 1;
                        vehicle["AlarmType"]     = SiteHelper.GetHashTableValueByKey(abht, "AlarmType");
                        vehicle["AlarmTime"]     = SiteHelper.GetHashTableValueByKey(abht, "AlarmTime");
                    }

                    vehicle["ChargeBeginTime"] = "";
                    Hashtable chargeht = vm.GetVehicleChargingInfo(vehicle["ID"].ToString());
                    if (chargeht != null && chargeht.Keys.Count > 0)
                    {
                        vehicle["ChargeBeginTime"] = chargeht["BEGINTIME"].ToString();
                    }

                    Hashtable order_ht = om.GetLatestUserByVehicleID(vehicle["ID"].ToString());
                    if (order_ht != null && order_ht.Keys.Count > 0)
                    {
                        vehicle["OrderUserName"] = order_ht["REALNAME"];
                        vehicle["OrderUserTel"]  = order_ht["BINDPHONE"];
                        //vehicle["HeadPortrait"] = SiteHelper.GetFileServer() + order_ht["HEADPORTRAIT"];
                        vehicle["HeadPortrait"] = "";
                        vehicle["OrderState"]   = order_ht["ORDERSTATE"];
                        vehicle["UserType"]     = order_ht["USERTYPE"];
                        vehicle["OrderTime"]    = order_ht["CREATETIME"];
                    }
                    else
                    {
                        vehicle["OrderUserName"] = "";
                        vehicle["OrderUserTel"]  = "";
                        vehicle["HeadPortrait"]  = "";
                        vehicle["OrderState"]    = "";
                        vehicle["UserType"]      = "";
                        vehicle["OrderTime"]     = "";
                    }
                    return(SiteHelper.GetJsonFromHashTable(vehicle, "success", "获取数据成功", "VehicleInfo"));
                }
            }
        }