Ejemplo n.º 1
0
 /// <summary>
 /// Gửi lệnh tạo cuốc cho các xe trong danh sách xe nhận
 /// </summary>
 /// <param name="cuocGoi">The cuoc goi.</param>
 /// <returns></returns>
 /// <Modified>
 /// Name     Date         Comments
 /// LuanBH  8/3/2015   created
 /// </Modified>
 public static bool SendInitTrip(CuocGoi cuocGoi)
 {
     if (HasSendMobile(cuocGoi.KhongDungMobileService.Value))
     {
         var privateCodes = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(cuocGoi.XeNhan, ".");
         if (string.IsNullOrEmpty(privateCodes))
         {
             return(false);
         }
         if (privateCodes.IndexOf("..") > -1 || privateCodes.StartsWith("."))
         {
             return(false);
         }
         CuocGoi.EnVangVIP_GuiTinChoLaiXe(cuocGoi.IDCuocGoi);
         if (Global.HasInternet == 1)
         {
             return(Service_Common.EnvangVip.TryGet(p => p.SendInitTrip(cuocGoi.IDCuocGoi.ToString(), cuocGoi.DiaChiDonKhach, cuocGoi.DiaChiDonKhach
                                                                        , Convert.ToSingle(cuocGoi.GPS_ViDo), Convert.ToSingle(cuocGoi.GPS_KinhDo), cuocGoi.DiaChiTraKhach, cuocGoi.DiaChiTraKhach, 0, 0, cuocGoi.GhiChuDienThoai
                                                                        , Convert.ToByte(cuocGoi.SoLuong), Convert.ToByte(cuocGoi.KieuCuocGoi), Convert.ToByte(cuocGoi.KieuKhachHangGoiDen), cuocGoi.PhoneNumber
                                                                        , privateCodes.Split(".".ToCharArray()), false, string.Empty, 0)).Success);
         }
         else
         {
             string message = string.Format("Moi nhan cuoc don o: {0}", cuocGoi.DiaChiDonKhach);
             return(SendSMSMessage(cuocGoi, message));
         }
     }
     return(false);
 }
        public static void DoProcess()
        {
            bool KetThuc = false;

            while (!KetThuc)
            {
                TaxiReturnSend data;
                if (queueTaxiReturnSend.TryDequeue(out data))
                {
                    try
                    {
                        var re = data.func();
                        if (IsDebug)
                        {
                            ProcessFastTaxi.WriteLog(data.Tree, "Gửi thành công", "thành công", re ? 1 : 0);
                        }
                    }
                    catch (Exception ex)
                    {
                        new Log().WriteLog(ThongTinDangNhap.USER_ID, data.Tree, DateTime.Now, ex.Message);
                        if (IsDebug)
                        {
                            ProcessFastTaxi.WriteLog(data.Tree, ex.Message, "Lỗi");
                        }
                    }
                }
                KetThuc = queueTaxiReturnSend.Count == 0;
            }
        }
        public static TripBookingsSendResult AddTrip(XeDiDuongDai objXeDiDuongDai)
        {
            try
            {
                TripBookingsSendResult rs = Service_Common.FastTaxi.TryGet(client => client.AddTrip(Parse(objXeDiDuongDai))).Value;
                if (rs.AddTripSuccess)
                {
                    ProcessFastTaxi.WriteLog("TaxiReturn_Process\\AddTrip", "Gửi thành công", "thành công");
                }
                else
                {
                    ProcessFastTaxi.WriteLog("TaxiReturn_Process\\AddTrip", "Gửi thất bại", "thất bại");
                }

                return(rs);
            }
            catch (Exception ex)
            {
                if (IsDebug)
                {
                    ProcessFastTaxi.WriteLog("TaxiReturn_Process\\AddTrip", ex.Message, "Lỗi");
                }
                return(null);
            }
        }
        /// <summary>
        /// Gửi text cho service EnVang
        /// </summary>
        /// <param name="cuocGoi">The cuoc goi.</param>
        /// <returns></returns>
        /// <Modified>
        /// Name     Date         Comments
        /// LuanBH  8/7/2015   created
        /// </Modified>
        public static bool SendText(CuocGoi cuocGoi)
        {
            var privateCodes = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(cuocGoi.XeDon, ",");

            if (string.IsNullOrEmpty(privateCodes))
            {
                return(false);
            }
            return(Service_Common.EnvangVip.TryGet(p => p.SendText(privateCodes, cuocGoi.GhiChuDienThoai)).Success);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gửi lệnh cho lái xe
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="soHieuXe">The so hieu xe.</param>
        /// <returns></returns>
        /// <Modified>
        /// Name     Date         Comments
        /// LuanBH  9/8/2015   created
        /// </Modified>
        public static bool SendOperatorCmd(int command, string soHieuXe)
        {
            var vehiclePlates = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(soHieuXe, ",");

            if (string.IsNullOrEmpty(vehiclePlates))
            {
                return(false);
            }
            return(Service_Common.EnvangVip.TryGet(p => p.SendOperatorCmd(command, vehiclePlates)).Success);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Trả lời confirm ăn ca, rời xe
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="status">The status.</param>
        /// <returns></returns>
        /// <Modified>
        /// Name     Date         Comments
        /// LuanBH  9/8/2015   created
        /// </Modified>
        public static bool SendACKActiveChange(MessageConfirm message, byte status, string driverCode, short commandId)
        {
            var vehiclePlates = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(message.XeDon, ",");

            if (string.IsNullOrEmpty(vehiclePlates))
            {
                return(false);
            }
            return(Service_Common.EnvangVip.TryGet(p => p.SendACKActiveChange(vehiclePlates, status, driverCode, message.XeDon, message.MaMessage, commandId)).Success);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gửi text cho service EnVangVip
        /// </summary>
        /// <param name="soHieuXe">The so hieu xe.</param>
        /// <param name="idCuocGoi">The identifier cuoc goi.</param>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        /// <Modified>
        /// Name     Date         Comments
        /// LuanBH  8/21/2015   created
        /// </Modified>
        public static bool SendText(string soHieuXe, long idCuocGoi, string message)
        {
            var vehiclePlates = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(soHieuXe, ",");

            if (string.IsNullOrEmpty(vehiclePlates))
            {
                return(false);
            }
            CuocGoi.EnVangVIP_TaoMessageConfirm(idCuocGoi, 3242, false, false, message, soHieuXe);
            return(Service_Common.EnvangVip.TryGet(p => p.SendText(vehiclePlates, message)).Success);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Gửi text cho service EnVangVip
 /// </summary>
 /// <param name="cuocGoi">The cuoc goi.</param>
 /// <returns></returns>
 /// <Modified>
 /// Name     Date         Comments
 /// LuanBH  8/7/2015   created
 /// </Modified>
 public static bool SendText(CuocGoi cuocGoi)
 {
     if (HasSendMobile(cuocGoi.KhongDungMobileService.Value))
     {
         var vehiclePlates = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(cuocGoi.XeDon, ",");
         if (string.IsNullOrEmpty(vehiclePlates))
         {
             return(false);
         }
         CuocGoi.EnVangVIP_TaoMessageConfirm(cuocGoi.IDCuocGoi, 3242, false, false, cuocGoi.GhiChuDienThoai, cuocGoi.XeDon);
         return(Service_Common.EnvangVip.TryGet(p => p.SendText(vehiclePlates, cuocGoi.GhiChuDienThoai)).Success);
     }
     return(false);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Gửi mobile thông tin điểm đỗ
        /// </summary>
        /// <param name="SoHieuXe"></param>
        /// <param name="LandmarkGPSID"></param>
        /// <param name="Node"></param>
        /// <returns></returns>
        public static bool SendNewLandMarkInfo(string soHieuXe, int LandmarkGPSID, int Node)
        {
            if (!HasSendMobile(null))
            {
                return(false);
            }
            var vehiclePlates = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(soHieuXe, ",");

            if (string.IsNullOrEmpty(vehiclePlates))
            {
                return(false);
            }
            return(Service_Common.EnvangVip.TryGet(p => p.SendLandmark(vehiclePlates, LandmarkGPSID, Node, 0)).Success);
        }
 public static Trip Parse(XeDiDuongDai item)
 {
     try
     {
         //string BienSoXe = "";
         //if (ProcessFastTaxi.Vehicles_GPS.ContainsKey(item.FK_SoHieuXe))
         //{
         //    BienSoXe = ProcessFastTaxi.Vehicles_GPS[item.FK_SoHieuXe];
         //}
         return(new Trip()
         {
             AddressFrom = item.DiaDiemDi,
             AddressFromLat = item.Di_ViDo,
             AddressFromLng = item.Di_KinhDo,
             AddressTo = item.DiaDiemDen,
             AddressToLat = item.Den_ViDo,
             AddressToLng = item.Den_KinhDo,
             DriverName = item.TenLaiXe,
             DriverPhone = item.SoDienThoai,
             KmExpected = item.KmDuKien,
             MoneyExpected = (decimal)item.TienDuKien,
             TimeExpected = item.TGDuKien,
             Notes = item.GhiChu,
             PK_TripID = item.ID,
             TimeFrom = item.ThoiDiemDi.Value,
             TimeTo = item.ThoiDiemVe ?? item.TGDuKien,
             TripStatus = Trip.Status.DangDi,
             //TripType
             Vehicle_Lat = item.Xe_ViDo,
             Vehicle_Lng = item.Xe_KinhDo,
             VehiclePlate = item.BienSoXe,
             //XNCode
             //ExtensionData
             //FK_CompanyID
             //InputType
             //PrivateCode
             //Route
             //Route_Points
         });
     }
     catch (Exception ex)
     {
         if (IsDebug)
         {
             ProcessFastTaxi.WriteLog("TaxiReturn_Process\\Parse", ex.Message, "Lỗi");
         }
         return(null);
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Gửi lệnh có thể/không thể mời được khách sang service EnVang
 /// </summary>
 /// <param name="cuocGoi">The cuoc goi.</param>
 /// <param name="coMoiKhach">The co moi khach.</param>
 /// <returns></returns>
 /// <Modified>
 /// Name     Date         Comments
 /// LuanBH  8/3/2015   created
 /// </Modified>
 public static bool SendACKInvite(CuocGoi cuocGoi, byte coMoiKhach, string message)
 {
     if (HasSendMobile(cuocGoi.KhongDungMobileService.Value))
     {
         var privateCodes = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(cuocGoi.XeDon, ",");
         if (string.IsNullOrEmpty(privateCodes))
         {
             return(false);
         }
         return(Service_Common.EnvangVip.TryGet(p => p.SendACKInvite(cuocGoi.IDCuocGoi.ToString(), privateCodes, coMoiKhach, message)).Success);
     }
     else
     {
         return(SendSMSMessage(cuocGoi, "Đã mời khách"));
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Gửi lệnh có thể/không thể mời được khách sang service EnVang
        /// </summary>
        /// <param name="cuocGoi">The cuoc goi.</param>
        /// <param name="coMoiKhach">The co moi khach.</param>
        /// <returns></returns>
        /// <Modified>
        /// Name     Date         Comments
        /// LuanBH  8/3/2015   created
        /// </Modified>
        public static bool SendACKInvite(MessageConfirm message, byte coMoiKhach, string msg)
        {
            var privateCodes = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(message.XeDon, ",");

            if (string.IsNullOrEmpty(privateCodes))
            {
                return(false);
            }

            if (Global.HasInternet == 1)
            {
                return(Service_Common.EnvangVip.TryGet(p => p.SendACKInvite(message.IDCuocGoi.ToString(), privateCodes, coMoiKhach, string.Empty)).Success);
            }
            else
            {
                return(SendSMSMessage(null, "Đã mời khách"));
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Gửi confirm landmark.
        /// </summary>
        /// <param name="soHieuXe">The so hieu xe.</param>
        /// <param name="landMarkID">The land mark identifier.</param>
        /// <param name="ok">if set to <c>true</c> [ok].</param>
        /// <returns></returns>
        /// <Modified>
        /// Name     Date         Comments
        /// LuanBH  8/27/2015   created
        /// </Modified>
        public static bool SendConfirmLandmark(MessageConfirm message, byte ok)
        {
            var vehiclePlates = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(message.XeDon, ",");

            if (string.IsNullOrEmpty(vehiclePlates))
            {
                return(false);
            }
            var landMarkAndDriver = message.MessageContent.Split("-".ToCharArray());
            int node = 0;

            if (ok == 1)
            {
                node = CuocGoi.EnVangVIP_NhapDuLieuGiamSatXe(vehiclePlates, landMarkAndDriver[1], ""
                                                             , ((int)Enum_TrangThaiLaiXeBao.BaoDiemDo).ToString(), Convert.ToInt32(landMarkAndDriver[0]),
                                                             "1", null, null);
            }
            return(Service_Common.EnvangVip.TryGet(p => p.SendConfirmLandmark(vehiclePlates, Convert.ToInt32(landMarkAndDriver[0]), ok == 1, node)).Success);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Gửi lệnh đồng ý/không đồng ý cho số sang service EnVang
        /// </summary>
        /// <param name="cuocGoi">The cuoc goi.</param>
        /// <param name="coChoSo">The co cho so.</param>
        /// <returns></returns>
        /// <Modified>
        /// Name     Date         Comments
        /// LuanBH  8/3/2015   created
        /// </Modified>
        public static bool SendACKGetPhone(MessageConfirm message, byte coChoSo)
        {
            var privateCodes = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(message.XeDon, ",");

            if (string.IsNullOrEmpty(privateCodes))
            {
                return(false);
            }

            if (Global.HasInternet == 1)
            {
                return(Service_Common.EnvangVip.TryGet(p => p.SendACKGetPhone(message.IDCuocGoi.ToString(), coChoSo, privateCodes)).Success);
            }
            else
            {
                //string message = string.Format("So dien thoai khach hang: {0}", cuocGoi.PhoneNumber);
                return(SendSMSMessage(null, string.Empty));
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Gửi lệnh đồng ý/không đồng ý cho số sang service EnVang
        /// </summary>
        /// <param name="cuocGoi">The cuoc goi.</param>
        /// <param name="coChoSo">The co cho so.</param>
        /// <returns></returns>
        /// <Modified>
        /// Name     Date         Comments
        /// LuanBH  8/3/2015   created
        /// </Modified>
        public static bool SendACKGetPhone(CuocGoi cuocGoi, byte coChoSo)
        {
            var privateCodes = ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(cuocGoi.XeDon, ",");

            if (string.IsNullOrEmpty(privateCodes))
            {
                return(false);
            }

            if (HasSendMobile(cuocGoi.KhongDungMobileService.Value))
            {
                return(Service_Common.EnvangVip.TryGet(p => p.SendACKGetPhone(cuocGoi.IDCuocGoi.ToString(), coChoSo, privateCodes)).Success);
            }
            else
            {
                string message = string.Format("So dien thoai khach hang: {0}", cuocGoi.PhoneNumber);
                return(SendSMSMessage(cuocGoi, message));
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Gets the vehicle plates from private code.
 /// </summary>
 /// <param name="soHieuXe">The so hieu xe.</param>
 /// <returns></returns>
 /// <Modified>
 /// Name     Date         Comments
 /// LuanBH  9/14/2015   created
 /// </Modified>
 public static string GetVehiclePlatesFromPrivateCode(string soHieuXe)
 {
     return(ProcessFastTaxi.GetVehiclePlatesFromPrivateCode(soHieuXe, ","));
 }