Example #1
0
        public ActionResult XoaChuongTrinh(string id)
        {
            CHUONGTRINH ct = data.CHUONGTRINHs.SingleOrDefault(n => n.MaCT == id);

            ViewBag.Mact = ct.MaCT;
            return(View(ct));
        }
        public ActionResult XacNhanXoa(string id)
        {
            CHUONGTRINH ct = data.CHUONGTRINHs.SingleOrDefault(n => n.MaCT == id);

            ViewBag.Mact = ct.MaCT;
            if (ct == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            data.CHUONGTRINHs.DeleteOnSubmit(ct);
            data.SubmitChanges();
            return(RedirectToAction("Index", "ChuongTrinh"));
        }
Example #3
0
        //public decimal GetTienBHYT(int idBHYT)
        //{
        //    try
        //    {
        //        //BHYT bhyt = context.BHYT.FirstOrDefault(x => x.ID_BHYT == idBHYT);
        //        if (bhyt != null)
        //        {
        //            return Convert.ToDecimal(bhyt.LoaiTien);
        //        }
        //        else
        //        {
        //            return 0;
        //        }
        //    }
        //    catch (Exception e)
        //    {
        //        Console.WriteLine(e);
        //        throw e;
        //    }
        //}

        public decimal GetHocPhiTheoChuongTrinh(int idCT)
        {
            try
            {
                CHUONGTRINH ct = context.CHUONGTRINH.FirstOrDefault(x => x.ID_CT == idCT);
                if (ct != null)
                {
                    return(Convert.ToDecimal(ct.SoTien));
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw e;
            }
        }
Example #4
0
 public decimal TinhTienHocPhi(int idChuongTrinh, decimal bhyt)
 {
     try
     {
         CHUONGTRINH ct = context.CHUONGTRINH.FirstOrDefault(x => x.ID_CT == idChuongTrinh);
         if (ct != null)
         {
             return(Convert.ToDecimal(bhyt + ct.SoTien + 670000 + 77000 + 80000 + 50000));
         }
         else
         {
             return(0);
         }
         return(0);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw e;
     }
 }
Example #5
0
        public ActionResult ThemChuongTrinh(CHUONGTRINH ct, FormCollection c)
        {
            var ten = c["tenCT"];
            var ma  = c["maCT"];

            if (string.IsNullOrEmpty(ten) || string.IsNullOrEmpty(ma))
            {
                ViewData["Loi1"] = "Thông tin không được để trống.";
            }
            else if (data.CHUONGTRINHs.Where(t => t.MaCT == ma).Count() != 0)
            {
                ViewData["Loi1"] = "Mã chương trình đã tồn tại.";
            }
            else
            {
                ct.MaCT  = ma;
                ct.TenCT = ten;
                data.CHUONGTRINHs.InsertOnSubmit(ct);
                data.SubmitChanges();
                return(RedirectToAction("Index", "ChuongTrinh"));
            }
            return(this.ThemChuongTrinh());
        }