Beispiel #1
0
        //private async Task DoFilterAsync()
        //{

        //}

        private ValidationHistory GetValidationHistory(EmailContent email, List <FilterResult> filterResults)
        {
            if (filterResults == null)
            {
                throw new ArgumentNullException(nameof(filterResults));
            }
            var message = string.Empty;

            filterResults.Where(s => s.Status == EmailStatus.Violated).ToList().ForEach(s =>
            {
                message += s.Message + ", ";
            });

            if (!string.IsNullOrWhiteSpace(message))
            {
                message = message.Trim();
                message = message.Substring(0, message.Length - 1);
            }

            return(new ValidationHistory()
            {
                Status = email.Status,
                Content = email.Content,
                AsciiContent = UnicodeStrings.LatinToAscii(email.Content),
                EmailContentId = email.MailSource == MailSource.Db ? email.EmailContentID : (Guid?)null,
                ValidationDTG = DateTime.Now,
                ValidationHistoryID = Guid.NewGuid(),
                Description = message,
                FileName = email.MailSource == MailSource.FileSystem ? $"{email.EmailContentID}_{(int)email.Status}.txt" : null
            });
        }
        private void btnThemMoi_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtNameVN.Text == string.Empty)
                {
                    new MessageBox.MessageBoxBA().Show("Bạn hãy nhập tên đường");
                }
                else if (txtVietTat.Text == string.Empty)
                {
                    new MessageBox.MessageBoxBA().Show("Bạn hãy nhập tên viết tắt");
                }
                else
                {
                    string NameVN = txtNameVN.Text.Trim();
                    string NameEN = UnicodeStrings.LatinToAscii(NameVN);
                    if (currentMarker != null && currentMarker.IsVisible && chkCoToaDo.Checked)
                    {
                        G_KinhDo = (float)currentMarker.Position.Lng;
                        G_ViDo   = (float)currentMarker.Position.Lat;
                    }

                    if (G_isAddNew)
                    {
                        if (new clsRoad().Insert_TenVietTat(NameEN, NameVN, txtVietTat.Text.Trim(), G_KinhDo, G_ViDo))
                        {
                            new MessageBox.MessageBoxBA().Show("Thêm mới thành công", "Thông báo", MessageBox.MessageBoxButtonsBA.OK, MessageBox.MessageBoxIconBA.Information);
                            G_NameVN = NameVN;
                            Refresh();
                        }
                        else
                        {
                            new MessageBox.MessageBoxBA().Show("Thêm mới thất bại", "Thông báo", MessageBox.MessageBoxButtonsBA.OK, MessageBox.MessageBoxIconBA.Error);
                        }
                    }
                    else
                    {
                        if (new clsRoad().Update_TenVietTat(objRoad.ID, txtVietTat.Text.Trim(), NameVN, NameEN, G_KinhDo, G_ViDo))
                        {
                            G_NameVN = txtNameVN.Text.Trim();
                            new MessageBox.MessageBoxBA().Show("Cập nhật thành công", "Thông báo", MessageBox.MessageBoxButtonsBA.OK, MessageBox.MessageBoxIconBA.Information);
                            Refresh();
                        }
                        else
                        {
                            new MessageBox.MessageBoxBA().Show("Cập nhật thất bại", "Thông báo", MessageBox.MessageBoxButtonsBA.OK, MessageBox.MessageBoxIconBA.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("btnThemMoi_Click: ", ex);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Gửi sms thông báo xe đón và có view car
        /// </summary>
        /// <param name="receiveNumber"></param>
        /// <param name="driverName"></param>
        /// <param name="phoneNumber"></param>
        /// <param name="privateCode"></param>
        /// <param name="vehiclePlate"></param>
        /// <returns></returns>
        public static bool Vina_SendSms_VinaTaxi_ViewCar(string receiveNumber, string privateCode, float custLat, float custLng, System.Guid bookID, float estimateTime)
        {
            string driverName  = "";
            string driverPhone = "";

            string vehiclePlate = CommonBL.ConvertSangBienSo(privateCode).Trim();

            if (CommonBL.DictDriver != null && CommonBL.DictDriver.ContainsKey(privateCode))
            {
                driverName  = UnicodeStrings.UnicodeFormat_V2(CommonBL.DictDriver[privateCode].TenNhanVien);
                driverPhone = CommonBL.DictDriver[privateCode].DiDong;
            }
            return(ServiceSMSVina.TryGet(t => t.SendSms_VinaTaxi_ViewCar(ConvertPhoneNumber(receiveNumber), driverName, driverPhone, privateCode, vehiclePlate, custLat, custLng, bookID, estimateTime)).Value);
        }
 /// <summary>
 /// Gửi sms khi xe đến điểm gặp khách trong điều xe đường dài! (VD: Ba Sao)
 /// </summary>
 public static bool SendSMS_ReceiveCatchedUser(Guid bookId, string mobile, string privateCode, int money, LoaiCuocKhach loaiCuoc, int giaPhuTroi, int quangduong, TcpOPDirection dir,
                                               string param6 = "", string param7 = "", string param8 = "", string param9 = "", string param10 = "")
 {
     try
     {
         string driverName = "";
         if (CommonBL.DictDriver != null && CommonBL.DictDriver.ContainsKey(privateCode))
         {
             driverName = UnicodeStrings.UnicodeFormat_V2(CommonBL.DictDriver[privateCode].TenNhanVien);
         }
         TcpOPBookTripType tripType = TcpOPBookTripType.Normal;
         if (loaiCuoc == LoaiCuocKhach.ChoKhachDuongDai)
         {
             tripType = TcpOPBookTripType.Long;
         }
         else if (loaiCuoc == LoaiCuocKhach.ChoKhachSanBay)
         {
             tripType = TcpOPBookTripType.Airport;
             #region BaSao : Xe nội thành chở khách đi sân bay mới nhắn tin
             if (license.IsTaxiBaSao)
             {
                 int soXe = 0;
                 if (int.TryParse(privateCode, out soXe)) //Nhiều xe cũng ko gửi sms
                 {
                     if (soXe >= 1000)                    //Xe sân bay của Ba Sao là xe lớn hơn 1000
                     {
                         return(true);
                     }
                 }
             }
             #endregion
         }
         if (Config_Common.SMS_CuocDuongDai_LaiXe)
         {
             return(Client.TryGet(p => p.SendSMS_ReceiveCatchedUser_V2(bookId, mobile, privateCode, driverName, CommonBL.ConvertSangBienSo(privateCode), money, tripType, giaPhuTroi, quangduong, dir, param6, param7, param8, param9, param10)).Value);
         }
         else
         {
             return(Client.TryGet(p => p.SendSMS_ReceiveCatchedUser(bookId, mobile, privateCode, money, tripType, giaPhuTroi, quangduong, dir, param6, param7, param8, param9, param10)).Value);
         }
     }
     catch (Exception ex)
     {
         LogError.WriteLogError("SendSMS_ReceiveCatchedUser", ex);
         return(false);
     }
 }
        private void button_test_Click(object sender, EventArgs e)
        {
            long     startTicks, endTicks;
            long     dllTicks, functionTicks;
            string   dllResultString = string.Empty, functionResultString = string.Empty;
            int      iterations = 1000;
            double   dllMilliseconds, functionMilliseconds;
            TimeSpan ts;

            startTicks = DateTime.Now.Ticks;
            for (int i = 0; i < iterations; i++)
            {
                dllResultString = UnicodeStrings.LatinToAscii(textBox1.Text);
            }
            endTicks        = DateTime.Now.Ticks;
            dllTicks        = endTicks - startTicks;
            ts              = new TimeSpan(dllTicks);
            dllMilliseconds = ts.TotalMilliseconds;

            startTicks = DateTime.Now.Ticks;
            for (int i = 0; i < iterations; i++)
            {
                functionResultString = this.LatinToAscii(textBox1.Text);
            }
            endTicks             = DateTime.Now.Ticks;
            functionTicks        = endTicks - startTicks;
            ts                   = new TimeSpan(functionTicks);
            functionMilliseconds = ts.TotalMilliseconds;

            MessageBox.Show(
                textBox1.Text
                + ": \nAfter " + iterations.ToString() + " iterations \n"
                + "DLL returned string\t\t\"" + dllResultString
                + "\"\t in " + dllMilliseconds.ToString() + " Milliseconds.\n"
                + "Function returned string\t\"" + functionResultString
                + "\"\t in " + functionMilliseconds.ToString() + " Milliseconds.");
        }