Ejemplo n.º 1
0
        public int UpdateDepartment(DepartmentDTO departmentDTO)
        {
            string sql = string.Format("Update BOPHAN set TenBP = N'{0}', GhiChu = N'{1}', Active = '{2}' where MaBP = '{3}'", departmentDTO.iTenBP, departmentDTO.iGhiChu, departmentDTO.iActive, departmentDTO.iActive);

            try
            {
                ConnectionDB.ExecNonQuery(sql);
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Ejemplo n.º 2
0
        public int UpdateNhomHang(NhomHang nhomHang)
        {
            string sql = string.Format("Update NHOMHANG set TenNhom = N'{0}', GhiChu = N'{1}', Active = '{2}' where MaNhom = '{3}'", nhomHang.tenNhomHang, nhomHang.ghiChu, nhomHang.kichHoat, nhomHang.maNhomHang);

            try
            {
                ConnectionDB.ExecNonQuery(sql);
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Ejemplo n.º 3
0
        public int deleteUnit(string madvt)
        {
            string sql = string.Format(" delete from DONVITINH where MaDVT = N'{0}'", madvt);

            try
            {
                ConnectionDB.ExecNonQuery(sql);
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Ejemplo n.º 4
0
        public int deleteWarehouse(string makho)
        {
            string sql = string.Format(" delete from KHOHANG where MaKho = N'{0}'", makho);

            try
            {
                ConnectionDB.ExecNonQuery(sql);
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Ejemplo n.º 5
0
        //Đổi mật khẩu mới(update)
        public int updatePassword(string username, string password)
        {
            string sql = string.Format(" update SYS_USER " +
                                       " set [Password] = '{0}' " +
                                       " where UserName = N'{1}' ", password, username);

            try
            {
                ConnectionDB.ExecNonQuery(sql);
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Ejemplo n.º 6
0
        public int updateUnit(UnitDTO unit)
        {
            string sql = string.Format(" update DONVITINH " +
                                       " set Ten = N'{0}', GhiChu = N'{1}', Active = N'{2}' " +
                                       " where MaDVT = '{3}' ", unit.iTen, unit.iGhiChu, unit.iActive, unit.iMaDVT);

            try
            {
                ConnectionDB.ExecNonQuery(sql);
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Ejemplo n.º 7
0
        public int updateWarehouse(WarehouseDTO w)
        {
            string sql = string.Format(" update KHOHANG " +
                                       " set TenKho = N'{0}', LienHe = N'{1}', DiaChi = N'{2}', DienThoai = N'{3}', KyHieu = N'{4}', GhiChu = N'{5}', MaNV = N'{6}', Active = N'{7}' " +
                                       " where MaKho = '{8}' ", w.iTenKho, w.iLienHe, w.iDiaChi, w.iDienThoai, w.iKyHieu, w.iGhiChu, w.iMaNV, w.iActive, w.iMaKho);

            try
            {
                ConnectionDB.ExecNonQuery(sql);
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Ejemplo n.º 8
0
        public int insertUnit(UnitDTO unit)
        {
            string id = IDAuto();

            string sql = string.Format(" insert into DONVITINH (MaDVT, Ten, GhiChu, Active) values" +
                                       "('{0}', N'{1}', N'{2}', N'{3}')", id, unit.iTen, unit.iGhiChu, unit.iActive);

            try
            {
                ConnectionDB.ExecNonQuery(sql);
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Ejemplo n.º 9
0
        public int insertWarehouse(WarehouseDTO w)
        {
            string id = IDAuto();

            string sql = string.Format(" insert into KHOHANG (MaKho, TenKho, LienHe, DiaChi, DienThoai, KyHieu, GhiChu, MaNV, Active) values" +
                                       "('{0}', N'{1}', N'{2}', N'{3}', N'{4}', N'{5}', N'{6}', N'{7}' , N'{8}')",
                                       w.iMaKho, w.iTenKho, w.iLienHe, w.iDiaChi, w.iDienThoai, w.iKyHieu, w.iGhiChu, w.iMaNV, w.iActive);

            try
            {
                ConnectionDB.ExecNonQuery(sql);
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Ejemplo n.º 10
0
        public int InsertEmployees(EmployeesDTO employeesDTO)
        {
            //string bophan = employeesDTO.iBoPhan != null ? string.Format("'{0}'", employeesDTO.iBoPhan) : "null";
            //string nql = employeesDTO.iNguoiQL != null ? string.Format("'{0}'", employeesDTO.iNguoiQL) : "null";
            string id  = IDAuto();
            string sql = string.Format("INSERT INTO _NHANVIEN Values(N'{0}', N'{1}', N'{2}', N'{3}', N'{4}', N'{5}', N'{6}', N'{7}', '{8}')", id,
                                       employeesDTO.iTenNV, employeesDTO.iDiaChi, employeesDTO.iDienThoai, employeesDTO.iDiDong, employeesDTO.iEmail,
                                       employeesDTO.iBoPhan, employeesDTO.iNguoiQL, employeesDTO.iActive);

            try
            {
                ConnectionDB.ExecNonQuery(sql);
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Ejemplo n.º 11
0
        public int UpdateEmployees(EmployeesDTO employeesDTO)
        {
            string sql = "update _NHANVIEN set " +
                         string.Format("TenNV = N'{0}', DiaChi = N'{1}', Email = '{2}',",
                                       employeesDTO.iTenNV, employeesDTO.iDiaChi, employeesDTO.iEmail) +
                         string.Format("DienThoai = '{0}', DiDong = '{1}', BoPhan = '{2}', NguoiQL = '{3}'",
                                       employeesDTO.iDienThoai, employeesDTO.iDiDong, employeesDTO.iBoPhan, employeesDTO.iNguoiQL) +
                         string.Format("ConQuanLy={0} where MaNV='{1}'",
                                       employeesDTO.iActive, employeesDTO.iMaNV);

            try
            {
                ConnectionDB.ExecNonQuery(sql);
                return(1);
            }
            catch
            {
                return(0);
            }
        }