예제 #1
0
        /// <summary>
        /// Deleted Update Bảng
        /// </summary>
        public bool Delete(Entities.ChiTietXuatHuy ctxh1)
        {
            try
            {
                bool kt = false;
                ctxh = new Constants.ChiTietXuatHuy();
                Sql = new Constants.Sql();
                string sql = Sql.DeleteChiTietXuatHuy;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);

                cmd.Parameters.Add(ctxh.HanhDong, SqlDbType.VarChar, 20).Value = ctxh1.HanhDong;
                cmd.Parameters.Add(ctxh.MaPhieuXuatHuy, SqlDbType.VarChar, 20).Value = ctxh1.MaPhieuXuatHuy;
                cmd.Parameters.Add(ctxh.MaHangHoa, SqlDbType.VarChar, 50).Value = ctxh1.MaHangHoa;

                int i = cmd.ExecuteNonQuery();
                if (i == 1)
                    kt = true;
                else
                    kt = false;
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return kt;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                return false;
            }
        }
예제 #2
0
        public int InsertUpdate(Entities.TKNganHang tk1)
        {
            TKNH = new Constants.TKNganHang();
            Sql = new Constants.Sql();
            string sql = Sql.InsertUpdateTKNganHang;
            Connection conn = new Connection();
            SqlConnection cn = conn.openConnection();
            SqlCommand cmd = new SqlCommand(sql, cn);
            cmd.Parameters.Add(TKNH.HanhDong, SqlDbType.NVarChar, 20).Value = tk1.HanhDong;
            cmd.Parameters.Add(TKNH.TKNganHangID, SqlDbType.Int).Value = tk1.TKNganHangID;
            cmd.Parameters.Add(TKNH.MaTKNganHang, SqlDbType.NVarChar, 20).Value = tk1.MaTKNganHang;
            cmd.Parameters.Add(TKNH.SoTK, SqlDbType.NVarChar, 20).Value = tk1.SoTK;
            cmd.Parameters.Add(TKNH.MaTienTe, SqlDbType.NVarChar, 200).Value = tk1.MaTienTe;
            cmd.Parameters.Add(TKNH.SoDu, SqlDbType.Int).Value = tk1.SoDu;
            cmd.Parameters.Add(TKNH.SoSecKeTiep, SqlDbType.NVarChar, 20).Value = tk1.SoSecKeTiep;
            cmd.Parameters.Add(TKNH.NguoiLienHe, SqlDbType.NVarChar, 200).Value = tk1.NguoiLienHe;
            cmd.Parameters.Add(TKNH.DiaChi, SqlDbType.NVarChar, 200).Value = tk1.DiaChi;
            cmd.Parameters.Add(TKNH.DienThoai, SqlDbType.NVarChar, 20).Value = tk1.DienThoai;
            cmd.Parameters.Add(TKNH.Email, SqlDbType.NVarChar, 20).Value = tk1.Email;
            cmd.Parameters.Add(TKNH.Website, SqlDbType.NVarChar, 20).Value = tk1.Website;
            cmd.Parameters.Add(TKNH.GhiChu, SqlDbType.NVarChar, 200).Value = tk1.Ghichu;
            cmd.Parameters.Add(TKNH.Laisuat, SqlDbType.Float).Value = tk1.Laisuat;
            cmd.Parameters.Add(TKNH.Deleted, SqlDbType.Bit).Value = tk1.Deleted;

            int i = cmd.ExecuteNonQuery();
            cmd.Connection.Dispose();
            cn.Close();
            conn.closeConnection();
            cn = null;
            conn = null;
            return i;
        }
예제 #3
0
 /// <summary>
 /// Delete Bảng
 /// </summary>
 public bool Delete(Entities.SoDuCongNo pxh)
 {
     try
     {
         bool kt = false;
         pt = new Constants.CongNo();
         Sql = new Constants.Sql();
         string sql = Sql.DeleteSoDuCongNo;
         Connection conn = new Connection();
         SqlConnection cn = conn.openConnection();
         SqlCommand cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(pt.MaSoDuCongNo, SqlDbType.VarChar, 20).Value = pxh.MaSoDuCongNo;
         int i = cmd.ExecuteNonQuery();
         if (i == 1)
             kt = true;
         else
             kt = false;
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
         cn = null;
         conn = null;
         return kt;
     }
     catch
     {
         return false;
     }
 }
예제 #4
0
        public int Delete(Entities.TheGiamGia pb1)
        {
            try
            {
                pb = new Constants.TheGiamGia();
                Sql = new Constants.Sql();
                string sql = Sql.DeleteTheGiamGia;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(pb.MaTheGiamGia, SqlDbType.VarChar, 50).Value = pb1.MaTheGiamGia;

                int i = cmd.ExecuteNonQuery();
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return i;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                return 0;
            }
        }
        public int InsertUpdate(Entities.PhieuDieuChuyenKhoNoiBo PhieuDCK)
        {
            try
            {
                pdcknb = new Constants.PhieuDieuChuyenKhoNoiBo();
                Sql = new Constants.Sql();
                string sql = Sql.InsertUpdatePhieuDieuChuyenKhoNoiBo;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(pdcknb.HanhDong, SqlDbType.NVarChar, 20).Value = PhieuDCK.HanhDong;
                cmd.Parameters.Add(pdcknb.PhieuDieuChuyenKhoID, SqlDbType.Int).Value = PhieuDCK.PhieuDieuChuyenKhoID;
                cmd.Parameters.Add(pdcknb.MaPhieuDieuChuyenKho, SqlDbType.NVarChar, 20).Value = PhieuDCK.MaPhieuDieuChuyenKho;
                cmd.Parameters.Add(pdcknb.NgayDieuChuyen, SqlDbType.DateTime).Value = PhieuDCK.NgayDieuChuyen;
                cmd.Parameters.Add(pdcknb.TuKho, SqlDbType.VarChar, 20).Value = PhieuDCK.TuKho;
                cmd.Parameters.Add(pdcknb.DenKho, SqlDbType.VarChar, 20).Value = PhieuDCK.DenKho;
                cmd.Parameters.Add(pdcknb.MaHoaDonNhap, SqlDbType.VarChar, 20).Value = PhieuDCK.MaHoaDonNhap;
                cmd.Parameters.Add(pdcknb.XacNhan, SqlDbType.Bit).Value = PhieuDCK.XacNhan;
                cmd.Parameters.Add(pdcknb.GhiChu, SqlDbType.NVarChar, 100).Value = PhieuDCK.GhiChu;
                cmd.Parameters.Add(pdcknb.Deleted, SqlDbType.Bit).Value = PhieuDCK.Deleted;

                int i = cmd.ExecuteNonQuery();
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return i;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                return 0;
            }
        }
예제 #6
0
        //insert update
        public int InsertUpdate(Entities.CapNhatGia cng1)
        {
            cng = new Constants.CapNhatGia();
            Sql = new Constants.Sql();
            string sql = Sql.InsertUpdateCapNhatGia;
            Connection conn = new Connection();
            SqlConnection cn = conn.openConnection();
            SqlCommand cmd = new SqlCommand(sql, cn);
            cmd.Parameters.Add(cng.HanhDong, SqlDbType.NVarChar, 20).Value = cng1.HanhDong;
            cmd.Parameters.Add(cng.CapNhatGiaID, SqlDbType.Int).Value = cng1.CapNhatGiaID;
            cmd.Parameters.Add(cng.MaCapNhatGia, SqlDbType.NVarChar, 20).Value = cng1.MaCapNhatGia;
            cmd.Parameters.Add(cng.NgayBatDau, SqlDbType.DateTime).Value = cng1.NgayBatDau;
            cmd.Parameters.Add(cng.NgayKetThuc, SqlDbType.DateTime).Value = cng1.NgayKetThuc;
            cmd.Parameters.Add(cng.MaHangHoa, SqlDbType.NVarChar,20).Value = cng1.MaHangHoa;
            cmd.Parameters.Add(cng.PhanTramGiaBanBuon, SqlDbType.Float).Value = cng1.PhanTramGiaBanBuon;
            cmd.Parameters.Add(cng.PhanTramGiaBanLe, SqlDbType.Float).Value = cng1.PhanTramGiaBanLe;
            cmd.Parameters.Add(cng.GiaNhap, SqlDbType.Float).Value = cng1.GiaNhap;
            cmd.Parameters.Add(cng.Trangthai, SqlDbType.Bit).Value = cng1.Trangthai;
            cmd.Parameters.Add(cng.GhiChu, SqlDbType.NVarChar, 100).Value = cng1.GhiChu;
            cmd.Parameters.Add(cng.Deleted, SqlDbType.Bit).Value = cng1.Deleted;

            int i = cmd.ExecuteNonQuery();
            cmd.Connection.Dispose();
            cn.Close();
            conn.closeConnection();
            cn = null;
            conn = null;
            return i;
        }
예제 #7
0
        public int InsertUpdate(Entities.PhongBan pb1)
        {
            try
            {
                pb = new Constants.PhongBan();
                Sql = new Constants.Sql();
                string sql = Sql.InsertUpdatePhongBan;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(pb.HanhDong, SqlDbType.NVarChar, 20).Value = pb1.HanhDong;
                cmd.Parameters.Add(pb.PhongBanID, SqlDbType.Int).Value = pb1.PhongBanID;
                cmd.Parameters.Add(pb.MaPhongBan, SqlDbType.NVarChar, 20).Value = pb1.MaPhongBan;
                cmd.Parameters.Add(pb.TenPhongBan, SqlDbType.NVarChar, 200).Value = pb1.TenPhongBan;
                cmd.Parameters.Add(pb.GhiChu, SqlDbType.NVarChar, 100).Value = pb1.GhiChu;
                cmd.Parameters.Add(pb.Deleted, SqlDbType.Bit).Value = pb1.Deleted;

                int i = cmd.ExecuteNonQuery();
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return i;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                return 0;
            }
        }
예제 #8
0
 /// <summary>
 /// Insert Update Bảng
 /// </summary>
 public bool Insert(Entities.SoDuSoQuy pxh)
 {
     try
     {
         bool kt = false;
         pt = new Constants.SoQuy();
         Sql = new Constants.Sql();
         string sql = Sql.InsertSoDuSoQuy;
         Connection conn = new Connection();
         SqlConnection cn = conn.openConnection();
         SqlCommand cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(pt.MaSoDuSoQuy, SqlDbType.VarChar, 20).Value = pxh.MaSoDuSoQuy;
         cmd.Parameters.Add(pt.SoDuDauKy, SqlDbType.Float).Value = pxh.SoDuDauKy;
         cmd.Parameters.Add(pt.NgayKetChuyen, SqlDbType.DateTime).Value = pxh.NgayKetChuyen;
         cmd.Parameters.Add(pt.SoDuCuoiKy, SqlDbType.Float).Value = pxh.SoDuCuoiKy;
         cmd.Parameters.Add(pt.TrangThai, SqlDbType.Bit).Value = pxh.TrangThai;
         int i = cmd.ExecuteNonQuery();
         if (i == 1)
             kt = true;
         else
             kt = false;
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
         cn = null;
         conn = null;
         return kt;
     }
     catch
     {
         return false;
     }
 }
예제 #9
0
        //delete
        public bool Delete(Entities.NhomHang NhomHang)
        {
            bool kt = false;
            try
            {
                nhh = new Constants.NhomHangHoa();
                Entities.NhomHang nhomhanghoa = new Entities.NhomHang();
                Sql = new Constants.Sql();
                string sql = Sql.DeleteNhomHangHoa;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(nhh.HanhDong, SqlDbType.NVarChar, 20).Value = NhomHang.HanhDong;
                cmd.Parameters.Add(nhh.NhomHangID, SqlDbType.Int).Value = NhomHang.NhomHangID;

                int i = cmd.ExecuteNonQuery();
                if (i == 1)
                    kt = true;
                else
                    kt = false;
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return kt;
            }
            catch
            {
                return kt;
            }
        }
예제 #10
0
        public int Insert(Entities.TheGiamGia pb1)
        {
            try
            {
                pb = new Constants.TheGiamGia();
                Sql = new Constants.Sql();
                string sql = Sql.InsertTheGiamGia;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(pb.HanhDong, SqlDbType.NVarChar, 50).Value = pb1.HanhDong;
                cmd.Parameters.Add(pb.MaTheGiamGia, SqlDbType.VarChar, 50).Value = pb1.MaTheGiamGia;
                cmd.Parameters.Add(pb.MaKhachHang, SqlDbType.VarChar, 50).Value = pb1.MaKhachHang;
                cmd.Parameters.Add(pb.GiaTriThe, SqlDbType.Float).Value = pb1.GiaTriThe;
                cmd.Parameters.Add(pb.NgayBatDau, SqlDbType.DateTime).Value = pb1.NgayBatDau;
                cmd.Parameters.Add(pb.NgayKetThuc, SqlDbType.DateTime).Value = pb1.NgayKetThuc;
                cmd.Parameters.Add(pb.Deleted, SqlDbType.Bit).Value = pb1.Deleted;

                int i = cmd.ExecuteNonQuery();
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return i;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                return 0;
            }
        }
        public int InsertUpdate(Entities.ChiTietPhieuDieuChuyenKho CTPhieuDCK)
        {
            try
            {
                ctpdck = new Constants.ChiTietPhieuDieuChuyenKho();
                Sql = new Constants.Sql();
                string sql = Sql.InsertUpdateChiTietPhieuDieuChuyenKho;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(ctpdck.HanhDong, SqlDbType.NVarChar, 20).Value = CTPhieuDCK.HanhDong;
                cmd.Parameters.Add(ctpdck.MaPhieuDieuChuyenKho, SqlDbType.NVarChar, 20).Value = CTPhieuDCK.MaPhieuDieuChuyenKho;
                cmd.Parameters.Add(ctpdck.MaHangHoa, SqlDbType.NVarChar, 50).Value = CTPhieuDCK.MaHangHoa;
                cmd.Parameters.Add(ctpdck.SoLuong, SqlDbType.Int).Value = CTPhieuDCK.SoLuong;
                cmd.Parameters.Add(ctpdck.GhiChu, SqlDbType.NVarChar, 100).Value = CTPhieuDCK.GhiChu;
                cmd.Parameters.Add(ctpdck.Deleted, SqlDbType.Bit).Value = CTPhieuDCK.Deleted;

                int i = cmd.ExecuteNonQuery();
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return i;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                return 0;
            }
        }
예제 #12
0
        public bool deleteNhomQuyen(Entities.NhomQuyen nq1)
        {
            try
            {
                bool kt = false;
                nq = new Constants.NhomQuyen();
                Sql = new Constants.Sql();
                string sql = Sql.deleteNhomQuyen;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);

                cmd.Parameters.Add(nq.TenNhomQuyen, SqlDbType.VarChar, 50).Value = nq1.TenNhomQuyen;

                int i = cmd.ExecuteNonQuery();
                if (i >= 0)
                    kt = true;
                else
                    kt = false;
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return kt;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                return false;
            }
        }
예제 #13
0
 //delete
 public int Delete(Entities.KhoHang kh1)
 {
     int tra = 0;
     try
     {
         kh = new Constants.KhoHang();
         Entities.KhoHang khohang = new Entities.KhoHang();
         Sql = new Constants.Sql();
         string sql = Sql.DeleteKhoHang;
         Connection conn = new Connection();
         SqlConnection cn = conn.openConnection();
         SqlCommand cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(kh.HanhDong, SqlDbType.NVarChar, 20).Value = kh1.HanhDong;
         cmd.Parameters.Add(kh.KhoHangID, SqlDbType.Int).Value = kh1.KhoHangID;
         tra = cmd.ExecuteNonQuery();
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
         cn = null;
         conn = null;
     }
     catch (Exception ex)
     { string s = ex.Message; tra = 0; }
     return tra;
 }
예제 #14
0
 /// <summary>
 /// Delete Bảng
 /// </summary>
 public int Delete(Entities.NhomKH nkh2)
 {
     int Trave = 0;
     try
     {
         nkh = new Constants.NhomKH();
         Sql = new Constants.Sql();
         string sql = Sql.DeleteNhomKH;
         conn = new Connection();
         cn = conn.openConnection();
         cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(nkh.HanhDong, SqlDbType.NVarChar, 20).Value = nkh2.Hanhdong.ToString();
         cmd.Parameters.Add(nkh.NhomKHID, SqlDbType.Int).Value = nkh2.NhomKHID;
         Trave = cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return Trave;
 }
예제 #15
0
        /// <summary>
        /// Delete Bảng
        /// </summary>
        public bool Delete(Entities.PhieuTTCuaKH pttckh)
        {
            try
            {
                bool kt = false;
                pt = new Constants.PhieuTTCuaKH();
                Sql = new Constants.Sql();
                string sql = Sql.DeletePhieuTTCuaKH;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(pt.HanhDong, SqlDbType.NVarChar, 20).Value = pttckh.HanhDong;
                cmd.Parameters.Add(pt.PhieuTTCuaKHID, SqlDbType.Int).Value = pttckh.PhieuTTCuaKHID;

                int i = cmd.ExecuteNonQuery();
                if (i == 1)
                    kt = true;
                else
                    kt = false;
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return kt;
            }
            catch
            {
                return false;
            }
        }
예제 #16
0
        public bool deleteTaiKhoan(Entities.TaiKhoan tk1)
        {
            try
            {
                bool kt = false;
                tk = new Constants.TaiKhoan();
                Sql = new Constants.Sql();
                string sql = Sql.deleteTaiKhoan;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);

                cmd.Parameters.Add(tk.TenDangNhap, SqlDbType.VarChar, 200).Value = tk1.TenDangNhap;

                int i = cmd.ExecuteNonQuery();
                if (i >= 0)
                    kt = true;
                else
                    kt = false;
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return kt;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                return false;
            }
        }
예제 #17
0
        public int InsertUpdate(Entities.TienTe tt1)
        {
            try
            {
                tt = new Constants.TienTe();
                Sql = new Constants.Sql();
                string sql = Sql.InsertUpdateTienTe;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(tt.HanhDong, SqlDbType.NVarChar, 20).Value = tt1.HanhDong;
                cmd.Parameters.Add(tt.TienteID, SqlDbType.Int).Value = tt1.TienteID;
                cmd.Parameters.Add(tt.MaTienTe, SqlDbType.NVarChar, 20).Value = tt1.MaTienTe;
                cmd.Parameters.Add(tt.TenTienTe, SqlDbType.NVarChar, 200).Value = tt1.TenTienTe;
                cmd.Parameters.Add(tt.TenTienTeChan, SqlDbType.NVarChar, 200).Value = tt1.TenTienTeChan;
                cmd.Parameters.Add(tt.TenTienTeLe, SqlDbType.NVarChar, 200).Value = tt1.TenTienTeLe;
                cmd.Parameters.Add(tt.BieuTuong, SqlDbType.NVarChar, 20).Value = tt1.BieuTuong;
                cmd.Parameters.Add(tt.DonViLamTron, SqlDbType.Int).Value = tt1.DonViLamTron;
                cmd.Parameters.Add(tt.GhiChu, SqlDbType.NVarChar, 100).Value = tt1.GhiChu;
                cmd.Parameters.Add(tt.Deleted, SqlDbType.Bit).Value = tt1.Deleted;

                int i = cmd.ExecuteNonQuery();
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return i;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                return 0;
            }
        }
예제 #18
0
        public void Delete(Entities.TKNganHang tk1)
        {
            try
            {
                TKNH = new Constants.TKNganHang();
                Entities.TKNganHang TKNganHang = new Entities.TKNganHang();
                Sql = new Constants.Sql();
                string sql = Sql.DeleteTKNganHang;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(TKNH.HanhDong, SqlDbType.NVarChar, 20).Value = tk1.HanhDong;
                cmd.Parameters.Add(TKNH.TKNganHangID, SqlDbType.Int).Value = tk1.TKNganHangID;

                cmd.ExecuteNonQuery();
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
        }
예제 #19
0
        public int InsertUpdate(Entities.KMThuChi km1)
        {
            try
            {
                Kmtc = new Constants.KMThuChi();
                Sql = new Constants.Sql();
                string sql = Sql.InsertUpdateKMThuChi;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(Kmtc.HanhDong, SqlDbType.NVarChar, 20).Value = km1.HanhDong;
                cmd.Parameters.Add(Kmtc.ThuChiID, SqlDbType.Int).Value = km1.ThuChiID;
                cmd.Parameters.Add(Kmtc.MaKhoanMuc, SqlDbType.NVarChar, 20).Value = km1.MaKhoanMuc;
                cmd.Parameters.Add(Kmtc.TenKhoanMuc, SqlDbType.NVarChar, 200).Value = km1.TenKhoanMuc;
                cmd.Parameters.Add(Kmtc.LoaiKM, SqlDbType.Bit).Value = km1.LoaiKM;
                cmd.Parameters.Add(Kmtc.DoiTuong, SqlDbType.NVarChar, 200).Value = km1.DoiTuong;
                cmd.Parameters.Add(Kmtc.NoTK, SqlDbType.VarChar, 20).Value = km1.NoTK;
                cmd.Parameters.Add(Kmtc.CoTK, SqlDbType.VarChar, 20).Value = km1.CoTK;
                cmd.Parameters.Add(Kmtc.GhiChu, SqlDbType.NVarChar, 200).Value = km1.GhiChu;
                cmd.Parameters.Add(Kmtc.Deleted, SqlDbType.Bit).Value = km1.Deleted;

                int i = cmd.ExecuteNonQuery();
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return i;
            }
            catch (Exception ex) { string s = ex.Message; return 0; }
        }
예제 #20
0
 public bool Delete(string maHDBanHang)
 {
     try
     {
         bool kt = false;
         hdbh = new Constants.HDBanHang();
         Sql = new Constants.Sql();
         string sql = Sql.DeleteHDBanHang;
         Connection conn = new Connection();
         SqlConnection cn = conn.openConnection();
         SqlCommand cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add("@maHDBanHang", SqlDbType.VarChar, 20).Value = maHDBanHang;
         int i = cmd.ExecuteNonQuery();
         if (i == 1)
             kt = true;
         else
             kt = false;
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
         cn = null;
         conn = null;
         return kt;
     }
     catch (Exception ex)
     {
         string s = ex.Message;
         return false;
     }
 }
예제 #21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="giatri"></param>
 /// <returns></returns>
 public int CapNhatDuNoKhachHang(Entities.TruyenGiaTri giatri)
 {
     int tra = 0;
     try
     {
         Sql = new Constants.Sql();
         string sql = "exec sp_CapNhatDuNoKhachHang @MaKhachHang,@DuNo";
         conn = new Connection();
         cn = conn.openConnection();
         cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add("MaKhachHang", SqlDbType.VarChar, 20).Value = giatri.Giatritruyen;
         cmd.Parameters.Add("DuNo", SqlDbType.Float).Value = giatri.Giatrithuhai;
         tra = cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         tra = 0;
     }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return tra;
 }
예제 #22
0
        //insert update
        public int InsertUpdate(Entities.DVT dvt1)
        {
            try
               {
            dvt = new Constants.DVT();
            Sql = new Constants.Sql();
            string sql = Sql.InsertUpdateDVT;
            Connection conn = new Connection();
            SqlConnection cn = conn.openConnection();
            SqlCommand cmd = new SqlCommand(sql, cn);
            cmd.Parameters.Add(dvt.HanhDong, SqlDbType.NVarChar, 20).Value = dvt1.HanhDong;
            cmd.Parameters.Add(dvt.DVTID, SqlDbType.Int).Value = dvt1.DVTID;
            cmd.Parameters.Add(dvt.MaDonViTinh, SqlDbType.NVarChar, 20).Value = dvt1.MaDonViTinh;
            cmd.Parameters.Add(dvt.TenDonViTinh, SqlDbType.NVarChar, 20).Value = dvt1.TenDonViTinh;
            cmd.Parameters.Add(dvt.GhiChu, SqlDbType.NVarChar, 100).Value = dvt1.GhiChu;
            cmd.Parameters.Add(dvt.Deleted, SqlDbType.Bit).Value = dvt1.Deleted;

            int i = cmd.ExecuteNonQuery();
            cmd.Connection.Dispose();
            cn.Close();
            conn.closeConnection();
            cn = null;
            conn = null;
            return i;
               }
               catch (Exception ex)
               {
               return 0;
               }
        }
예제 #23
0
        //insert update
        public int InsertUpdate(Entities.LoaiHangHoa lhh1)
        {
            try
            {
                lhh = new Constants.LoaiHangHoa();
                Sql = new Constants.Sql();
                string sql = Sql.InsertUpdateLoaiHangHoa;
                Connection conn = new Connection();
                SqlConnection cn = conn.openConnection();
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add(lhh.HanhDong, SqlDbType.NVarChar, 20).Value = lhh1.HanhDong;
                cmd.Parameters.Add(lhh.LoaiHangID, SqlDbType.Int).Value = lhh1.LoaiHangID;
                cmd.Parameters.Add(lhh.MaLoaiHang, SqlDbType.NVarChar, 20).Value = lhh1.MaLoaiHang;
                cmd.Parameters.Add(lhh.TenLoaiHang, SqlDbType.NVarChar, 200).Value = lhh1.TenLoaiHang;
                cmd.Parameters.Add(lhh.GhiChu, SqlDbType.NVarChar, 250).Value = lhh1.GhiChu;
                cmd.Parameters.Add(lhh.Deleted, SqlDbType.Bit).Value = lhh1.Deleted;

                int i = cmd.ExecuteNonQuery();
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
                cn = null;
                conn = null;
                return i;
            }
            catch(Exception ex)
            {
                return 0;
            }
        }
예제 #24
0
 //insert update
 public Entities.KhoHang InsertUpdate(Entities.KhoHang kh1)
 {
     Entities.KhoHang k = new Entities.KhoHang();
     try
     {
         kh = new Constants.KhoHang();
         Sql = new Constants.Sql();
         string sql = Sql.InsertUpdateKhoHang;
         Connection conn = new Connection();
         SqlConnection cn = conn.openConnection();
         SqlCommand cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(kh.HanhDong, SqlDbType.NVarChar, 20).Value = kh1.HanhDong;
         cmd.Parameters.Add(kh.KhoHangID, SqlDbType.Int).Value = kh1.KhoHangID;
         cmd.Parameters.Add(kh.MaKho, SqlDbType.VarChar, 20).Value = kh1.MaKho;
         cmd.Parameters.Add(kh.TenKho, SqlDbType.NVarChar, 200).Value = kh1.TenKho;
         cmd.Parameters.Add(kh.DiaChi, SqlDbType.NVarChar, 200).Value = kh1.DiaChi;
         cmd.Parameters.Add(kh.DienThoai, SqlDbType.NVarChar, 200).Value = kh1.DienThoai;
         cmd.Parameters.Add(kh.MaNhanVien, SqlDbType.NVarChar, 200).Value = kh1.MaNhanVien;
         cmd.Parameters.Add(kh.GhiChu, SqlDbType.NVarChar, 100).Value = kh1.GhiChu;
         cmd.Parameters.Add(kh.Deleted, SqlDbType.Bit).Value = kh1.Deleted;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             k.GhiChu = dr[0].ToString();
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); k.GhiChu = null; }
     return k;
 }
예제 #25
0
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public object Select(Entities.LayID lid1)
        {
            Sql = new Constants.Sql();
            string sql = Sql.LayID;
            Connection conn = new Connection();
            SqlConnection cn = conn.openConnection();
            SqlCommand cmd = new SqlCommand(sql, cn);
            cmd.Parameters.Add("@table", SqlDbType.NVarChar, 50).Value = lid1.TenBang;
            SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            //Fix 14/01/2013
            string phandau = string.Empty;
            string max = "0";
            while (dr.Read())
            {
                string[] temp = dr["ID"].ToString().Split('_');
                if (string.IsNullOrEmpty(phandau)) phandau = temp[0];
                if (max.Equals("0")) max = temp[1];
                try
                {
                    int ss = int.Parse(temp[1]);
                    int _max = int.Parse(max);
                    max = _max < ss ? temp[1] : max;
                }
                catch { }
            }
            Entities.LayID arrC = new Entities.LayID();
            arrC.ID = phandau + "_" + max;

            if (string.IsNullOrEmpty(phandau)) return null;
            //End Fix 14/01/2013

            ////Insert Category into ArrayList
            //ArrayList arr = new ArrayList();
            //while (dr.Read())
            //{
            //    Entities.LayID lid = new Entities.LayID();
            //    lid.ID = dr["ID"].ToString();
            //    arr.Add(lid);
            //}
            //int n = arr.Count;
            //if (n == 0) return null;

            //Entities.LayID arrC = new Entities.LayID();
            //for (int i = 0; i < n; i++)
            //{
            //    arrC = (Entities.LayID)arr[i];
            //}

            ////Giai phong bo nho
            //arr = null;
            cmd.Connection.Dispose();
            cn.Close();
            conn.closeConnection();
            cn = null;
            conn = null;
            return arrC;
        }
예제 #26
0
 public KiemTraChung()
 {
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     cn = null;
 }
예제 #27
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public Lay_ID_Top_1()
 {
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     cn = null;
 }
예제 #28
0
 public KMThuChi()
 {
     Kmtc = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     cn = null;
 }
예제 #29
0
 public TienTe()
 {
     tt = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     cn = null;
 }
예제 #30
0
 public TKNganHang()
 {
     TKNH = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     cn = null;
 }