Ejemplo n.º 1
0
        public void CT()
        {
            SqlConnection BaoVe = new SqlConnection("server=(local)\\SQLEXPRESS;uid=sa;pwd=123;database=QuanLyCongVan");
            SqlCommand    Lenh  = new SqlCommand("CV_U_TT_CT", BaoVe);

            Lenh.CommandType = CommandType.StoredProcedure;
            SqlParameter ThamSo = new SqlParameter();

            ThamSo = Lenh.Parameters.AddWithValue("@So", So);
            SqlDataReader DocDL;

            BaoVe.Open();
            DocDL = Lenh.ExecuteReader();
            if (DocDL.Read() == true)
            {
                Ma_CV         = DocDL["Ma"].ToString();
                So            = int.Parse(DocDL["So"].ToString());
                So_CV         = DocDL["So_CV"].ToString();
                TenCV         = DocDL["TenCV"].ToString();
                TenTT         = DocDL["TenTT"].ToString();
                TenUser       = DocDL["NguoiGui"].ToString();
                Ma_User       = int.Parse(DocDL["Ma_User"].ToString());
                Ma_UserNhan   = int.Parse(DocDL["Ma_UserNhan"].ToString());
                TrichYeu      = DocDL["TrichYeu"].ToString();
                TenFile       = DocDL["TenFile"].ToString();
                NgayPH        = DocDL["NgayPH"].ToString();
                YKienLD       = DocDL["YKienLD"].ToString();
                YKienCV       = DocDL["YKienCV"].ToString();
                ThoiGianSoan  = DocDL["ThoiGianSoan"].ToString();
                ThoiGianGui   = DocDL["ThoiGianGui"].ToString();
                ThoiGianDoc   = DocDL["ThoiGianDoc"].ToString();
                ThoiGianDuyet = DocDL["ThoiGianDuyet"].ToString();
            }
            BaoVe.Close();
        }
Ejemplo n.º 2
0
        public void CT()
        {
            SqlConnection BaoVe = new SqlConnection("server=(local)\\SQLEXPRESS;uid=sa;pwd=123;database=QuanLyCongVan");
            SqlCommand    Lenh  = new SqlCommand("CongVan_CT", BaoVe);

            Lenh.CommandType = CommandType.StoredProcedure;
            SqlParameter ThamSo = new SqlParameter();

            ThamSo = Lenh.Parameters.AddWithValue("@So", So);
            SqlDataReader DocDL;

            BaoVe.Open();
            DocDL = Lenh.ExecuteReader();
            if (DocDL.Read() == true)
            {
                Ma       = DocDL["Ma"].ToString();
                So       = DocDL["So"].ToString();
                Ma_LCV   = int.Parse(DocDL["Ma_LCV"].ToString());
                TenLCV   = DocDL["TenLCV"].ToString();
                TenCV    = DocDL["TenCV"].ToString();
                TrichYeu = DocDL["TrichYeu"].ToString();
                TenFile  = DocDL["TenFile"].ToString();
                NgayPH   = DocDL["NgayPH"].ToString();
                YKienLD  = DocDL["YKienLD"].ToString();
                YKienCV  = DocDL["YKienCV"].ToString();
                //MaNT = int.Parse(DocDL["MaNT"].ToString());
                //MaNVDang = int.Parse(DocDL["MaNVDang"].ToString());
                //MaNVDuyet = int.Parse(DocDL["MaNVDuyet"].ToString());
            }
            BaoVe.Close();
        }
Ejemplo n.º 3
0
        public string menu(int menuid)
        {
            string        result = "<ul>";
            SqlConnection BaoVe  = new SqlConnection("server=(local)\\SQLEXPRESS;uid=sa;pwd=123;database=QuanLyCongVan");
            SqlCommand    Lenh   = new SqlCommand("Menu_Lay", BaoVe);

            Lenh.CommandType = CommandType.StoredProcedure;
            SqlParameter ThamSo = new SqlParameter();

            ThamSo = Lenh.Parameters.AddWithValue("@CNMe", menuid);
            SqlDataReader DocDL;

            BaoVe.Open();
            DocDL = Lenh.ExecuteReader();
            //đọc tất cả category con từ cơ sở dữ liệu có id mẹ là menuid (cần thiết phải có cột id category mẹ)
            //sau đó:
            if (DocDL.Read() == true)//kiểm tra số phần tử con lấy được
            {
                result += "<li><a href='#'>" + DocDL["TenCN"].ToString() + "</a></li>";
                result  = result + "</ul>";
                menu(Convert.ToInt32(DocDL["Ma"]));
                return(result);
            }
            else //nếu ko có phần tử nào
            {
                return(result);
            }
        }
Ejemplo n.º 4
0
        public void LaySo(string So_CV, int Ma_User)
        {
            SqlConnection BaoVe = new SqlConnection("server=(local)\\SQLEXPRESS;uid=sa;pwd=123;database=QuanLyCongVan");
            SqlCommand    Lenh  = new SqlCommand("CUT_LaySo", BaoVe);

            Lenh.CommandType = CommandType.StoredProcedure;
            SqlParameter ThamSo = new SqlParameter();

            ThamSo = Lenh.Parameters.AddWithValue("@So_CV", So_CV);
            ThamSo = Lenh.Parameters.AddWithValue("@Ma_User", Ma_User);
            SqlDataReader DocDL;

            BaoVe.Open();
            DocDL = Lenh.ExecuteReader();
            if (DocDL.Read() == true)//nếu có dữ liệu để đọc
            {
                So = int.Parse(DocDL["So"].ToString());
            }
            BaoVe.Close();
        }
Ejemplo n.º 5
0
        public void CT()
        {
            SqlConnection BaoVe = new SqlConnection("server=(local)\\SQLEXPRESS;uid=sa;pwd=123;database=QuanLyCongVan");
            SqlCommand    Lenh  = new SqlCommand("TinhTrang_CT", BaoVe);

            Lenh.CommandType = CommandType.StoredProcedure;
            SqlParameter ThamSo = new SqlParameter();

            ThamSo = Lenh.Parameters.AddWithValue("@Ma", Ma);
            SqlDataReader DocDL;

            BaoVe.Open();
            DocDL = Lenh.ExecuteReader();
            if (DocDL.Read() == true)//nếu có dữ liệu để đọc
            {
                Ma    = int.Parse(DocDL["Ma"].ToString());
                TenTT = DocDL["TenTT"].ToString();
            }
            BaoVe.Close();
        }
Ejemplo n.º 6
0
        public string LoadMenu(int CNMe, int level)
        {
            string        KetQua = string.Empty;
            SqlConnection BaoVe  = new SqlConnection("server=(local)\\SQLEXPRESS;uid=sa;pwd=123;database=QuanLyCongVan");
            SqlCommand    Lenh   = new SqlCommand("Menu_Lay", BaoVe);

            Lenh.CommandType = CommandType.StoredProcedure;
            SqlParameter ThamSo = new SqlParameter();

            ThamSo = Lenh.Parameters.AddWithValue("@CNMe", CNMe);
            SqlDataReader DocDL;

            BaoVe.Open();
            DocDL = Lenh.ExecuteReader();
            if (!DocDL.HasRows)
            {
                return(KetQua);
            }
            else
            {
                KetQua = "<ul>";
                while (DocDL.Read())
                {
                    KetQua += "<li><a href='<%# Eval('Link')%>'><span>" + DocDL["TenCN"] + "</span></a></li>";
                    KetQua += LoadMenu(Convert.ToInt32(DocDL["Ma"]), level + 1);
                }
                KetQua += "</ul>";
                BaoVe.Close();
            }
            return(KetQua);
            //SqlDataAdapter XeTai = new SqlDataAdapter("CongVan_DS", BaoVe);
            //DataTable ThungChua = new DataTable();
            //BaoVe.Open();
            //XeTai.Fill(ThungChua);
            //BaoVe.Close();
            //return ThungChua;
        }
Ejemplo n.º 7
0
 public bool DangNhap()
 {
     try
     {
         SqlConnection BaoVe = new SqlConnection("server=(local)\\SQLEXPRESS;uid=sa;pwd=123;database=QuanLyCongVan");
         SqlCommand    Lenh  = new SqlCommand("UserN_DangNhap", BaoVe);
         Lenh.CommandType = CommandType.StoredProcedure;
         SqlParameter ThamSo = new SqlParameter();
         ThamSo = Lenh.Parameters.AddWithValue("@TenUser", TenUser);
         ThamSo = Lenh.Parameters.AddWithValue("@MatKhau", MatKhau);
         SqlDataReader DocDL;
         BaoVe.Open();
         DocDL = Lenh.ExecuteReader();
         if (DocDL.Read() == true)
         {
             Ma      = int.Parse(DocDL["Ma"].ToString());
             Ma_NV   = int.Parse(DocDL["Ma_NV"].ToString());
             TenUser = DocDL["TenUser"].ToString();
             MatKhau = DocDL["MatKhau"].ToString();
             MaNhom  = int.Parse(DocDL["MaNhom"].ToString());
             Ho      = DocDL["Ho"].ToString();
             TenNV   = DocDL["TenNV"].ToString();
             BaoVe.Close();
             return(true);
         }
         else
         {
             BaoVe.Close();
             return(false);
         }
     }
     catch (Exception ex)
     {
         ThongBao = ex.Message;
     }
     return(false);
 }