Exemplo n.º 1
0
 public bool xoaChiTietHoaDon(string maHD, String maKH)
 {
     try
     {
         openDB();
         SqlCommand   cmd   = HandleCMD.proc("sp_XoaChiTietHoaDon", _con);
         SqlParameter _maHD = new SqlParameter("@MaHD", maHD);
         SqlParameter _maKH = new SqlParameter("@MaKH", maKH);
         cmd.Parameters.Add(_maHD);
         cmd.Parameters.Add(_maKH);
         if (this.cmdExecuted(cmd))
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("ERROR: " + ex.Message);
         return(false);
     }
     finally
     {
         closeDB();
     }
     return(false);
 }
Exemplo n.º 2
0
 public bool SuaNhanVien(ET_NhanVien et_NhanVien)
 {
     try
     {
         openDB();
         SqlCommand cmd = null;
         //parameter
         if (et_NhanVien.MaQL == null) //Không có MaQL
         {
             //cmd
             cmd = HandleCMD.proc("sp_SuaQuanLy", _con);
             addParameter(cmd, et_NhanVien, properties); // add parameter.
         }
         else //Có MaQL.
         {
             cmd = HandleCMD.proc("sp_SuaNhanVien", _con);
             addParameter(cmd, et_NhanVien, properties_QL); // add parameter.
         }
         if (cmdExecuted(cmd))
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
     finally
     {
         closeDB();
     }
     return(false);
 }
Exemplo n.º 3
0
        public bool suaKhachHang(ET_KhachHang et_KH)
        {
            try
            {
                _con.Open();
                SqlCommand cmd = HandleCMD.proc("sp_SuaKhachHang", _con);
                addParameter(cmd, et_KH, strNameParametor);

                if (cmdExecuted(cmd))
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
            finally
            {
                _con.Close();
            }

            return(false);
        }
Exemplo n.º 4
0
        //-----------------------------------------------------------------------------
        //Them,Xoa, Sua
        public bool ThemNhanVien(ET_NhanVien et_NhanVien)
        {
            try
            {
                openDB();
                //cmd
                SqlCommand cmd = null;
                if (et_NhanVien.MaQL == null) //Không có MaQL
                {
                    //cmd
                    cmd = HandleCMD.proc("sp_ThemQuanLy", _con);
                    addParameter(cmd, et_NhanVien, properties); // add parameter.
                }
                else //Có MaQL.
                {
                    cmd = HandleCMD.proc("sp_ThemNhanVien", _con);
                    addParameter(cmd, et_NhanVien, properties_QL); // add parameter.
                }
                if (cmdExecuted(cmd))
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error " + ex.Message);
                return(false);
            }
            finally
            {
                closeDB();
            }

            return(false);
        }
Exemplo n.º 5
0
        public bool xoaKhachHang(string MaKH)
        {
            try
            {
                _con.Open();
                SqlCommand cmd = HandleCMD.proc("sp_XoaKhachHang", _con);

                SqlParameter ptMaKH = new SqlParameter("@MAKH", MaKH);

                cmd.Parameters.Add(ptMaKH);

                if (cmdExecuted(cmd))
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
            finally
            {
                _con.Close();
            }
            return(false);
        }
Exemplo n.º 6
0
        public DataTable GetData(string maNV, string password, bool type)
        {
            try
            {
                openDB();
                SqlCommand cmd = HandleCMD.proc("sp_LayDangNhapNV", _con);

                SqlParameter ptMaNV = new SqlParameter("@MaNV", maNV);
                SqlParameter ptPass = new SqlParameter("@PASSWORD", password);
                SqlParameter ptType = new SqlParameter("@TYPE", type);

                cmd.Parameters.Add(ptMaNV);
                cmd.Parameters.Add(ptPass);
                cmd.Parameters.Add(ptType);

                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);

                return(dt);
            }
            catch (Exception)
            {
                return(null);
            }
            finally
            {
                closeDB();
            }
        }
Exemplo n.º 7
0
        //----------------------------------------------------------------
        //THEM, XOA, SUA
        public bool themHD(ET_HoaDon eT_HoaDon)
        {
            try
            {
                openDB();
                SqlCommand cmd = HandleCMD.proc("sp_ThemHoaDon", _con);
                cmd.Parameters.AddWithValue("@MaNV", eT_HoaDon.MaNV);
                cmd.Parameters.AddWithValue("@MaKH", eT_HoaDon.MaKH);
                cmd.Parameters.AddWithValue("@MaHD", eT_HoaDon.MaHD);
                cmd.Parameters.AddWithValue("@TongTien", eT_HoaDon.TongTien);
                cmd.Parameters.AddWithValue("@NgayXuatHoaDon", eT_HoaDon.NgayXuatHoaDon);
                cmd.Parameters.AddWithValue("@LoaiHoaDon", eT_HoaDon.LoaiHoaDon);


                if (this.cmdExecuted(cmd))
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: " + ex.Message);
                return(false);
            }
            finally
            {
                closeDB();
            }
            return(false);
        }
Exemplo n.º 8
0
        //----------------------------------------------------------------
        //THEM, XOA, SUA
        public bool themChiTietHoaDon(ET_ChiTietHoaDon eT_ChiTietHoaDon)
        {
            try
            {
                openDB();
                SqlCommand cmd = HandleCMD.proc("sp_ThemChiTietHoaDon", _con);

                addParameter(cmd, eT_ChiTietHoaDon, strNameParametor);

                if (this.cmdExecuted(cmd))
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: " + ex.Message);
                return(false);
            }
            finally
            {
                closeDB();
            }
            return(false);
        }
Exemplo n.º 9
0
        //-----------------------------------------------------------------------------
        //Lay nhan vien
        public DataTable getNhanVien()
        {
            DataTable dt = new DataTable();

            try
            {
                SqlCommand     cmd = HandleCMD.proc("sp_TruyXuatNhanVien", _con);
                SqlDataAdapter da  = new SqlDataAdapter(cmd);
                da.Fill(dt);
                return(dt);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Exemplo n.º 10
0
 public bool suaSach(ET_Sach sach)
 {
     try
     {
         SqlCommand cmd = HandleCMD.proc("sp_SuaSach", _con);
         addParameter(cmd, sach, strNameParameter);
         if (cmdExecuted(cmd))
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(false);
 }
Exemplo n.º 11
0
        //---------------------------------------------------------------
        //LAY DU LIEU
        public DataTable getNCC()
        {
            DataTable dt = new DataTable();

            try
            {
                openDB();
                SqlCommand     cmd = HandleCMD.proc("sp_TruyXuatNhaCungCap", _con);
                SqlDataAdapter da  = new SqlDataAdapter(cmd);
                da.Fill(dt);
                return(dt);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                closeDB();
            }
        }
Exemplo n.º 12
0
        public DataTable getHoaDon()
        {
            DataTable dt = new DataTable();

            try
            {
                openDB();
                SqlCommand     cmd = HandleCMD.proc("sp_LayThongTinBangHoaDon", _con);
                SqlDataAdapter da  = new SqlDataAdapter(cmd);
                da.Fill(dt);
                return(dt);
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: " + ex.Message);
                return(null);
            }
            finally
            {
                closeDB();
            }
        }
Exemplo n.º 13
0
 public bool themSach(ET_Sach sach)
 {
     try
     {
         this.openDB();
         SqlCommand cmd = HandleCMD.proc("sp_ThemSach", _con);
         addParameter(cmd, sach, strNameParameter);
         if (cmd.ExecuteNonQuery() > 0)
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
     finally
     {
         this.closeDB();
     }
     return(false);
 }
Exemplo n.º 14
0
        public bool suaGH(ET_GianHang et_GH)
        {
            try
            {
                openDB();
                SqlCommand cmd = HandleCMD.proc("sp_SuaGH", _con);
                addParameter(cmd, et_GH, strNameParametor);

                if (this.cmdExecuted(cmd))
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                closeDB();
            }
            return(false);
        }
Exemplo n.º 15
0
        public bool suaNCC(ET_NhaCungCap et_NCC)
        {
            try
            {
                openDB();
                SqlCommand cmd = HandleCMD.proc("sp_CapNhatNhaCungCap", _con);
                addParameter(cmd, et_NCC, strNameParametor);

                if (this.cmdExecuted(cmd))
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                closeDB();
            }
            return(false);
        }
Exemplo n.º 16
0
 public bool xoaNCC(string maNCC)
 {
     try
     {
         openDB();
         SqlCommand   cmd = HandleCMD.proc("sp_XoaNhaCungCap", _con);
         SqlParameter pt  = new SqlParameter("@MaNCC", maNCC);
         cmd.Parameters.Add(pt);
         if (this.cmdExecuted(cmd))
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
     finally
     {
         closeDB();
     }
     return(false);
 }
Exemplo n.º 17
0
        public bool XoaNhanVien(string strNhanVien)
        {
            try
            {
                openDB();
                SqlCommand   cmd = HandleCMD.proc("sp_XoaNhanVien", _con);
                SqlParameter pt  = new SqlParameter("@MaNV", strNhanVien);
                cmd.Parameters.Add(pt);

                if (this.cmdExecuted(cmd))
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                closeDB();
            }
            return(false);
        }
Exemplo n.º 18
0
        public bool suaTheLoai(ET_TheLoai eT_TheLoai)
        {
            try
            {
                openDB();
                SqlCommand cmd = HandleCMD.proc("sp_CapNhatTheLoai", _con);
                addParameter(cmd, eT_TheLoai, strNameParametor);

                if (this.cmdExecuted(cmd))
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: " + ex.Message);
                return(false);
            }
            finally
            {
                closeDB();
            }
            return(false);
        }