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 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(); } }