예제 #1
0
        public ActionResult Edit([Bind(Include = "MaHD,NgayLap,GiaThoaThuan,MaTram,ThoiHanThue,MaDT,NguoiLap,MoTa,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] HOPDONG hOPDONG)
        {
            string nguoiLap = Request.Form["nhanVienDropList"].ToString();
            string doiTac   = Request.Form["doiTacDropList"].ToString();
            string tramXe   = Request.Form["tramXeDropList"].ToString();

            if (ModelState.IsValid)
            {
                INhanVienService nhanVienService = new NhanVienService();
                NHANVIEN         nv = nhanVienService.Detail(Int32.Parse(nguoiLap));

                IDoiTacService doiTacService = new DoiTacService();
                DOITAC         dtac          = doiTacService.Detail(Int32.Parse(doiTac));

                ITramXeService tramXeService = new TramXeService();
                TRAMXE         tx            = tramXeService.Detail(Int32.Parse(tramXe))[0];

                IList <HOPDONG> hd = service.Detail(hOPDONG.MaHD);
                hd[0].NgayLap      = hOPDONG.NgayLap;
                hd[0].GiaThoaThuan = hOPDONG.GiaThoaThuan;
                hd[0].MaTram       = Int32.Parse(tramXe);
                hd[0].ThoiHanThue  = hOPDONG.ThoiHanThue;
                hd[0].MaDT         = Int32.Parse(doiTac);
                hd[0].NguoiLap     = Int32.Parse(nguoiLap);
                hd[0].MoTa         = hOPDONG.MoTa;
                hd[0].NHANVIEN     = nv;
                hd[0].DOITAC       = dtac;
                hd[0].TRAMXE       = tx;
                service.Update(hd[0]);
                return(RedirectToAction("Index"));
            }
            return(View(hOPDONG));
        }
예제 #2
0
        public ActionResult Edit([Bind(Include = "MaKS,NgayKS,NguoiKS,DiaChiKS,TiLeDonKhach,GiaKS,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] KHAOSAT kHAOSAT)
        {
            string nguoiKhaoSat = Request.Form["nhanVienDropList"].ToString();

            if (ModelState.IsValid)
            {
                INhanVienService nhanVienService = new NhanVienService();
                NHANVIEN         nv = nhanVienService.Detail(Int32.Parse(nguoiKhaoSat));
                IList <KHAOSAT>  ks = service.Detail(kHAOSAT.MaKS);
                ks[0].NguoiKS      = Int32.Parse(nguoiKhaoSat);
                ks[0].DiaChiKS     = kHAOSAT.DiaChiKS;
                ks[0].TiLeDonKhach = kHAOSAT.TiLeDonKhach;
                ks[0].GiaKS        = kHAOSAT.GiaKS;
                ks[0].NgayKS       = kHAOSAT.NgayKS;
                ks[0].NHANVIEN     = nv;
                service.Update(ks[0]);
                return(RedirectToAction("Index"));
            }
            return(View(kHAOSAT));
        }