コード例 #1
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (btnXoa.Text == "Xóa")
     {
         DialogResult rs = MessageBox.Show("Bạn có chắc chắn muốn xóa ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (rs == DialogResult.Yes)
         {
             long id     = Convert.ToInt32(txbMa.Text);
             bool result = new TheLoaiDAO().RemoveTheLoai(id);
             if (result == true)
             {
                 MessageBox.Show("Xóa thành công");
             }
             else
             {
                 MessageBox.Show("Không thành công");
             }
             loadTheLoai();
             LockControl();
         }
         else
         {
             return;
         }
     }
     else
     {
         loadTheLoai();
         LockControl();
     }
 }
コード例 #2
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = dataGVTheLoai.SelectedRows.Count >= 1 ? dataGVTheLoai.SelectedRows[0] : null;

            if (row != null)
            {
                int    maTheLoai  = Convert.ToInt32(row.Cells["colMaTL"].Value);
                string tenTheLoai = row.Cells["colTenTL"].Value.ToString();
                string message    = $"Bạn có muốn xóa thể loại {tenTheLoai} không ?";
                string caption    = "Xóa nhân viên";
                if (MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (TheLoaiDAO.DeleteTheLoai(maTheLoai))
                    {
                        MessageBox.Show("Xóa thành công");
                        InitTheLoai();
                    }
                    else
                    {
                        MessageBox.Show("Xóa không thành công");
                    }
                }
            }
            else
            {
                MessageBox.Show("Bạn chưa chọn thể loại để xóa");
            }
        }
コード例 #3
0
        public static List <TheLoaiDTO> loadAllAndConvertToFillCombobox()
        {
            var result = TheLoaiDAO.loadAll();

            result.Insert(0, new TheLoaiDTO(0, "All types"));
            return(result);
        }
コード例 #4
0
        public ActionResult Update(int id)
        {
            TheLoaiDAO dao = new TheLoaiDAO();
            var        ud  = dao.Detail(id);

            return(View(ud));
        }
コード例 #5
0
        // GET: Home
        public ActionResult Index()
        {
            //Danh Sach Tat Ca Bai Hat
            BaiHatDAO     bh = new BaiHatDAO();
            List <BaiHat> ls = bh.ListOf();

            ViewBag.NgheGanDay = ls;
            //Top 15 bai hat hay nhat
            var top15 = bh.Top15();

            ViewBag.Top15 = top15;
            //Nghệ Sĩ Nổi Bật
            NgheSiDAO ns        = new NgheSiDAO();
            var       NgheSiHot = ns.ListNgheSiHot();

            ViewBag.NgheSiNoiBat = NgheSiHot;
            //BaiHatMoiPhatHanh
            var mph = bh.MoiPhatHanh();

            ViewBag.MoiPhatHanh = mph;
            //Album Hot
            AlbumDAO al    = new AlbumDAO();
            var      album = al.AlbumHot();

            ViewBag.AlbumHot = album;
            //Thể Loại
            TheLoaiDAO tl      = new TheLoaiDAO();
            var        theloai = tl.TheLoaiListIEnnumable();

            ViewBag.TheLoai = theloai;
            return(View());
        }
コード例 #6
0
ファイル: TheLoaiBUS.cs プロジェクト: lkh/thanhpham
        public TheLoaiDTO LayTenTheLoai(int maLoai)
        {
            TheLoaiDAO tlDAO = new TheLoaiDAO();
            TheLoaiDTO tlDTO = null;

            tlDTO = tlDAO.LayTenTheLoai(maLoai);
            return(tlDTO);
        }
コード例 #7
0
        public ActionResult Update(BaiHat obj, HttpPostedFileBase file, FormCollection f)
        {
            BaiHatDAO dao = new BaiHatDAO();

            try
            {
                if (file != null && file.ContentLength > 0)
                {
                    string fileName = Path.GetFileNameWithoutExtension(file.FileName);
                    fileName += "_" + obj.IdBaiHat;
                    fileName += Path.GetExtension(file.FileName);

                    string folderPath  = Server.MapPath("~") + @"\Areas\Admin\Asset\ImagesOutSource\imgsong";
                    string folderPath2 = Server.MapPath("~") + @"/Assets/images/ImagesOutSource/ImagesSong";

                    if (!Directory.Exists(folderPath))
                    {
                        Directory.CreateDirectory(folderPath);
                    }

                    string path  = Path.Combine(folderPath, fileName);
                    string path2 = Path.Combine(folderPath2, fileName);

                    file.SaveAs(path);
                    file.SaveAs(path2);
                    obj.AnhBaiHat = fileName;
                    obj.IdNgheSi  = Convert.ToInt32(f["getNgheSi"]);
                    if (dao.Update(obj))
                    {
                        return(RedirectToAction("Index", "AdBaiHat"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Error");
                        return(View(obj.IdBaiHat));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Bạn phải nhập vào trường này");
                }
            }
            catch
            {
            }
            TheLoaiDAO tldao    = new TheLoaiDAO();
            var        category = tldao.ListOf();
            NgheSiDAO  nsdao    = new NgheSiDAO();
            var        nghesi   = nsdao.Listof();
            AlbumDAO   abdao    = new AlbumDAO();
            var        album    = abdao.Listof();

            ViewBag.category = category;
            ViewBag.nghesi   = nghesi;
            ViewBag.album    = album;
            return(View());
        }
コード例 #8
0
        private void InitTheLoai()
        {
            List <TheLoai> theloaiGroup = TheLoaiDAO.LoadTheLoai();

            foreach (TheLoai item in theloaiGroup)
            {
                cmbTheLoai.Items.Add(item.TenTheLoai);
            }
        }
コード例 #9
0
ファイル: frmdanhsachsach.cs プロジェクト: viethuy20/git
 private void frmdanhsachsach_Load(object sender, EventArgs e)
 {
     colmatheloai.ValueMember   = "MaTheLoai";
     colmatheloai.DisplayMember = "TenTheLoai";
     colmatheloai.DataSource    = TheLoaiDAO.GetTheLoaiAll();
     HienThiDanhSach();
     cbTimTheLoai.ValueMember   = "MaTheLoai";
     cbTimTheLoai.DisplayMember = "TenTheLoai";
     cbTimTheLoai.DataSource    = TheLoaiDAO.GetTheLoaiAll();
 }
コード例 #10
0
        public ActionResult BaiHatTheoTheLoai(int id)
        {
            BaiHatDAO  bh      = new BaiHatDAO();
            TheLoaiDAO th      = new TheLoaiDAO();
            var        theloai = th.Detail(id);

            ViewBag.TheLoai = theloai.TenTheLoai;
            var x = bh.GetBaiHatByTheLoai(id);

            return(View(x));
        }
コード例 #11
0
        public void InitTheLoai()
        {
            dataGVTheLoai.Rows.Clear();
            List <TheLoai> list = TheLoaiDAO.LoadTheLoai();

            foreach (TheLoai item in list)
            {
                dataGVTheLoai.Rows.Add(item.ItemArray());
            }
            dataGVTheLoai.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
        }
コード例 #12
0
ファイル: HomeController.cs プロジェクト: crystron/dotNet-web
        public ActionResult Index(int page = 1, int pagesize = 8)
        {
            SachDAO    sachDAO    = new SachDAO();
            TheLoaiDAO theLoaiDAO = new TheLoaiDAO();

            ViewBag.sanphammoi  = sachDAO.dsSanPhamTheoUuTien(3, page, pagesize).Take(4);
            ViewBag.loaisanpham = theLoaiDAO.dsTheLoai();
            ViewBag.danhsachban = sachDAO.dsBan(page, pagesize);
            ViewBag.hethang     = sachDAO.dsHetHang(page, pagesize);
            return(View());
        }
コード例 #13
0
 private void UpdateTheLoai(int maTheLoai, string tenTheLoai)
 {
     if (TheLoaiDAO.UpdateTheLoai(maTheLoai, tenTheLoai))
     {
         MessageBox.Show("Cập nhật thành công");
         Dispose();
     }
     else
     {
         MessageBox.Show("Cập nhật thất bại");
     }
 }
コード例 #14
0
 public void XoaTheLoai(string maTheLoai)
 {
     try
     {
         TheLoaiDAO TheLoai = new TheLoaiDAO();
         TheLoai.XoaTheLoai(maTheLoai);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #15
0
 public void SuaTheLoai(string maTheLoai, string TenTheLoai)
 {
     try
     {
         TheLoaiDAO TheLoai = new TheLoaiDAO();
         TheLoai.SuaTheLoai(maTheLoai, TenTheLoai);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #16
0
ファイル: TheLoaiBUS.cs プロジェクト: viethuy20/git
 public static bool SuaTheLoai(TheLoaiDTO tl)
 {
     if (TheLoaiDAO.GetTheLoaiByMa(tl.MaTheLoai) != null)
     {
         TheLoaiDAO.Update(tl);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #17
0
ファイル: TheLoaiBUS.cs プロジェクト: viethuy20/git
 public static bool ThemTheLoai(TheLoaiDTO tl)
 {
     if (TheLoaiDAO.GetTheLoaiByName(tl.TenTheLoai) == null)
     {
         TheLoaiDAO.Insert(tl);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #18
0
ファイル: TheLoaiBUS.cs プロジェクト: viethuy20/git
 public static bool XoaTheLoai(TheLoaiDTO tl)
 {
     if (TheLoaiDAO.GetTheLoaiByName(tl.TenTheLoai) != null)
     {
         TheLoaiDAO.Delete(tl);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #19
0
 private void InsertTheLoai(string tenTheLoai)
 {
     if (TheLoaiDAO.InsertTheLoai(tenTheLoai))
     {
         MessageBox.Show("Thêm thành công");
         Dispose();
     }
     else
     {
         MessageBox.Show("Thêm thất bại");
     }
 }
コード例 #20
0
 public DataTable LayDanhSachTheLoai()
 {
     try
     {
         TheLoaiDAO dsTheLoai = new TheLoaiDAO();
         DataTable  table     = dsTheLoai.LayDanhSachTheLoai();
         return(table);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
 }
コード例 #21
0
ファイル: frmquanlysach.cs プロジェクト: viethuy20/git
 private void frmQuanLySach_Load(object sender, EventArgs e)
 {
     dgvTheLoai.ValueMember     = "MaTheLoai";
     dgvTheLoai.DisplayMember   = "TenTheLoai";
     dgvTheLoai.DataSource      = TheLoaiDAO.GetTheLoaiAll();
     cbTheLoai.ValueMember      = "MaTheLoai";
     cbTheLoai.DisplayMember    = "TenTheLoai";
     cbTheLoai.DataSource       = TheLoaiDAO.GetTheLoaiAll();
     cbTimTheLoai.ValueMember   = "MaTheLoai";
     cbTimTheLoai.DisplayMember = "TenTheLoai";
     cbTimTheLoai.DataSource    = TheLoaiDAO.GetTheLoaiAll();
     HienThiDanhSach();
 }
コード例 #22
0
 public void ThemTheLoai(string tenTheLoai)
 {
     try
     {
         TheLoaiDAO TheLoai   = new TheLoaiDAO();
         DataTable  dsTheLoai = TheLoai.LayDanhSachTheLoai();
         string     maTheLoai = "TLS" + (int.Parse(dsTheLoai.Rows[dsTheLoai.Rows.Count - 1][0].ToString().Substring(3, 3)) + 1).ToString("000");
         TheLoai.ThemTheLoai(maTheLoai, tenTheLoai);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #23
0
        public ActionResult Add()
        {
            TheLoaiDAO tldao    = new TheLoaiDAO();
            var        category = tldao.ListOf();
            NgheSiDAO  nsdao    = new NgheSiDAO();
            var        nghesi   = nsdao.Listof();
            AlbumDAO   abdao    = new AlbumDAO();
            var        album    = abdao.Listof();

            ViewBag.category = category;
            ViewBag.nghesi   = nghesi;
            ViewBag.album    = album;

            return(View());
        }
コード例 #24
0
        private void UpdateSach(string maSach, string tenSach, string tenTacGia, string tenTheLoai, string tenNXB, string gia, string soLuong)
        {
            int maNXB     = NXB_DAO.GetIdNXBByName(tenNXB);
            int maTheLoai = TheLoaiDAO.GetIdTheLoaiByName(tenTheLoai);
            int maTacGia  = TacGiaDAO.GetIdTacGiaByName(tenTacGia);

            if (SachDAO.UpdateSach(maSach, tenSach, maNXB, maTacGia, maTheLoai, Convert.ToDouble(gia), Convert.ToInt32(soLuong)))
            {
                MessageBox.Show("Cập nhật thành công");
                Dispose();
            }
            else
            {
                MessageBox.Show("Cập nhật thất bại");
            }
        }
コード例 #25
0
        public ActionResult Update(int id)
        {
            TheLoaiDAO tldao    = new TheLoaiDAO();
            var        category = tldao.ListOf();
            NgheSiDAO  nsdao    = new NgheSiDAO();
            var        nghesi   = nsdao.Listof();
            AlbumDAO   abdao    = new AlbumDAO();
            var        album    = abdao.Listof();

            ViewBag.category = category;
            ViewBag.nghesi   = nghesi;
            ViewBag.album    = album;
            BaiHatDAO dao = new BaiHatDAO();
            var       rs  = dao.Detail(id);

            return(View(rs));
        }
コード例 #26
0
        public ActionResult Update(TheLoai obj, HttpPostedFileBase file)
        {
            try
            {
                TheLoaiDAO dao = new TheLoaiDAO();
                if (file != null && file.ContentLength > 0)
                {
                    string fileName = Path.GetFileNameWithoutExtension(file.FileName);
                    fileName += "_" + obj.IdTheLoai;
                    fileName += Path.GetExtension(file.FileName);

                    string folderPath = Server.MapPath("~") + @"\Assets\images\genrs";

                    if (!Directory.Exists(folderPath))
                    {
                        Directory.CreateDirectory(folderPath);
                    }

                    string path = Path.Combine(folderPath, fileName);

                    file.SaveAs(path);
                    obj.AnhTheLoai = fileName;
                    if (dao.Update(obj))
                    {
                        return(RedirectToAction("Index", "TheLoai"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Error");
                        return(View(obj.IdTheLoai));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Bạn phải nhập vào trường này");
                }
            }
            catch
            {
            }
            return(View());
        }
コード例 #27
0
ファイル: frmquanlytheloai.cs プロジェクト: viethuy20/git
        private void btnimport_Click(object sender, EventArgs e)
        {
            string         oldPath = Directory.GetCurrentDirectory();
            OpenFileDialog of      = new OpenFileDialog();

            of.ShowDialog();
            string strPathName = of.FileName;

            Directory.SetCurrentDirectory(oldPath);
            DataTable dt = ExcelRead.getSheet(strPathName, "sheet1");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                TheLoaiDTO tl = new TheLoaiDTO();
                tl.TenTheLoai = dt.Rows[i].ItemArray[1].ToString();
                TheLoaiDAO.Insert(tl);
            }
            MessageBox.Show("Import dữ liệu thành công ...", "Thông báo");
            HienThiDanhSach();
        }
コード例 #28
0
        void LuuTheLoai()
        {
            if (txbTLMaTheLoai.Text == "")
            {
                return;
            }
            TheLoaiDAO tttheloai = new TheLoaiDAO()
            {
                MaTheLoai  = txbTLMaTheLoai.Text,
                TenTheLoai = txbTLTenTheLoai.Text
            };

            if (theloai.KiemTraTheLoai(tttheloai.MaTheLoai))
            {
                theloai.SuaTheLoai(tttheloai);
            }
            else
            {
                theloai.ThemTheLoai(tttheloai);
            }
            MessageBox.Show("Lưu thể loại thành công!");
            LoadDtgvTheLoai();
        }
コード例 #29
0
 public TheLoaiBUS()
 {
     this.theLoaiDAO = new TheLoaiDAO();
 }
コード例 #30
0
ファイル: TheLoaiBUS.cs プロジェクト: lkh/thanhpham
 public static void Insert(TheLoaiDTO theLoai)
 {
     TheLoaiDAO.Insert(theLoai);
 }