コード例 #1
0
        public ActionResult Edit([Bind(Include = "MaTuyen,DiemDi,DiemDen,QuangDuong,ThoiGian,SoChuyen1Ngay,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] TUYENXE tUYENXE)
        {
            string thuocTinhThanh  = Request.Form["tinhThanhDropList"].ToString();
            string thuocTinhThanh1 = Request.Form["tinhThanhDropList1"].ToString();

            if (thuocTinhThanh != thuocTinhThanh1)
            {
                if (ModelState.IsValid)
                {
                    ITinhThanhService tinhThanhService = new TinhThanhService();
                    TINHTHANH         tt    = tinhThanhService.Detail(thuocTinhThanh);
                    TINHTHANH         tt1   = tinhThanhService.Detail(thuocTinhThanh1);
                    IList <TUYENXE>   tuyen = service.Detail(tUYENXE.MaTuyen);
                    tuyen[0].DiemDi        = thuocTinhThanh;
                    tuyen[0].DiemDen       = thuocTinhThanh1;
                    tuyen[0].QuangDuong    = tUYENXE.QuangDuong;
                    tuyen[0].ThoiGian      = tUYENXE.ThoiGian;
                    tuyen[0].SoChuyen1Ngay = tUYENXE.SoChuyen1Ngay;
                    tuyen[0].TINHTHANH     = tt;
                    tuyen[0].TINHTHANH     = tt1;
                    service.Update(tuyen[0]);
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                return(RedirectToAction("Index"));
            }
            return(View(tUYENXE));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            TUYENXE tUYENXE = db.TUYENXEs.Find(id);

            db.TUYENXEs.Remove(tUYENXE);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "MaTuyen,DiemDi,DiemDen,QuangDuong,ThoiGian,SoChuyen1Ngay,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] TUYENXE tUYENXE)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tUYENXE).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tUYENXE));
 }
コード例 #4
0
        // GET: TUYENXEs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TUYENXE tUYENXE = db.TUYENXEs.Find(id);

            if (tUYENXE == null)
            {
                return(HttpNotFound());
            }
            return(View(tUYENXE));
        }
コード例 #5
0
 public static string GetTuyen(int?matuyen)
 {
     using (QLXeKhachEntities context = new QLXeKhachEntities())
     {
         TUYENXE tx = context.TUYENXEs.Find(matuyen);
         if (tx != null)
         {
             TINHTHANH tt1 = context.TINHTHANHs.Find(tx.DiemDi);
             TINHTHANH tt2 = context.TINHTHANHs.Find(tx.DiemDen);
             if (tt1 != null && tt2 != null)
             {
                 return(tt1.TenTT + " - " + tt2.TenTT);
             }
         }
         return("");
     }
 }
コード例 #6
0
        public void Delete(TUYENXE tuyen)
        {
            var user = HttpContext.Current.Session[GlobalConstant.USER];

            if (user != null)
            {
                NHANVIEN currentUser = (NHANVIEN)user;
                tuyen.lastupdateUser = currentUser.MaNV;
            }
            DateTime current = DateTime.Now;

            tuyen.lastupdateDate = current;
            using (QLXeKhachEntities context = new QLXeKhachEntities())
            {
                context.Entry(tuyen).State = EntityState.Modified;
                context.SaveChanges();
            }
        }
コード例 #7
0
 public int Add(TUYENXE tuyen)
 {
     using (QLXeKhachEntities context = new QLXeKhachEntities())
     {
         var user = HttpContext.Current.Session[GlobalConstant.USER];
         if (user != null)
         {
             NHANVIEN currentUser = (NHANVIEN)user;
             tuyen.createUser     = currentUser.MaNV;
             tuyen.lastupdateUser = currentUser.MaNV;
         }
         DateTime current = DateTime.Now;
         tuyen.createDate     = current;
         tuyen.lastupdateDate = current;
         context.TUYENXEs.Add(tuyen);
         context.SaveChanges();
         return(1);
     }
 }
コード例 #8
0
        public ActionResult Create([Bind(Include = "MaTuyen,DiemDi,DiemDen,QuangDuong,ThoiGian,SoChuyen1Ngay,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] TUYENXE tUYENXE)
        {
            string thuocTinhThanh  = Request.Form["tinhThanhDropList"].ToString();
            string thuocTinhThanh1 = Request.Form["tinhThanhDropList1"].ToString();

            if (thuocTinhThanh != thuocTinhThanh1)
            {
                if (ModelState.IsValid)
                {
                    tUYENXE.isDeleted = 0;
                    tUYENXE.DiemDi    = thuocTinhThanh;
                    tUYENXE.DiemDen   = thuocTinhThanh1;
                    service.Add(tUYENXE);
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                return(RedirectToAction("Create"));
            }
            return(View(tUYENXE));
        }