public XeQuaTram Insert(string SoVe, long Phi, string BSXeThangQui, bool FlagThuHoi)
        {
            XeQuaTram result = new XeQuaTram();

            if (size <= 0)
            {
                return(result);
            }
            int num = -1;

            if (Operators.CompareString(Car[front].SoVe, ModuleKhaiBaoConst.EnumStrNull.SoVeNull, false) == 0)
            {
                num = front;
            }
            else if (Operators.CompareString(Car[rear].SoVe, ModuleKhaiBaoConst.EnumStrNull.SoVeNull, false) == 0)
            {
                num = rear;
            }
            if (num == -1)
            {
                return(result);
            }
            Car[num].SoVe         = SoVe;
            Car[num].PTTT         = VeXe.LoaiVe(SoVe);
            Car[num].PLVe         = VeXe.PhanLoaiVe(SoVe);
            Car[num].Phi          = Phi;
            Car[num].BSXeThangQui = BSXeThangQui;
            return(Car[num].Paste());
        }
 public QueueXeQuaTram()
 {
     Car              = new XeQuaTram[3];
     front            = 1;
     rear             = 0;
     size             = 0;
     CarOutVungTuCuoi = new XeQuaTram();
 }
 public void Send(int PLSau)
 {
     if (!CarOutVungTuCuoi.Null)
     {
         XeQuaTram xeQuaTram = new XeQuaTram();
         xeQuaTram = CarOutVungTuCuoi.Paste();
         CarOutVungTuCuoi.Reset();
         xeQuaTram.PLXeSau = checked ((byte)PLSau);
         Thread thread = new Thread(delegate(object a0)
         {
             ConnectServerUpData((XeQuaTram)a0);
         });
         thread.Start(xeQuaTram);
     }
 }
 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();
     }
 }
Exemple #5
0
 public void Coppy(XeQuaTram Car)
 {
     BienSo       = Car.BienSo;
     CaTruc       = RuntimeHelpers.GetObjectValue(Car.CaTruc);
     GioQuaTram   = Car.GioQuaTram;
     LanXe        = Car.LanXe;
     MSNV         = Car.MSNV;
     NgayQuaTram  = Car.NgayQuaTram;
     Phi          = Car.Phi;
     PLVe         = Car.PLVe;
     PLXeSau      = Car.PLXeSau;
     PLXeTruoc    = Car.PLXeTruoc;
     PTTT         = Car.PTTT;
     SoVe         = Car.SoVe;
     TenHinhXe    = Car.TenHinhXe;
     BSXeThangQui = Car.BSXeThangQui;
     DataSend     = Car.DataSend;
 }
 public void EnQueue(string Ngay, string Gio, string MaNhanVien, byte Catruc, byte LanXe, string HinhAnh)
 {
     if (size == 2)
     {
         DeQueue();
     }
     checked
     {
         rear                  = (byte)unchecked (checked (unchecked ((int)rear) + 1) % 2);
         Car[rear]             = new XeQuaTram();
         Car[rear].NgayQuaTram = Ngay;
         Car[rear].GioQuaTram  = Gio;
         Car[rear].TenHinhXe   = HinhAnh;
         Car[rear].MSNV        = MaNhanVien;
         Car[rear].CaTruc      = Catruc;
         Car[rear].LanXe       = LanXe;
         Car[rear].DataSend    = true;
         size                  = (byte)(unchecked ((int)size) + 1);
     }
 }
Exemple #7
0
        public XeQuaTram Paste()
        {
            XeQuaTram xeQuaTram = new XeQuaTram();

            xeQuaTram.BienSo       = BienSo;
            xeQuaTram.CaTruc       = RuntimeHelpers.GetObjectValue(CaTruc);
            xeQuaTram.GioQuaTram   = GioQuaTram;
            xeQuaTram.LanXe        = LanXe;
            xeQuaTram.MSNV         = MSNV;
            xeQuaTram.NgayQuaTram  = NgayQuaTram;
            xeQuaTram.Phi          = Phi;
            xeQuaTram.PLVe         = PLVe;
            xeQuaTram.PLXeSau      = PLXeSau;
            xeQuaTram.PLXeTruoc    = PLXeTruoc;
            xeQuaTram.PTTT         = PTTT;
            xeQuaTram.SoVe         = SoVe;
            xeQuaTram.TenHinhXe    = TenHinhXe;
            xeQuaTram.BSXeThangQui = BSXeThangQui;
            xeQuaTram.DataSend     = DataSend;
            return(xeQuaTram);
        }
 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();
     }
 }
 public void Send(bool CoHuyDuLieu)
 {
     if (size > 0)
     {
         XeQuaTram xeQuaTram = new XeQuaTram();
         if (Car[front].DataSend)
         {
             xeQuaTram        = Car[front].Paste();
             CarOutVungTuCuoi = new XeQuaTram();
             CarOutVungTuCuoi = Car[front].Paste();
             Thread thread = new Thread(delegate(object a0)
             {
                 ConnectServer((XeQuaTram)a0);
             });
             thread.Start(xeQuaTram);
             Car[front].DataSend = false;
         }
         if (CoHuyDuLieu)
         {
             DeQueue();
         }
     }
 }
 public static void ConnectServerUpData(XeQuaTram Xe)
 {
 }
        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();
            }
        }
        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();
            }
        }