public int Add(DTO_Employee emp)
        {
            List <SqlParameter> paras = new List <SqlParameter>();

            //string sql = " INSERT INTO NhanVien( MaNV, HoNV, TenNV, GioiTinh, SDT, NgaySinh, DiaChiThuongTru, ChucVu)" +
            //    " VALUES (@MaNV, @HoNV, @TenNV, @GioiTinh, @SDT, @NgaySinh, @DiaChiThuongTru, @ChucVu)";

            paras.Add(new SqlParameter("@MaNV", emp.MaNV));
            paras.Add(new SqlParameter("@HoNV", emp.HoNV));
            paras.Add(new SqlParameter("@TenNV", emp.TenNV));
            paras.Add(new SqlParameter("@GioiTinh", emp.GioiTinh));
            paras.Add(new SqlParameter("@SDT", emp.SDT));
            paras.Add(new SqlParameter("@NgaySinh", emp.NgaySinh));
            paras.Add(new SqlParameter("@CMND", emp.CMND));
            paras.Add(new SqlParameter("@DiaChiThuongTru", emp.DiaChiThuongTru));
            paras.Add(new SqlParameter("@ChucVu", emp.ChucVu));

            try
            {
                return(dp.ExcuteNonQuery("sp_ThemNhanVien", System.Data.CommandType.StoredProcedure, paras));
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        //van de nam o dayyyy !!!!!

        //public static List<DTO.Bill_DTO> GetListBill(int id)
        //{
        //    string stringquery = "select * from BILL where id_Room =" + id + "and payment_Status = 0  ";
        //    DataTable dt = DataProvider.ExcuteQuery(stringquery, con);

        //    List<DTO.Bill_DTO> listBill = new List<DTO.Bill_DTO>();
        //    for (int i = 0; i < dt.Rows.Count; i++)
        //    {
        //        DTO.Bill_DTO b = new DTO.Bill_DTO();
        //        b.Id = int.Parse(dt.Rows[i]["id_Bill"].ToString());
        //        b.TimeIn = (DateTime)dt.Rows[i]["time_In"]);
        //    b.TimeOut = (DateTime)dt.Rows[i]["time_Out"];
        //    b.PaymentStatus = int.Parse(dt.Rows[i]["payment_Status"].ToString());
        //    listBill.Add(b);
        //}
        //    return listBill;


        public static void AddBill(int idRoom)
        {
            string stringquery = "EXEC Proc_addBill " + idRoom;

            con = DataProvider.OpenConnection();
            DataProvider.ExcuteNonQuery(stringquery, con);
        }
Exemple #3
0
        /// <summary>
        /// Sửa khách hàng
        /// </summary>
        /// <param name="soTKLK"></param>
        /// <param name="hoTen"></param>
        /// <param name="ngaySinh"></param>
        /// <param name="noiCap"></param>
        /// <param name="soCMNN"></param>
        /// <param name="ngayCap"></param>
        /// <param name="email"></param>
        /// <param name="gioiTinh"></param>
        /// <param name="hanMucVay"></param>
        /// <param name="diaChi"></param>
        /// <param name="SDT"></param>
        /// <param name="maRo"></param>
        /// <returns></returns>
        public static bool suaThongTinKH(string soTKLK, string hoTen, DateTime ngaySinh, string noiCap, string soCMNN, DateTime ngayCap, string email, string gioiTinh, int hanMucVay, string diaChi, string SDT, string maRo)
        {
            try
            {
                OracleCommand oracleCommand = new OracleCommand();
                oracleCommand.CommandText = "UPDATE KHACH_HANG SET HO_TEN = :hoTen, NGAY_SINH = :ngaySinh," +
                                            " SO_CMND = :soCMNN, NGAY_CAP = :ngayCap, NOI_CAP = :noiCap," +
                                            " GIOI_TINH = :gioiTinh, DIA_CHI = :diaChi, SDT = :SDT, EMAIL = :email," +
                                            " HAN_MUC_VAY = :hanMucVay ,MA_RO = :maRo WHERE SO_TKLK = :soTKLK";
                oracleCommand.Parameters.Add(new OracleParameter("hoTen", hoTen));
                oracleCommand.Parameters.Add(new OracleParameter("ngaySinh", ngaySinh));
                oracleCommand.Parameters.Add(new OracleParameter("soCMNN", soCMNN));
                oracleCommand.Parameters.Add(new OracleParameter("ngayCap", ngayCap));
                oracleCommand.Parameters.Add(new OracleParameter("noiCap", noiCap));
                oracleCommand.Parameters.Add(new OracleParameter("gioiTinh", gioiTinh));
                oracleCommand.Parameters.Add(new OracleParameter("diaChi", diaChi));
                oracleCommand.Parameters.Add(new OracleParameter("SDT", SDT));
                oracleCommand.Parameters.Add(new OracleParameter("email", email));
                oracleCommand.Parameters.Add(new OracleParameter("hanMucVay", hanMucVay));
                oracleCommand.Parameters.Add(new OracleParameter("maRo", maRo));
                oracleCommand.Parameters.Add(new OracleParameter("soTKLK", soTKLK));

                return(DataProvider.ExcuteNonQuery(oracleCommand));
            }
            catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// Thêm khách hàng
        /// </summary>
        /// <param name="khachHang"></param>
        /// <returns></returns>
        public static bool ThemKH(QLyKHDTO khachHang)
        {
            try
            {
                OracleCommand oracleCommand = new OracleCommand();
                oracleCommand.CommandText = "INSERT INTO KHACH_HANG (SO_TKLK, HO_TEN, NGAY_SINH, SO_CMND, NGAY_CAP, NOI_CAP, GIOI_TINH, DIA_CHI, NGAY_MO_TK, SDT, EMAIL, HAN_MUC_VAY, MA_RO, SO_TIEN_MAT, SO_DU_NO) " +
                                            "VALUES (:soTKLK, :hotenKH, :ngaysinh, :soCMND, :ngayCap, :noiCap, :gioiTinh, :diaChi, :ngayMoTK, :sdt, :email, :hanMucVay, :maRo, :soTienMat, :soDuNo)";
                oracleCommand.Parameters.Add("soTKLK", khachHang.STKLK);
                oracleCommand.Parameters.Add("hotenKH", khachHang.hoTenKH);
                oracleCommand.Parameters.Add("ngaysinh", khachHang.ngaySinhKH);
                oracleCommand.Parameters.Add("soCMND", khachHang.soCMNNKH);
                oracleCommand.Parameters.Add("ngayCap", khachHang.NgayCap);
                oracleCommand.Parameters.Add("noiCap", khachHang.NoiCap);
                oracleCommand.Parameters.Add("gioiTinh", khachHang.gioiTinhKH);
                oracleCommand.Parameters.Add("diaChi", khachHang.diaChiKH);
                oracleCommand.Parameters.Add("ngayMoTK", khachHang.ngayMoTKKH);
                oracleCommand.Parameters.Add("sdt", khachHang.SDTKH);
                oracleCommand.Parameters.Add("email", khachHang.emailKH);
                oracleCommand.Parameters.Add("hanMucVay", khachHang.HanMucVay);
                oracleCommand.Parameters.Add("maRo", khachHang.MaRo);
                oracleCommand.Parameters.Add("soTienMat", khachHang.SoTienMat);
                oracleCommand.Parameters.Add("soDuNo", khachHang.SoDuNo);

                return(DataProvider.ExcuteNonQuery(oracleCommand));
            }
            catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
        public static void AddBillInfo(int idBill, int idMenu, int count)
        {
            string stringquery = "Proc_addBillInfo " + idBill + ", " + idMenu + ", " + count;

            con = DataProvider.OpenConnection();
            //MessageBox.Show(stringquery.ToString());
            DataProvider.ExcuteNonQuery(stringquery, con);
        }
Exemple #6
0
        public static bool Restore(string path)
        {
            string query = "Use master Restore Database KARAOKE_MANAGER from disk = N'" + path + "'";

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            return(kq);
        }
Exemple #7
0
        public static bool DeleteUser(User_DTO u)
        {
            string query = string.Format(@"delete from USER_ACCOUNT where id_User= " + u.Id);

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            //DataProvider.DongKetNoi(con);
            return(kq);
        }
Exemple #8
0
        public static bool AddUser(User_DTO u)
        {
            string query = string.Format(@"insert into USER_ACCOUNT values(N'{0}',N'{1}',N'{2}',N'{3}')", u.Username, "202cb962ac59075b964b07152d234b70", u.NameUser, u.Permission);

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            //DataProvider.DongKetNoi(con);
            return(kq);
        }
Exemple #9
0
        public static bool ChangePassword(string passWord, int id)
        {
            string query = string.Format(@"update USER_ACCOUNT set password = '******' where id_User =" + id);

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            //DataProvider.DongKetNoi(con);
            return(kq);
        }
Exemple #10
0
        public static bool AddMenu(Menu_DTO m)
        {
            string query = string.Format(@"insert into MENU values(N'{0}', {1}, {2},{3},{4})", m.Name, m.Kind, m.Original_price, m.Sale_price, m.Amout);

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            //DataProvider.DongKetNoi(con);
            return(kq);
        }
Exemple #11
0
        public static bool DeleteMenu(int id)
        {
            string query = string.Format(@"delete from MENU where Id_nenu= " + id);

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            //DataProvider.DongKetNoi(con);
            return(kq);
        }
Exemple #12
0
        public static bool ImportGoods(int count, int id)
        {
            string query = string.Format(@"update MENU set amout = amout + " + count + " where Id_nenu =" + id);

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            //DataProvider.DongKetNoi(con);
            return(kq);
        }
Exemple #13
0
        public static bool EditMenu(Menu_DTO m)
        {
            string query = string.Format(@"update MENU set name=N'{0}',id_Kind={1},unit_Price={2}, sale_Price = {3} ,amout={4}, where Id_nenu={5}", m.Name, m.Kind, m.Original_price, m.Sale_price, m.Amout, m.Id);

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            //DataProvider.DongKetNoi(con);
            return(kq);
        }
Exemple #14
0
        // Xóa nhân viên
        public static bool DeleteRoom(int id)
        {
            string query = string.Format(@"delete from ROOM where id_Room= " + id);

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            //DataProvider.DongKetNoi(con);
            return(kq);
        }
Exemple #15
0
        public static bool EditRoom(RoomDTO r)
        {
            string query = string.Format(@"update ROOM set name=N'{0}',status={1},kind_Of_Room={2},price={3} where id_Room={4}", r.Name, r.Status, r.Kind_Of_Room, r.Price, r.IdRoom);

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            //DataProvider.DongKetNoi(con);
            return(kq);
        }
Exemple #16
0
        public static bool AddRoom(RoomDTO r)
        {
            string query = string.Format(@"insert into ROOM values(N'{0}',N'{1}',N'{2}',N'{3}')", r.Name, r.Status, r.Kind_Of_Room, r.Price);

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            //DataProvider.DongKetNoi(con);
            return(kq);
        }
Exemple #17
0
        /// <summary>
        /// Mua chung khoan
        /// </summary>
        /// <param name="soTKLK"></param>
        /// <param name="maCK"></param>
        /// <param name="sl"></param>
        /// <returns></returns>
        public static bool ThemMuaCK(string soTKLK, string maCK, long sl, long slBD, long duNoBD, long gtMua, long tienMat)
        {
            try
            {
                long soDu = duNoBD;
                if (gtMua > tienMat)
                {
                    soDu    = gtMua - tienMat;
                    tienMat = 0;
                }
                else
                {
                    tienMat -= gtMua;
                }
                long tongSo = sl + slBD;


                OracleCommand oracleCommand = new OracleCommand();
                oracleCommand.CommandText = "UPDATE KHACHHANG_CHUNGKHOAN SET SO_LUONG = :sl WHERE SO_TKLK = :soTKLK AND MA_CK = :maCK";
                oracleCommand.Parameters.Add("sl", tongSo);
                oracleCommand.Parameters.Add("soTKLK", soTKLK);
                oracleCommand.Parameters.Add("maCK", maCK);
                DataProvider.ExcuteNonQuery(oracleCommand);

                if (!ktTonTaiMaCK(soTKLK, maCK))
                {
                    oracleCommand.Parameters.Clear();
                    oracleCommand.CommandText = "INSERT INTO KHACHHANG_CHUNGKHOAN (SO_TKLK, MA_CK, SO_LUONG) VALUES (:sO_TKLK, :mA_CK, :sO_LUONG)";
                    oracleCommand.Parameters.Add("sO_TKLK", soTKLK);
                    oracleCommand.Parameters.Add("mA_CK", maCK);
                    oracleCommand.Parameters.Add("sO_LUONG", sl);

                    DataProvider.ExcuteNonQuery(oracleCommand);
                }

                oracleCommand.Parameters.Clear();
                oracleCommand.CommandText = "UPDATE KHACH_HANG SET SO_DU_NO = :soDuNo, SO_TIEN_MAT = :tM WHERE SO_TKLK = :soTKLK";
                oracleCommand.Parameters.Add("soDuNo", soDu);
                oracleCommand.Parameters.Add("tM", tienMat);
                oracleCommand.Parameters.Add("soTKLK", soTKLK);
                DataProvider.ExcuteNonQuery(oracleCommand);

                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemple #18
0
        public static bool Backup(string path)
        {
            string nameOfFile = @"\KaraokeManager (" + DateTime.Now.Day.ToString() + "_" +
                                DateTime.Now.Month.ToString() + "_" +
                                DateTime.Now.Year.ToString() + "_" +
                                DateTime.Now.Hour.ToString() + "_" +
                                DateTime.Now.Minute.ToString() + ").bak";
            string query = "BACKUP DATABASE KARAOKE_MANAGER TO DISK = N'" + path +
                           nameOfFile + "'";

            con = DataProvider.OpenConnection();
            bool kq = DataProvider.ExcuteNonQuery(query, con);

            return(kq);
        }
Exemple #19
0
        public int AddCustomer(DTO_Customer emp)
        {
            List <SqlParameter> paras = new List <SqlParameter>();

            //string sql = " INSERT INTO KhachHang( MaKH, HoKH, TenKH, GioiTinh, SDT, NgaySinh, DiaChiThuongTru, Email)" +
            //    " VALUES (@MaKH, @HoKH, @TenKH, @GioiTinh, @SDT, @NgaySinh, @DiaChiThuongTru, @Email)";

            paras.Add(new SqlParameter("@MaKH", emp.MaKH));
            paras.Add(new SqlParameter("@HoKH", emp.HoKH));
            paras.Add(new SqlParameter("@TenKH", emp.TenKH));
            paras.Add(new SqlParameter("@GioiTinh", emp.GioiTinh));
            paras.Add(new SqlParameter("@SDT", emp.SDT));
            paras.Add(new SqlParameter("@NgaySinh", emp.NgaySinh));
            paras.Add(new SqlParameter("@DiaChiThuongTru", emp.DiaChiThuongTru));
            paras.Add(new SqlParameter("@Email", emp.Email));
            try
            {
                return(dp.ExcuteNonQuery("sp_ThemKhachHang", System.Data.CommandType.StoredProcedure, paras));
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
Exemple #20
0
        public static bool XoaMaCK(string maRo, string maCK)
        {
            try
            {
                OracleCommand oracleCommand = new OracleCommand();
                oracleCommand.CommandText = "DELETE FROM CHI_TIET_RO WHERE MA_RO = :maRo AND MA_CK = :maCK";
                oracleCommand.Parameters.Add("maRo", maRo);
                oracleCommand.Parameters.Add("maCK", maCK);

                return(DataProvider.ExcuteNonQuery(oracleCommand));
            }catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemple #21
0
        public static bool ThemRoCK(RoCK roCK)
        {
            try
            {
                OracleCommand oracleCommand = new OracleCommand();
                oracleCommand.CommandText = "INSERT INTO RO_CK (MA_RO,TEN_RO) VALUES (:maRo,:tenRo)";
                oracleCommand.Parameters.Add("maRo", roCK.MaRo);
                oracleCommand.Parameters.Add("tenRo", roCK.TenRo);

                return(DataProvider.ExcuteNonQuery(oracleCommand));
            }
            catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemple #22
0
        public int Add(DTOCTHoaDon cthd)
        {
            List <SqlParameter> paras = new List <SqlParameter>();

            paras.Add(new SqlParameter("@m", cthd.MaHD));
            paras.Add(new SqlParameter("@ms", cthd.MaSP));
            paras.Add(new SqlParameter("@sl", cthd.SoLuong));
            paras.Add(new SqlParameter("@dg", cthd.DonGia));
            try
            {
                return(dp.ExcuteNonQuery("ThemCTHD", System.Data.CommandType.StoredProcedure, paras));
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
Exemple #23
0
        public int Add(DTOHoaDon hd)
        {
            List <SqlParameter> paras = new List <SqlParameter>();

            paras.Add(new SqlParameter("@mh", hd.MaHD));
            paras.Add(new SqlParameter("@mk", hd.MaKH));
            paras.Add(new SqlParameter("@nx", hd.NgayXuat));
            paras.Add(new SqlParameter("@tt", hd.ThanhTien));
            paras.Add(new SqlParameter("@mv", hd.MaNV));
            try
            {
                return(dp.ExcuteNonQuery("ThemHD", System.Data.CommandType.StoredProcedure, paras));
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
Exemple #24
0
        public int Add(DTOChiTietThue ctt)
        {
            List <SqlParameter> paras = new List <SqlParameter>();

            paras.Add(new SqlParameter("@map", ctt.MaP));
            paras.Add(new SqlParameter("@makh", ctt.MaKH));
            paras.Add(new SqlParameter("@nt", ctt.NgayThue));
            paras.Add(new SqlParameter("@ndk", ctt.NgayTraDuKien));
            paras.Add(new SqlParameter("@ntr", ctt.NgayTra));
            try
            {
                return(dp.ExcuteNonQuery("ThemCTT", System.Data.CommandType.StoredProcedure, paras));
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
Exemple #25
0
        public static bool rutTien(string soTKLK, long soTienMat, long soTienRut)
        {
            try
            {
                OracleCommand oracleCommand = new OracleCommand();
                long          tien          = soTienMat - soTienRut;
                oracleCommand.CommandText = "UPDATE KHACH_HANG SET SO_TIEN_MAT = :tien WHERE SO_TKLK = :soTKLK";
                oracleCommand.Parameters.Add(new OracleParameter("tien", tien));
                oracleCommand.Parameters.Add(new OracleParameter("soTKLK", soTKLK));

                return(DataProvider.ExcuteNonQuery(oracleCommand));
            }
            catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemple #26
0
        // Sửa thông tin rổ chứng khoán
        public static bool suaThongTinroCK(string maRo, string tenRo)
        {
            try
            {
                OracleCommand oracleCommand = new OracleCommand();
                oracleCommand.CommandText = "UPDATE RO_CK SET TEN_RO = :tenRo WHERE MA_RO = :maRo";
                oracleCommand.Parameters.Add(new OracleParameter("tenRo", tenRo));
                oracleCommand.Parameters.Add(new OracleParameter("maRo", maRo));


                return(DataProvider.ExcuteNonQuery(oracleCommand));
            }
            catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemple #27
0
        /// <summary>
        /// Thêm khách hàng
        /// </summary>
        /// <param name="khachHang"></param>
        /// <returns></returns>
        public static bool ThemKH(QLyKHDTO khachHang)
        {
            try
            {
                OracleCommand oracleCommand = new OracleCommand();
                oracleCommand.CommandText = "INSERT INTO KHACH_HANG (SO_TKLK, HO_TEN, NGAY_SINH, SO_CMND, NGAY_CAP, NOI_CAP, GIOI_TINH, DIA_CHI, NGAY_MO_TK, SDT, EMAIL, HAN_MUC_VAY, MA_RO, SO_TIEN_MAT, SO_DU_NO) " +
                                            "VALUES (:soTKLK, :hotenKH, :ngaysinh, :soCMND, :ngayCap, :noiCap, :gioiTinh, :diaChi, :ngayMoTK, :sdt, :email, :hanMucVay, :maRo, :soTienMat, :soDuNo)";
                oracleCommand.Parameters.Add("soTKLK", khachHang.STKLK);
                oracleCommand.Parameters.Add("hotenKH", khachHang.hoTenKH);
                oracleCommand.Parameters.Add("ngaysinh", khachHang.ngaySinhKH);
                oracleCommand.Parameters.Add("soCMND", khachHang.soCMNNKH);
                oracleCommand.Parameters.Add("ngayCap", khachHang.NgayCap);
                oracleCommand.Parameters.Add("noiCap", khachHang.NoiCap);
                oracleCommand.Parameters.Add("gioiTinh", khachHang.gioiTinhKH);
                oracleCommand.Parameters.Add("diaChi", khachHang.diaChiKH);
                oracleCommand.Parameters.Add("ngayMoTK", khachHang.ngayMoTKKH);
                oracleCommand.Parameters.Add("sdt", khachHang.SDTKH);
                oracleCommand.Parameters.Add("email", khachHang.emailKH);
                oracleCommand.Parameters.Add("hanMucVay", khachHang.HanMucVay);
                oracleCommand.Parameters.Add("maRo", khachHang.MaRo);
                oracleCommand.Parameters.Add("soTienMat", khachHang.SoTienMat);
                oracleCommand.Parameters.Add("soDuNo", khachHang.SoDuNo);

                DataProvider.ExcuteNonQuery(oracleCommand);

                // Lấy danh sách mã CK của rổ
                List <QLRoCKDTO> qLRoCKDTOs = QLRoCKDAO.timKiem(khachHang.MaRo);
                foreach (QLRoCKDTO temp in qLRoCKDTOs)
                {
                    oracleCommand.Parameters.Clear();
                    oracleCommand.CommandText = "INSERT INTO KHACHHANG_CHUNGKHOAN (SO_TKLK, MA_CK, SO_LUONG) VALUES (:sO_TKLK, :mA_CK, '0')";
                    oracleCommand.Parameters.Add("sO_TKLK", khachHang.STKLK);
                    oracleCommand.Parameters.Add("mA_CK", temp.MaCK);
                    DataProvider.ExcuteNonQuery(oracleCommand);
                }

                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemple #28
0
        public static bool rutLuuKi(string soTKLK, string maCK, long soLuongCK, long soLuongRut)
        {
            try
            {
                OracleCommand oracleCommand = new OracleCommand();
                long          CK            = soLuongCK - soLuongRut;
                oracleCommand.CommandText = "UPDATE KHACHHANG_CHUNGKHOAN SET SO_LUONG = :CK WHERE SO_TKLK = :soTKLK AND MA_CK = :maCK";
                oracleCommand.Parameters.Add(new OracleParameter("CK", CK));
                oracleCommand.Parameters.Add(new OracleParameter("soTKLK", soTKLK));
                oracleCommand.Parameters.Add("maCK", maCK);

                return(DataProvider.ExcuteNonQuery(oracleCommand));
            }
            catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemple #29
0
        public static bool ThemCK(QLRoCKDTO roCK)
        {
            try
            {
                OracleCommand oracleCommand = new OracleCommand();
                oracleCommand.CommandText = "INSERT INTO CHI_TIET_RO (MA_RO, MA_CK,GIA_VAY,TI_LE_VAY) VALUES (:maRo,:maCK,:giaVay,:tiLeVay)";
                oracleCommand.Parameters.Add("maRo", roCK.MaRo);
                oracleCommand.Parameters.Add("maCK", roCK.MaCK);
                oracleCommand.Parameters.Add("giaVay", roCK.GiaVay);
                oracleCommand.Parameters.Add("tiLeVay", roCK.TiLeVay);

                return(DataProvider.ExcuteNonQuery(oracleCommand));
            }
            catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemple #30
0
        public int Add(DTOKhachHang kh)
        {
            List <SqlParameter> paras = new List <SqlParameter>();

            paras.Add(new SqlParameter("@ma", kh.MaKH));
            paras.Add(new SqlParameter("@ho", kh.Ho));
            paras.Add(new SqlParameter("@ten", kh.Ten));
            paras.Add(new SqlParameter("@ngaysinh", kh.NgaySinh));
            paras.Add(new SqlParameter("@cmnd", kh.CMND));
            paras.Add(new SqlParameter("@dc", kh.DiaChi));
            paras.Add(new SqlParameter("@sdt", kh.SDT));
            try
            {
                return(dp.ExcuteNonQuery("ThemKH", System.Data.CommandType.StoredProcedure, paras));
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }