Exemplo n.º 1
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();
     }
 }
Exemplo n.º 2
0
        private static DataTable TruyXuatCSDLByProcedure(string strCon, string ProcedureName, string[] ParameterNames, string[] ParameterValues, int SoParameter)
        {
            SqlConnection sqlConnection = new SqlConnection(strCon);
            DataTable     dataTable     = new DataTable();

            checked
            {
                try
                {
                    sqlConnection.Open();
                    SqlCommand sqlCommand = new SqlCommand(ProcedureName, sqlConnection);
                    int        arg_23_0   = 0;
                    int        num        = SoParameter - 1;
                    for (int i = arg_23_0; i <= num; i++)
                    {
                        sqlCommand.Parameters.AddWithValue(ParameterNames[i], ParameterValues[i]);
                    }
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
                    sqlDataAdapter.Fill(dataTable);
                    sqlConnection.Close();
                }
                catch (Exception expr_68)
                {
                    ProjectData.SetProjectError(expr_68);
                    Exception ex = expr_68;
                    ModuleKhac.SaveError(ex.Message, "TruyXuatCSDLByProcedure");
                    ProjectData.ClearProjectError();
                }
                return(dataTable);
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 public bool TaoVideo()
 {
     checked
     {
         bool result = false;
         try
         {
             if (this._FlagLuuVideo)
             {
                 this._FlagLuuVideo = false;
                 if (this._SoKhungHinhHienTai <= 0)
                 {
                     result = false;
                 }
                 else
                 {
                     VideoFileWriter videoFileWriter = new VideoFileWriter();
                     videoFileWriter.Open(this.DuongDanLuuVideo, 720, 576, 5);
                     int arg_4A_0 = 0;
                     int num      = this._SoKhungHinhHienTai - 1;
                     for (int i = arg_4A_0; i <= num; i++)
                     {
                         if (this._Hinh[i] != null)
                         {
                             try
                             {
                                 videoFileWriter.WriteVideoFrame(this._Hinh[i]);
                             }
                             catch (Exception expr_67)
                             {
                                 ProjectData.SetProjectError(expr_67);
                                 ProjectData.ClearProjectError();
                             }
                         }
                     }
                     this._SoKhungHinhHienTai = 0;
                     this._Hinh = null;
                     videoFileWriter.Close();
                     GC.Collect();
                     result = true;
                 }
             }
         }
         catch (Exception expr_9D)
         {
             ProjectData.SetProjectError(expr_9D);
             Exception ex = expr_9D;
             ModuleKhac.SaveError(ex.Message, "LuuVideo");
             ProjectData.ClearProjectError();
         }
         return(result);
     }
 }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
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();
     }
 }
Exemplo n.º 11
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();
     }
 }
Exemplo n.º 12
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();
     }
 }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
0
 private void ComPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     checked
     {
         try
         {
             if (this.ComPort.IsOpen)
             {
                 Thread.Sleep(50);
                 char[] separator = Conversions.ToCharArrayRankOne("$");
                 string text      = this.ComPort.ReadExisting();
                 text = text.Remove(0, 1);
                 string[] array    = text.Split(separator);
                 int      arg_49_0 = 0;
                 int      num      = array.Length - 1;
                 for (int i = arg_49_0; i <= num; i++)
                 {
                     string text2 = array[i];
                     if (text2.Length >= 4)
                     {
                         string text3 = text2.Substring(0, 1);
                         string left  = text3;
                         if (Operators.CompareString(left, "A", false) != 0)
                         {
                             if (Operators.CompareString(left, "N", false) != 0)
                             {
                                 if (Operators.CompareString(left, "B", false) != 0)
                                 {
                                     if (Operators.CompareString(left, "I", false) != 0)
                                     {
                                         if (Operators.CompareString(left, "M", false) != 0)
                                         {
                                             if (Operators.CompareString(left, "E", false) != 0)
                                             {
                                                 if (Operators.CompareString(left, "C", false) != 0)
                                                 {
                                                     if (Operators.CompareString(left, "O", false) != 0)
                                                     {
                                                         goto IL_10F;
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         text2 = text2.Substring(0, 3);
                         this.XuLyData(text2);
                     }
                     IL_10F :;
                 }
             }
         }
         catch (Exception expr_11D)
         {
             ProjectData.SetProjectError(expr_11D);
             Exception ex = expr_11D;
             ModuleKhac.SaveError("ComPort_DataReceived", ex.Message);
             ProjectData.ClearProjectError();
         }
     }
 }