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());
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
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();
            }
        }