public void AddDanhSachSPHienThiTrenHome(DanhSachSPHienThiTrenHome dm)
 {
     var q = en.DanhSachSPHienThiTrenHome.Max(i => (int?)i.ID) ?? 1;
     dm.ID = q + 1;
     en.AddObject("DanhSachSPHienThiTrenHome", dm);
 }
 internal void Add(DanhSachSPHienThiTrenHome sp)
 {
     throw new NotImplementedException();
 }
 public ActionResult HinhThucDangSp(FormCollection collection)
 {
     if (Session["ID"] != null)
     {
         var HinhThucDangId = InsertToHinhThucDang();
         var danhSachModule = GiaModuleRes.FindAllModuleTinhTien();
         foreach (var module in danhSachModule)
         {
             var moduleId = collection["TenModule_" + module.Module_ID];
             if (moduleId != null)
             {
                 var sp = new DanhSachSPHienThiTrenHome();
                 var giaMod = HTDSPRes.GetGiaModule(int.Parse(moduleId),
                                                     int.Parse(collection["NgayThangNam_" + module.Module_ID]));
                 sp.TongTien = giaMod.Gia * int.Parse(collection["Gia_" + module.Module_ID]);
                 sp.Gia = giaMod.Gia;
                 sp.HinhThucDang_ID = HinhThucDangId;
                 sp.QLSP_ID = int.Parse(collection["QLSP_ID"]);
                 sp.Module_ID = int.Parse(moduleId);
                 sp.SoNgayTuanThangNam = int.Parse(collection["Gia_" + module.Module_ID]);//so ngay thang hoac nam
                 sp.ngayTuanThangNam_ID = int.Parse(collection["NgayThangNam_" + module.Module_ID]);
                 IFormatProvider provider = new System.Globalization.CultureInfo("en-CA", true);
                 String datetime = collection["datePicker_" + module.Module_ID];
                 DateTime dt = DateTime.Parse(datetime, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
                 sp.NgayBatDau = dt;
                 HTDSPRes.AddDanhSachSPHienThiTrenHome(sp);
                 HTDSPRes.Save();
             }
         }
         return RedirectToAction("ChiTietHinhThucDangSp", new { id = HinhThucDangId });
     }
     else
     {
         return RedirectToAction("LogOn", "Account");
     }
 }