Exemple #1
0
        public static List <string> GetListSoHieuXe()
        {
            List <string> listSoHieuXe = new List <string>();

            try
            {
                DataTable dt    = new DataTable();
                List <Xe> lstXe = new List <Xe>();
                dt = new Data.DM.Xe().GetTatCaCacXe();
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        listSoHieuXe.Add(StringTools.TrimSpace(dr["PK_SoHieuXe"].ToString()));
                    }
                }
                else
                {
                    listSoHieuXe = null;
                }
            }
            catch (Exception ex)
            {
                listSoHieuXe = null;
            }
            return(listSoHieuXe);
        }
Exemple #2
0
        /// <summary>
        /// kiem tra xem mot so hieu xe da co chua
        /// </summary>
        /// <param name="SoHieuXe"></param>
        /// <returns></returns>
        public static bool KiemTraTonTaiCuaSoHieuXe(string SoHieuXe)
        {
            DataTable dt = new DataTable();

            dt = new Data.DM.Xe().GetChiTietMotXe(SoHieuXe);
            if (dt.Rows.Count > 0)
            {
                return(true);
            }
            return(false);
        }
Exemple #3
0
        public List <Xe> GetListXes()
        {
            try
            {
                DataTable dt    = new DataTable();
                List <Xe> lstXe = new List <Xe>();

                dt = new Data.DM.Xe().GetTatCaCacXe();
                if (dt == null)
                {
                    return(lstXe);
                }
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        Xe objXe = new Xe();
                        objXe.SoHieuXe     = !dr.Table.Columns.Contains("PK_SoHieuXe") ? "" : dr["PK_SoHieuXe"].ToString();
                        objXe.BienKiemSoat = !dr.Table.Columns.Contains("BienKiemSoat") ? "" : dr["BienKiemSoat"].ToString();
                        objXe.SoMay        = !dr.Table.Columns.Contains("SoMay") ? "" : dr["SoMay"].ToString();
                        objXe.SoKhung      = !dr.Table.Columns.Contains("SoKhung") ? "" : dr["SoKhung"].ToString();
                        int loaiXeId = 0;
                        if (dr.Table.Columns.Contains("FK_LoaiXeID") && dr["FK_LoaiXeID"] != DBNull.Value && int.TryParse(dr["FK_LoaiXeID"].ToString(), out loaiXeId))
                        {
                            objXe.LoaiXeID = loaiXeId;
                        }
                        objXe.TenLoaiXe = !dr.Table.Columns.Contains("TenLoaiXe") ? "" : dr["TenLoaiXe"].ToString();
                        objXe.LoaiXe    = objXe.TenLoaiXe;
                        int garaID = 0;
                        if (dr.Table.Columns.Contains("FK_GaraID") && dr["FK_GaraID"] != DBNull.Value && int.TryParse(dr["FK_GaraID"].ToString(), out garaID))
                        {
                            objXe.GaraID = garaID;
                        }
                        objXe.GaraName = !dr.Table.Columns.Contains("GaraName") ? "" : dr["GaraName"].ToString();
                        int soCho = 0;
                        if (dr.Table.Columns.Contains("SoCho") && dr["SoCho"] != DBNull.Value && int.TryParse(dr["SoCho"].ToString(), out soCho))
                        {
                            objXe.SoCho = soCho;
                        }
                        lstXe.Add(objXe);
                    }
                    return(lstXe);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("GetListXes", ex);
                return(null);
            }
        }
Exemple #4
0
        /// <summary>
        /// Danh sách Mã loại xe ứng với Loại xe bên GPS
        /// </summary>
        /// <param name="NhomXe">4,7,0</param>
        /// <returns>12,23,34,45</returns>
        public string LayDanhSachLoaiXe_GPS(string NhomXe)
        {
            string    strID = "";
            DataTable dt    = new Data.DM.Xe().LayDanhSachLoaiXe_GPS(NhomXe);

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        strID = string.Format("{0}{1},", strID, row["LoaiXeID_GPS"]);
                    }
                    strID = strID.Substring(0, strID.Length - 1);
                }
            }
            return(strID);
        }
Exemple #5
0
        public Xe GetChiTietXe(string SoHieuXe)
        {
            try
            {
                DataTable dt = new DataTable();


                dt = new Data.DM.Xe().GetChiTietMotXe(SoHieuXe);
                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];

                    Xe objXe = new Xe();
                    objXe.SoHieuXe     = dr["PK_SoHieuXe"] == DBNull.Value ? string.Empty : dr["PK_SoHieuXe"].ToString();
                    objXe.BienKiemSoat = dr["BienKiemSoat"] == DBNull.Value ? string.Empty : dr["BienKiemSoat"].ToString();
                    objXe.SoMay        = dr["SoMay"] == DBNull.Value ? string.Empty : dr["SoMay"].ToString();
                    objXe.SoKhung      = dr["SoKhung"] == DBNull.Value ? string.Empty : dr["SoKhung"].ToString();
                    objXe.LoaiXeID     = dr["FK_LoaiXeID"] == DBNull.Value ? 0 : int.Parse(dr["FK_LoaiXeID"].ToString());
                    objXe.TenLoaiXe    = dr["TenLoaiXe"].ToString();
                    objXe.GaraID       = dr["FK_GaraID"] == DBNull.Value ? 0 : int.Parse(dr["FK_GaraID"].ToString());
                    objXe.GaraName     = dr["GaraName"].ToString();
                    objXe.SoCho        = dr["SoCho"] == DBNull.Value ?  4 :   int.Parse(dr["SoCho"].ToString());
                    objXe.TenNhanVien  = dr["TenNhanVien"] == DBNull.Value ? string.Empty : dr["TenNhanVien"].ToString();
                    objXe.DienThoai    = dr["DienThoai"] == DBNull.Value ? string.Empty : dr["DienThoai"].ToString();
                    return(objXe);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("GetChiTietXe", ex);
                return(null);
            }
        }