Ejemplo n.º 1
0
        public ActionResult DeleteFtp(FtpDTO ftp)
        {
            try
            {
                DB.FtpList.Where(x => x.ID == ftp.ID).Delete();


                DB.SaveChanges();
                return(PartialView("FtpGridPartial", GetFtpList()));
            }
            catch (Exception ex)
            {
                ViewData["EditError"] = ex.Message;
                return(PartialView("FtpGridPartial", GetFtpList()));
            }
        }
Ejemplo n.º 2
0
        public ActionResult InsertFtp(FtpDTO ftp)
        {
            if (ModelState.IsValid)
            {
                TBL_FTP _ftp = new TBL_FTP();
                _ftp.ID         = ftp.ID;
                _ftp.STATION_ID = ftp.STATION_ID;
                _ftp.IP_ADDRESS = ftp.IP_ADDRESS;
                _ftp.PORT_NO    = ftp.PORT_NO;
                _ftp.USER_NAME  = ftp.USER_NAME;
                _ftp.PASSWORD   = ftp.PASSWORD;

                DB.FtpList.Add(_ftp);
                DB.SaveChanges();
            }
            else
            {
                ViewData["EditError"]       = "Please, correct all errors.";
                ViewData["EditableProduct"] = ftp;
            }

            return(PartialView("FtpGridPartial", GetFtpList()));
        }
Ejemplo n.º 3
0
        List <FtpDTO> GetFtpList()
        {
            List <FtpDTO> _ftpList = new List <FtpDTO>();

            List <TBL_FTP> ftp = DB.FtpList.ToList();


            for (int i = 0; i < ftp.Count; i++)
            {
                FtpDTO _ftp = new FtpDTO();

                _ftp.ID           = ftp[i].ID;
                _ftp.STATION_ID   = ftp[i].STATION_ID;
                _ftp.STATION_NAME = (from t in DB.Stations join tt in DB.FtpList on t.ID equals tt.STATION_ID where t.ID == tt.STATION_ID select t.NAME).FirstOrDefault();
                _ftp.IP_ADDRESS   = ftp[i].IP_ADDRESS;
                _ftp.PORT_NO      = ftp[i].PORT_NO;
                _ftp.USER_NAME    = ftp[i].USER_NAME;
                _ftp.PASSWORD     = ftp[i].PASSWORD;
                _ftpList.Add(_ftp);
            }

            return(_ftpList);
        }
Ejemplo n.º 4
0
        public ActionResult UpdateFtp(FtpDTO ftp)
        {
            if (ModelState.IsValid)
            {
                TBL_FTP _ftp = DB.FtpList.AsNoTracking().FirstOrDefault(x => x.ID == ftp.ID);

                _ftp.ID         = ftp.ID;
                _ftp.STATION_ID = ftp.STATION_ID;
                _ftp.IP_ADDRESS = ftp.IP_ADDRESS;
                _ftp.PORT_NO    = ftp.PORT_NO;
                _ftp.USER_NAME  = ftp.USER_NAME;
                _ftp.PASSWORD   = ftp.PASSWORD;

                DB.Entry(_ftp).State = EntityState.Modified;

                DB.SaveChanges();
            }
            else
            {
                ViewData["EditError"]       = "Please, correct all errors.";
                ViewData["EditableProduct"] = ftp;
            }
            return(PartialView("FtpGridPartial", GetFtpList()));
        }