//public int Insert(LoaiSP obj)
        //{
        //    int result = 0;
        //    string strQuery = "insert into SINHVIEN (MSSV,HoTen,NgaySinh,Phai,Email,SDT,Khoa) values ('" + obj.MSSV + "',N'" + obj.HoTen + "','" + obj.NgaySinh + "',N'" + obj.Phai + "','" + obj.Email + "','" + obj.SDT + "',N'" + obj.Khoa + "')";

        //    result = base.excuteNoneQuery("LSP_Insert");
        //    return result; //tra ve so ghi nhan thuc hien
        //}
        //check ID
        //public bool CheckID(string MaLSP)
        //{
        //    //  bool result = true;

        //    //string strQuery = "select * from SANPHAM where maSP ='" + MaSP + "'";
        //    DataTable DT = new DataTable();
        //    DT = base.GetData("LSP_SelectByID");
        //    if (DT.Rows.Count > 0)
        //        return true;
        //    return false;
        //}
        //public int Update(LoaiSP obj)
        //{
        //    int result = 0;
        //    // string strQuery = "update SINHVIEN set HoTen=N'" + obj.HoTen + "',NgaySinh='" + obj.NgaySinh + "',Phai=N'" + obj.Phai + "',Email='" + obj.Email + "',SDT='" + obj.SDT + "' where MSSV='" + obj.MSSV + "'";
        //    //dbConnect config = new dbConnect();
        //    result = base.excuteNoneQuery("LSP_Update");
        //    return result; //tra ve so ghi nhan thuc hien
        //}
        // xoa
        //public int Delete(string MaLSP)
        //{
        //    int result = 0;
        //    //string strQuery = "delete from SINHVIEN where MSSV='" + MaSP + "'";
        //    //dbConnect config = new dbConnect();
        //    result = base.excuteNoneQuery("LSP_Delete");
        //    return result; //tra ve so ghi nhan thuc hien
        //}
        public int Insert(LoaiSP obj)
        {
            SqlParameter[] para =
            {
                new SqlParameter("TenLSP", obj.tenLSP)
            };

            return(base.ExcuteSQL("LSP_Insert", para));
        }
        public int Update(LoaiSP obj)
        {
            SqlParameter[] para =
            {
                new SqlParameter("MaLSP",  obj.maLSP),
                new SqlParameter("TenLSP", obj.tenLSP)
            };

            return(base.ExcuteSQL("LSP_Update", para));
        }
Exemple #3
0
        public static List <LoaiSP> LayLoaiSPTheoDanhMuc(string para)
        {
            SqlDataReader reader = DataProvider.TruyVan1ParaString("LayLoaiSPTheoDanhMuc", para);
            List <LoaiSP> loaisp = new List <LoaiSP>();

            while (reader.Read())
            {
                LoaiSP sp = new LoaiSP();
                sp.MaDanhMuc = reader.GetString(0);
                sp.TenLoaiSP = reader.GetString(1);
                sp.MaDanhMuc = reader.GetString(2);
                loaisp.Add(sp);
            }
            return(loaisp);
        }
Exemple #4
0
        public bool Update(LoaiSP model)
        {
            string msgError = "";

            try
            {
                var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "sp_category_update",

                                                                              "@maloai", model.maloai,
                                                                              "@tenloai", model.tenloai);
                if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(Convert.ToString(result) + msgError);
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }