Beispiel #1
0
        public ActionResult editftp()
        {
            Entity.FTPInformation_Entity ftp = new FTPInformation_Entity();

            ftp.ID          = Convert.ToInt32(Request["ID"]);
            ftp.AgencyNo    = Request["AgencyNo"];
            ftp.FTPAddress  = Request["FTPAddress"];
            ftp.FTPUsername = Request["FTPUsername"];
            ftp.FTPPassword = Request["FTPPassword"];
            ftp.data_Key    = Request["data_Key"];

            int i = FTPInformation_BLL.UpdateFTPInfo(ftp);

            if (i > 0)
            {
                var json = new
                {
                    code = 0,
                    msg  = "修改成功!"
                };
                return(Json(json));
            }
            else
            {
                var json = new
                {
                    code = 1,
                    msg  = "修改失败!"
                };
                return(Json(json));
            }
        }
Beispiel #2
0
        public ActionResult Upload()
        {
            string      ID   = Request["ID"];
            data_Entity data = new data_Entity();

            data = data_BLL.GetdataByID(ID);
            string fileName = data.dataName + ".txt";
            string filePath = Server.MapPath("/") + data.data_Position + "\\" + fileName;
            FTPInformation_Entity ftpinfo = new FTPInformation_Entity();

            ftpinfo = FTPInformation_BLL.GetFTPInfoByAgencyNo1(data.AgencyNo);
            FtpHelper ftp  = new FtpHelper(ftpinfo.FTPAddress, ftpinfo.FTPUsername, ftpinfo.FTPPassword);
            FileInfo  file = new FileInfo(filePath);
            bool      i    = ftp.Upload(file, fileName);

            if (i)
            {
                data.upload = "1";
                data_BLL.Updatedata(data);
                logs_Entity logs = new logs_Entity();
                logs.AgencyNo  = data.AgencyNo;
                logs.inputTime = DateTime.Now;
                logs.logName   = "上传密文:" + data.dataName;
                logs.log_No    = DateTime.Now.ToString("yyyyMMddhhmmss");
                logs.succeed   = "1";
                logs_BLL.Createlog(logs);

                var Person = new
                {
                    code = 0,                                       //0表示成功
                    msg  = "上传成功!",                                 //这个是失败返回的错误
                };
                return(Json(Person, JsonRequestBehavior.AllowGet)); //格式化为json
            }
            else
            {
                logs_Entity logs = new logs_Entity();
                logs.AgencyNo  = data.AgencyNo;
                logs.inputTime = DateTime.Now;
                logs.logName   = "上传密文:" + data.dataName;
                logs.log_No    = DateTime.Now.ToString("yyyyMMddhhmmss");
                logs.succeed   = "0";
                logs_BLL.Createlog(logs);
                var Person = new
                {
                    code = 1,                                       //0表示成功
                    msg  = "上传失败",                                  //这个是失败返回的错误
                };
                return(Json(Person, JsonRequestBehavior.AllowGet)); //格式化为json
            }
        }
Beispiel #3
0
        public ActionResult addFTP()
        {
            FTPInformation_Entity ftp = new FTPInformation_Entity();

            ftp.AgencyNo    = Request["AgencyNo"];
            ftp.FTPAddress  = Request["FTPAddress"];
            ftp.FTPUsername = Request["FTPUsername"];
            ftp.FTPPassword = Request["FTPPassword"];
            ftp.data_Key    = Request["data_Key"];
            List <FTPInformation_Entity> list = FTPInformation_BLL.GetFTPInfoByAgencyNo(ftp.AgencyNo);

            if (list.Count > 0)
            {
                var json = new
                {
                    code = 1,
                    msg  = "本机构FTP信息已存在!"
                };
                return(Json(json));
            }
            else
            {
                int i = FTPInformation_BLL.CreateFTPInfo(ftp);
                if (i > 0)
                {
                    var json = new
                    {
                        code = 0,
                        msg  = "添加成功!"
                    };
                    return(Json(json));
                }
                else
                {
                    var json = new
                    {
                        code = 1,
                        msg  = "添加失败!"
                    };
                    return(Json(json));
                }
            }
        }