public static int CatrucHienTai()
        {
            string text  = "";
            string right = "";
            string text2 = "";

            text2 = Strings.Format(DateAndTime.Now, "HH:mm:ss");
            int num = 1;

            do
            {
                if (CSDL.SelectThoiGianCatruc(ModuleKhaiBaoConst.StrConnectMain, Conversions.ToString(num), ref text, ref right))
                {
                    if (Operators.CompareString(text, right, false) < 0)
                    {
                        if (Operators.CompareString(text2, text, false) >= 0 & Operators.CompareString(text2, right, false) <= 0)
                        {
                            return(num);
                        }
                    }
                    else if ((Operators.CompareString(text2, text, false) >= 0 & Operators.CompareString(text2, "23:59:59", false) <= 0) | (Operators.CompareString(text2, "00:00:00", false) >= 0 & Operators.CompareString(text2, right, false) <= 0))
                    {
                        return(num);
                    }
                }
                num = checked (num + 1);
            }while (num <= 4);
            return(0);
        }
示例#2
0
 public static void InsertNhanVienDangTruc(string strCon, string MSNV, byte Catruc, string ThoiGianLuu)
 {
     string[] parameterNames = new string[]
     {
         "@MSNV",
         "@CaTruc",
         "@ThoiGianLuu"
     };
     string[] parameterValues = new string[]
     {
         MSNV,
         Catruc.ToString(),
         ThoiGianLuu
     };
     try
     {
         CSDL.InCSDLByProcedure(strCon, "InNhanVienDangTruc", parameterNames, parameterValues, 3);
     }
     catch (Exception expr_4C)
     {
         ProjectData.SetProjectError(expr_4C);
         Exception ex = expr_4C;
         ModuleKhac.SaveError(ex.Message, "InNhanVienDangTruc");
         ProjectData.ClearProjectError();
     }
 }
示例#3
0
        public static bool KiemTraVeLanCungChieu(string strCon, int LanXe, string SoVe)
        {
            string        cmdText       = "select MsVali,SoveBD,SoveKT from tbl_Vali_DataBackup where convert(int, substring(MsVali,9,2)) =  " + Conversions.ToString(LanXe);
            SqlConnection sqlConnection = new SqlConnection(strCon);
            DataTable     dataTable     = new DataTable();

            try
            {
                sqlConnection.Open();
                SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(new SqlCommand(cmdText, sqlConnection)
                {
                    CommandType = CommandType.Text
                });
                sqlDataAdapter.Fill(dataTable);
                sqlConnection.Close();
                IEnumerator enumerator = null;
                try
                {
                    enumerator = dataTable.Rows.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataRow dataRow = (DataRow)enumerator.Current;
                        string  maVali  = Conversions.ToString(dataRow["MSVali"]);
                        string  right   = Conversions.ToString(dataRow["SoveBD"]);
                        string  right2  = Conversions.ToString(dataRow["SoveKT"]);
                        if (Operators.CompareString(SoVe, right, false) >= 0 & Operators.CompareString(SoVe, right2, false) <= 0)
                        {
                            string   text  = "";
                            string   text2 = "";
                            DateTime t     = VeXe.NgayInMaVali(maVali);
                            if (CSDL.SelectThoiGianCatruc(ModuleKhaiBaoConst.StrConnectMain, Conversions.ToString(VeXe.CatrucInMaVali(maVali)), ref text, ref text2))
                            {
                                t = t.AddHours(Conversions.ToDouble(text2.Substring(0, 2))).AddMinutes(Conversions.ToDouble(text2.Substring(3, 2))).AddHours(24.0);
                                if (DateTime.Compare(DateAndTime.Now, t) <= 0)
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
            }
            catch (Exception expr_18A)
            {
                ProjectData.SetProjectError(expr_18A);
                Exception ex = expr_18A;
                ModuleKhac.SaveError(ex.Message, "KiemTraVeLanCungChieu");
                ProjectData.ClearProjectError();
            }
            return(false);
        }
示例#4
0
 public static void InsertValiDataBackup(string strCon)
 {
     string[] parameterNames = new string[]
     {
         ""
     };
     string[] parameterValues = new string[]
     {
         ""
     };
     CSDL.InCSDLByProcedure(strCon, "InValiBackup", parameterNames, parameterValues, 0);
 }
示例#5
0
        public static DataTable SelectXeQuaTram_TienPhong(string strCon)
        {
            DataTable dataTable = new DataTable();

            string[] parameterNames = new string[]
            {
                ""
            };
            string[] parameterValues = new string[]
            {
                ""
            };
            return(CSDL.TruyXuatCSDLByProcedure(strCon, "SeXeQuaTramTienPhong", parameterNames, parameterValues, 0));
        }
示例#6
0
 public static void UpXeQuaTram(string strCon, string TenHinhXe, byte PLXeSau)
 {
     string[] parameterNames = new string[]
     {
         "@TenHinhXe",
         "@PLXeSau"
     };
     string[] parameterValues = new string[]
     {
         TenHinhXe,
         Conversions.ToString(PLXeSau)
     };
     CSDL.InCSDLByProcedure(strCon, "UpxeQuaTram", parameterNames, parameterValues, 2);
 }
示例#7
0
        public static bool TimBienSoTuVeThang(string strCon, string SoVe, ref string BienSo, ref string NgayHetHan)
        {
            DataTable dataTable = new DataTable();

            string[] parameterNames = new string[]
            {
                "@SoVe"
            };
            string[] parameterValues = new string[]
            {
                SoVe
            };
            dataTable = CSDL.TruyXuatCSDLByProcedure(strCon, "SeVeBienSoTuSoVe", parameterNames, parameterValues, 1);
            try
            {
                IEnumerator enumerator = null;
                try
                {
                    enumerator = dataTable.Rows.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataRow dataRow  = (DataRow)enumerator.Current;
                        byte    loaiVe   = Conversions.ToByte(dataRow["LoaiVe"]);
                        int     thangQui = Conversions.ToInteger(dataRow["ThangQui"]);
                        int     nam      = Conversions.ToInteger(dataRow["Nam"]);
                        if (CSDL.KiemTraVeThangQui((int)loaiVe, nam, thangQui, ref NgayHetHan))
                        {
                            BienSo = Conversions.ToString(dataRow["BienSo"]);
                            return(true);
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
            }
            catch (Exception expr_D7)
            {
                ProjectData.SetProjectError(expr_D7);
                Exception ex = expr_D7;
                ModuleKhac.SaveError(ex.Message, "TimBienSoTuVeThang");
                ProjectData.ClearProjectError();
            }
            return(false);
        }
示例#8
0
 public static void InsertXeQuaTram(string strCon, XeQuaTram Xe)
 {
     string[] parameterNames = new string[]
     {
         "@BienSo",
         "@TTXeQua",
         "@SoVe",
         "@PLXeTruoc",
         "@PLVe",
         "@PLXeSau",
         "@PTTT",
         "@Phi",
         "@LanXe",
         "@NgayQuaTram",
         "@GioQuaTram",
         "@CaTruc",
         "@MSNV",
         "@TenHinhXe",
         "@BSXeThangQui"
     };
     string[] parameterValues = new string[]
     {
         Xe.BienSo,
         Conversions.ToString(Xe.TTXeQua),
         Xe.SoVe,
         Conversions.ToString(Xe.PLXeTruoc),
         Conversions.ToString(Xe.PLVe),
         Conversions.ToString(Xe.PLXeSau),
         Conversions.ToString(Xe.PTTT),
         Conversions.ToString(Xe.Phi),
         Conversions.ToString(Xe.LanXe),
         Xe.NgayQuaTram,
         Xe.GioQuaTram,
         Conversions.ToString(Xe.CaTruc),
         Xe.MSNV,
         Xe.TenHinhXe,
         Xe.BSXeThangQui
     };
     try
     {
         CSDL.InCSDLByProcedure(strCon, "InXeQuaTram", parameterNames, parameterValues, 15);
     }
     catch (Exception expr_158)
     {
         ProjectData.SetProjectError(expr_158);
         ProjectData.ClearProjectError();
     }
 }
示例#9
0
        private static bool KiemTraVeThangQui(int LoaiVe, int Nam, int ThangQui, ref string NgayHetHanVe)
        {
            DateTime dateTime  = DateTime.MinValue;
            DateTime dateTime2 = DateTime.MinValue;

            CSDL.TinhThoiHanVe(LoaiVe, ThangQui, Nam, ref dateTime, ref dateTime2);
            DateTime t = DateTime.Parse(Strings.Format(DateAndTime.Now, "MM/dd/yyyy"));

            dateTime  = DateTime.Parse(Strings.Format(dateTime, "MM/dd/yyyy"));
            dateTime2 = DateTime.Parse(Strings.Format(dateTime2, "MM/dd/yyyy"));
            if (DateTime.Compare(t, dateTime) >= 0 & DateTime.Compare(t, dateTime2) <= 0)
            {
                NgayHetHanVe = Strings.Format(dateTime2, "dd/MM/yyyy");
                return(true);
            }
            return(false);
        }
示例#10
0
        public static bool SelectNhanVienDangTruc(string strCon, ref string MSNV, ref byte Catruc, ref string ThoiGianLuu)
        {
            string[] parameterNames = new string[]
            {
                ""
            };
            string[] parameterValues = new string[]
            {
                ""
            };
            DataTable dataTable = new DataTable();

            dataTable = CSDL.TruyXuatCSDLByProcedure(strCon, "SeNhanVienDangTruc", parameterNames, parameterValues, 0);
            try
            {
                IEnumerator enumerator = null;
                try
                {
                    enumerator = dataTable.Rows.GetEnumerator();
                    if (enumerator.MoveNext())
                    {
                        DataRow dataRow = (DataRow)enumerator.Current;
                        MSNV        = Conversions.ToString(dataRow["MSNV"]);
                        Catruc      = Conversions.ToByte(dataRow["CaTruc"]);
                        ThoiGianLuu = Conversions.ToString(dataRow["ThoiGianLuu"]);
                        return(true);
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
            }
            catch (Exception expr_BA)
            {
                ProjectData.SetProjectError(expr_BA);
                Exception ex = expr_BA;
                ModuleKhac.SaveError(ex.Message, "SelectNhanVienDangTruc");
                ProjectData.ClearProjectError();
            }
            return(false);
        }
示例#11
0
        public static bool SelectMenhGiaVe(string strCon, string LoaiXe, ref long Phi, ref long PhiThang, ref long PhiQui)
        {
            DataTable dataTable = new DataTable();

            string[] parameterNames = new string[]
            {
                "@LoaiXe"
            };
            string[] parameterValues = new string[]
            {
                LoaiXe
            };
            dataTable = CSDL.TruyXuatCSDLByProcedure(strCon, "SePhi", parameterNames, parameterValues, 1);
            try
            {
                IEnumerator enumerator = null;
                try
                {
                    enumerator = dataTable.Rows.GetEnumerator();
                    if (enumerator.MoveNext())
                    {
                        DataRow dataRow = (DataRow)enumerator.Current;
                        Phi      = Conversions.ToLong(dataRow["Phi"]);
                        PhiThang = Conversions.ToLong(dataRow["PhiThang"]);
                        PhiQui   = Conversions.ToLong(dataRow["PhiQui"]);
                        return(true);
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
            }
            catch (Exception expr_B7)
            {
                ProjectData.SetProjectError(expr_B7);
                Exception ex = expr_B7;
                ModuleKhac.SaveError(ex.Message, "SelectMenhGiaVe");
                ProjectData.ClearProjectError();
            }
            return(false);
        }
示例#12
0
        public static bool SelectThoiGianCatruc(string strCon, string CaTruc, ref string GioBD, ref string GioKT)
        {
            DataTable dataTable = new DataTable();

            string[] parameterNames = new string[]
            {
                "@CaTruc"
            };
            string[] parameterValues = new string[]
            {
                CaTruc
            };
            dataTable = CSDL.TruyXuatCSDLByProcedure(strCon, "SeCaTruc", parameterNames, parameterValues, 1);
            try
            {
                IEnumerator enumerator = null;
                try
                {
                    enumerator = dataTable.Rows.GetEnumerator();
                    if (enumerator.MoveNext())
                    {
                        DataRow dataRow = (DataRow)enumerator.Current;
                        GioBD = Conversions.ToString(dataRow["GioBD"]);
                        GioKT = Conversions.ToString(dataRow["GioKT"]);
                        return(true);
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
            }
            catch (Exception expr_A3)
            {
                ProjectData.SetProjectError(expr_A3);
                Exception ex = expr_A3;
                ModuleKhac.SaveError(ex.Message, "SelectThoiGianCaTRuc");
                ProjectData.ClearProjectError();
            }
            return(false);
        }
示例#13
0
        public static bool SelectNhanVien(string strCon, string MSNV, ref string HoTen)
        {
            DataTable dataTable = new DataTable();

            string[] parameterNames = new string[]
            {
                "@MSNV"
            };
            string[] parameterValues = new string[]
            {
                MSNV
            };
            dataTable = CSDL.TruyXuatCSDLByProcedure(strCon, "SeNhanVien", parameterNames, parameterValues, 1);
            try
            {
                IEnumerator enumerator = null;
                try
                {
                    enumerator = dataTable.Rows.GetEnumerator();
                    if (enumerator.MoveNext())
                    {
                        DataRow dataRow = (DataRow)enumerator.Current;
                        HoTen = Conversions.ToString(dataRow["HoTen"]);
                        return(true);
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
            }
            catch (Exception expr_90)
            {
                ProjectData.SetProjectError(expr_90);
                Exception ex = expr_90;
                ModuleKhac.SaveError(ex.Message, "SelectNhanVien");
                ProjectData.ClearProjectError();
            }
            return(false);
        }
 public static void ConnectServer(XeQuaTram Xe)
 {
     try
     {
         Socket      socket      = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
         IPHostEntry hostEntry   = Dns.GetHostEntry(ModuleKhaiBaoConst.IPMayGiamSatMain);
         IPAddress[] addressList = hostEntry.AddressList;
         IPAddress[] array       = addressList;
         IPAddress   address     = default(IPAddress);
         foreach (IPAddress iPAddress in array)
         {
             if (iPAddress.AddressFamily == AddressFamily.InterNetwork)
             {
                 address = iPAddress;
                 break;
             }
         }
         IPEndPoint remoteEP = new IPEndPoint(address, ModuleKhaiBaoConst.PortDuLieuChinhMain);
         socket.Connect(remoteEP);
         byte[] bytes = Encoding.ASCII.GetBytes(Xe.ToString());
         socket.Send(bytes, bytes.Length, SocketFlags.None);
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         ProjectData.ClearProjectError();
     }
     CSDL.InsertXeQuaTram(ModuleKhaiBaoConst.StrConnectMain, Xe);
     try
     {
         CSDL.InsertXeQuaTram(ModuleKhaiBaoConst.StrConnectMain_mas, Xe);
     }
     catch (Exception ex3)
     {
         ProjectData.SetProjectError(ex3);
         Exception ex4 = ex3;
         ProjectData.ClearProjectError();
     }
 }
示例#15
0
 public static void DeleteVeSuDung(string strCon)
 {
     string[] parameterNames = new string[]
     {
         ""
     };
     string[] parameterValues = new string[]
     {
         ""
     };
     try
     {
         CSDL.InCSDLByProcedure(strCon, "DeVeSuDung", parameterNames, parameterValues, 0);
     }
     catch (Exception expr_32)
     {
         ProjectData.SetProjectError(expr_32);
         Exception ex = expr_32;
         ModuleKhac.SaveError(ex.Message, "DeleteVeSuDung");
         ProjectData.ClearProjectError();
     }
 }
示例#16
0
 public static void InsertVeSuDung(string strCon, string SoVe)
 {
     string[] parameterNames = new string[]
     {
         "@SoVe"
     };
     string[] parameterValues = new string[]
     {
         SoVe
     };
     try
     {
         CSDL.InCSDLByProcedure(strCon, "InVeSuDung", parameterNames, parameterValues, 1);
     }
     catch (Exception expr_2E)
     {
         ProjectData.SetProjectError(expr_2E);
         Exception ex = expr_2E;
         ModuleKhac.SaveError(ex.Message, "InsertVeSuDung");
         ProjectData.ClearProjectError();
     }
 }
示例#17
0
 public static void DeleteXeQuaTram_TienPhong(string strCon, string TenHinhXe)
 {
     string[] parameterNames = new string[]
     {
         "@TenHinhXe"
     };
     string[] parameterValues = new string[]
     {
         TenHinhXe
     };
     try
     {
         CSDL.InCSDLByProcedure(strCon, "DeXeQuaTramTienPhong", parameterNames, parameterValues, 1);
     }
     catch (Exception expr_2E)
     {
         ProjectData.SetProjectError(expr_2E);
         Exception ex = expr_2E;
         ModuleKhac.SaveError(ex.Message, "DeleteXeQuaTramTienPhong");
         ProjectData.ClearProjectError();
     }
 }
示例#18
0
        public static bool KiemTraNhanVienDangTruc(ref string MaNV)
        {
            string text           = "";
            string s              = "";
            string strConnectMain = ModuleKhaiBaoConst.StrConnectMain;

            checked
            {
                int  num  = default(int);
                byte b    = (byte)num;
                bool num2 = CSDL.SelectNhanVienDangTruc(strConnectMain, ref text, ref b, ref s);
                num = b;
                if (!num2)
                {
                    return(false);
                }
                int num3;
                try
                {
                    num3 = (int)Math.Round((DateAndTime.Now - DateTime.Parse(s)).TotalMinutes);
                }
                catch (Exception ex)
                {
                    ProjectData.SetProjectError(ex);
                    Exception ex2 = ex;
                    num3 = 1000;
                    ProjectData.ClearProjectError();
                }
                if (num3 < 600 && num == CatrucHienTai())
                {
                    MaNV = text;
                    return(true);
                }
                return(false);
            }
        }
示例#19
0
        public static void SendOldData_TienPhong()
        {
            try
            {
                Socket      socket      = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                IPHostEntry hostEntry   = Dns.GetHostEntry(ModuleKhaiBaoConst.IPMayGiamSatMain);
                IPAddress[] addressList = hostEntry.AddressList;
                IPAddress[] array       = addressList;
                IPAddress   address     = default(IPAddress);
                foreach (IPAddress iPAddress in array)
                {
                    if (iPAddress.AddressFamily == AddressFamily.InterNetwork)
                    {
                        address = iPAddress;
                        break;
                    }
                }
                IPEndPoint remoteEP     = new IPEndPoint(address, ModuleKhaiBaoConst.PortDuLieuCuMain);
                string     text         = "";
                long       phi          = 0L;
                long       num          = 0L;
                long       num2         = 0L;
                string     bSXeThangQui = "";
                string     text2        = "";
                DataTable  dataTable    = new DataTable();
                dataTable = CSDL.SelectXeQuaTram_TienPhong(ModuleKhaiBaoConst.StrConnectMain);
                socket.Connect(remoteEP);
                socket.ReceiveTimeout = 5000;
                IEnumerator enumerator = default(IEnumerator);
                try
                {
                    enumerator = dataTable.Rows.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataRow   dataRow   = (DataRow)enumerator.Current;
                        XeQuaTram xeQuaTram = new XeQuaTram();
                        xeQuaTram.BienSo      = Conversions.ToString(dataRow["BienSo"]);
                        xeQuaTram.CaTruc      = RuntimeHelpers.GetObjectValue(dataRow["CaTruc"]);
                        xeQuaTram.GioQuaTram  = Conversions.ToString(dataRow["GioQuaTram"]);
                        xeQuaTram.LanXe       = Conversions.ToByte(dataRow["LanXe"]);
                        xeQuaTram.MSNV        = Conversions.ToString(dataRow["MSNV"]);
                        xeQuaTram.NgayQuaTram = Conversions.ToString(dataRow["NgayQuaTram"]);
                        xeQuaTram.PLXeSau     = 0;
                        xeQuaTram.PLXeTruoc   = 0;
                        xeQuaTram.TenHinhXe   = Conversions.ToString(dataRow["TenHinhXe"]);
                        text = (xeQuaTram.SoVe = Conversions.ToString(dataRow["SoVe"]));
                        int num3 = VeXe.LoaiVe(text);
                        int num4 = VeXe.PhanLoaiVe(text);
                        checked
                        {
                            xeQuaTram.PLVe = (byte)num4;
                            xeQuaTram.PTTT = (byte)num3;
                            switch (num3)
                            {
                            case 1:
                                CSDL.SelectMenhGiaVe(ModuleKhaiBaoConst.StrConnectMain, Conversions.ToString(num4), ref phi, ref num, ref num2);
                                xeQuaTram.Phi          = phi;
                                xeQuaTram.BSXeThangQui = ModuleKhaiBaoConst.EnumStrNull.BienSoNull;
                                break;

                            case 2:
                                CSDL.TimBienSoTuVeThang(ModuleKhaiBaoConst.StrConnectMain, text, ref bSXeThangQui, ref text2);
                                xeQuaTram.BSXeThangQui = bSXeThangQui;
                                xeQuaTram.Phi          = 0L;
                                break;

                            case 11:
                                xeQuaTram.Phi          = 0L;
                                xeQuaTram.BSXeThangQui = ModuleKhaiBaoConst.EnumStrNull.BienSoNull;
                                break;

                            default:
                                xeQuaTram.Phi          = 0L;
                                xeQuaTram.BSXeThangQui = ModuleKhaiBaoConst.EnumStrNull.BienSoNull;
                                break;
                            }
                            byte[] bytes = Encoding.ASCII.GetBytes(xeQuaTram.ToString());
                            socket.Send(bytes, bytes.Length, SocketFlags.None);
                            byte[] array2 = new byte[31];
                            int    num5   = 0;
                            num5 = socket.Receive(array2, array2.Length, SocketFlags.None);
                            string @string = Encoding.ASCII.GetString(array2, 0, num5);
                            CSDL.DeleteXeQuaTram_TienPhong(ModuleKhaiBaoConst.StrConnectMain, @string);
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                goto end_IL_0000;
IL_02f1:
                end_IL_0000 :;
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                Exception ex2 = ex;
                ProjectData.ClearProjectError();
            }
        }
示例#20
0
        public static bool TimDLXeMauTuBienSo(string strCon, string BienSo, ref byte PLTruoc, ref bool XeUuTien)
        {
            DataTable dataTable = new DataTable();
            DateTime  t         = DateTime.Parse(Strings.Format(DateAndTime.Now, "MM/dd/yyyy"));

            string[] parameterNames = new string[]
            {
                "@BienSo"
            };
            string[] parameterValues = new string[]
            {
                BienSo
            };
            dataTable = CSDL.TruyXuatCSDLByProcedure(strCon, "SeDLXeMau", parameterNames, parameterValues, 1);
            try
            {
                IEnumerator enumerator = null;
                try
                {
                    enumerator = dataTable.Rows.GetEnumerator();
                    if (enumerator.MoveNext())
                    {
                        DataRow dataRow = (DataRow)enumerator.Current;
                        PLTruoc  = Conversions.ToByte(dataRow["PLXe"]);
                        XeUuTien = false;
                        try
                        {
                            int num = Conversions.ToInteger(dataRow["TinhTrangMuaVe"]);
                            if (num == 5)
                            {
                                DateTime t2 = DateTime.Parse(Conversions.ToString(dataRow["NgayApDung"]));
                                DateTime t3 = DateTime.Parse(Conversions.ToString(dataRow["NgayHetHan"]));
                                if (DateTime.Compare(t, t2) >= 0 & DateTime.Compare(t, t3) <= 0)
                                {
                                    XeUuTien = true;
                                }
                            }
                        }
                        catch (Exception expr_FA)
                        {
                            ProjectData.SetProjectError(expr_FA);
                            XeUuTien = false;
                            ProjectData.ClearProjectError();
                        }
                        return(true);
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
            }
            catch (Exception expr_137)
            {
                ProjectData.SetProjectError(expr_137);
                Exception ex = expr_137;
                ModuleKhac.SaveError(ex.Message, "TimDLXeMauTuBienSo");
                ProjectData.ClearProjectError();
            }
            return(false);
        }
示例#21
0
        public static void SendOldData()
        {
            try
            {
                Socket      socket      = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                IPHostEntry hostEntry   = Dns.GetHostEntry(ModuleKhaiBaoConst.IPMayGiamSatMain);
                IPAddress[] addressList = hostEntry.AddressList;
                IPAddress[] array       = addressList;
                IPAddress   address     = default(IPAddress);
                foreach (IPAddress iPAddress in array)
                {
                    if (iPAddress.AddressFamily == AddressFamily.InterNetwork)
                    {
                        address = iPAddress;
                        break;
                    }
                }
                IPEndPoint remoteEP  = new IPEndPoint(address, ModuleKhaiBaoConst.PortDuLieuCuMain);
                DataTable  dataTable = new DataTable();
                dataTable = CSDL.SelectXeQuaTram(ModuleKhaiBaoConst.StrConnectMain);
                socket.Connect(remoteEP);
                socket.ReceiveTimeout = 5000;
                IEnumerator enumerator = default(IEnumerator);
                try
                {
                    enumerator = dataTable.Rows.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataRow   dataRow   = (DataRow)enumerator.Current;
                        XeQuaTram xeQuaTram = new XeQuaTram();
                        xeQuaTram.BienSo       = Conversions.ToString(dataRow["BienSo"]);
                        xeQuaTram.CaTruc       = RuntimeHelpers.GetObjectValue(dataRow["CaTruc"]);
                        xeQuaTram.GioQuaTram   = Conversions.ToString(dataRow["GioQuaTram"]);
                        xeQuaTram.LanXe        = Conversions.ToByte(dataRow["LanXe"]);
                        xeQuaTram.MSNV         = Conversions.ToString(dataRow["MSNV"]);
                        xeQuaTram.NgayQuaTram  = Conversions.ToString(dataRow["NgayQuaTram"]);
                        xeQuaTram.Phi          = Conversions.ToLong(dataRow["Phi"]);
                        xeQuaTram.PLVe         = Conversions.ToByte(dataRow["PLVe"]);
                        xeQuaTram.PLXeSau      = Conversions.ToByte(dataRow["PLXeSau"]);
                        xeQuaTram.PLXeTruoc    = Conversions.ToByte(dataRow["PLXeTruoc"]);
                        xeQuaTram.PTTT         = Conversions.ToByte(dataRow["PTTT"]);
                        xeQuaTram.SoVe         = Conversions.ToString(dataRow["SoVe"]);
                        xeQuaTram.TenHinhXe    = Conversions.ToString(dataRow["TenHinhXe"]);
                        xeQuaTram.BSXeThangQui = Conversions.ToString(dataRow["BSXeThangQui"]);
                        if (xeQuaTram.LanXe <= 0)
                        {
                            CSDL.DeleteXeQuaTram(ModuleKhaiBaoConst.StrConnectMain, xeQuaTram.TenHinhXe);
                        }
                        else
                        {
                            byte[] bytes = Encoding.ASCII.GetBytes(xeQuaTram.ToString());
                            socket.Send(bytes, bytes.Length, SocketFlags.None);
                            byte[] array2 = new byte[31];
                            int    num    = 0;
                            num = socket.Receive(array2, array2.Length, SocketFlags.None);
                            string @string = Encoding.ASCII.GetString(array2, 0, num);
                            CSDL.DeleteXeQuaTram(ModuleKhaiBaoConst.StrConnectMain, @string);
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                goto end_IL_0000;
IL_028c:
                end_IL_0000 :;
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                Exception ex2 = ex;
                ProjectData.ClearProjectError();
            }
        }
示例#22
0
        public static bool SelectVali(string strCon, string MSNV, string SoVe, int LanXe, int TramId)
        {
            if (CSDL.Ve_Test(strCon, SoVe))
            {
                return(true);
            }
            DataTable dataTable = new DataTable();

            string[] parameterNames = new string[]
            {
                "@MSNV"
            };
            string[] parameterValues = new string[]
            {
                MSNV
            };
            dataTable = CSDL.TruyXuatCSDLByProcedure(strCon, "SeValiData", parameterNames, parameterValues, 1);
            try
            {
                IEnumerator enumerator = null;
                try
                {
                    enumerator = dataTable.Rows.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataRow dataRow = (DataRow)enumerator.Current;
                        string  maVali  = Conversions.ToString(dataRow["MSVali"]);
                        string  right   = Conversions.ToString(dataRow["SoVeBD"]);
                        string  right2  = Conversions.ToString(dataRow["SoVeKT"]);
                        if (Operators.CompareString(SoVe, right, false) >= 0 & Operators.CompareString(SoVe, right2, false) <= 0 & (int)VeXe.CabinInMaVali(maVali) == LanXe)
                        {
                            string left   = Strings.Format(DateAndTime.Now, "yyMMdd");
                            string left2  = Strings.Format(DateAndTime.DateAdd(DateInterval.Day, -1.0, DateAndTime.Now), "yyMMdd");
                            string left3  = Strings.Format(DateAndTime.Now, "HH");
                            string right3 = "12";
                            switch (ModuleKhaiBaoConst.CaTrucMain)
                            {
                            case 1:
                            case 2:
                                if ((int)VeXe.CatrucInMaVali(maVali) == ModuleKhaiBaoConst.CaTrucMain & Operators.CompareString(left, VeXe.NgayInMaValiString(maVali), false) == 0)
                                {
                                    bool result = true;
                                    return(result);
                                }
                                break;

                            case 3:
                                if ((int)VeXe.CatrucInMaVali(maVali) == ModuleKhaiBaoConst.CaTrucMain & ((Operators.CompareString(left, VeXe.NgayInMaValiString(maVali), false) == 0 & Operators.CompareString(left3, right3, false) > 0) | (Operators.CompareString(left2, VeXe.NgayInMaValiString(maVali), false) == 0 & Operators.CompareString(left3, right3, false) < 0)))
                                {
                                    bool result = true;
                                    return(result);
                                }
                                break;
                            }
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
            }
            catch (Exception expr_1F4)
            {
                ProjectData.SetProjectError(expr_1F4);
                Exception ex = expr_1F4;
                ModuleKhac.SaveError(ex.Message, "SelectVali");
                ProjectData.ClearProjectError();
            }
            return(false);
        }