コード例 #1
0
        private void TransferFile(SMC_PushDll dll)
        {
            if (dll == null)
                return;

            string path = dll.pd_path + dll.pd_zip_filename;
            if (!System.IO.File.Exists(path))
                return;
            FileStream fs = new FileStream(path, FileMode.Open);
            FileTransSvcClient ftsc = new FileTransSvcClient();

            ftsc.Open();

            #region 上传文件

            FileUploadMessage myFileMessage = new FileUploadMessage();

            myFileMessage.FileName = dll.pd_zip_filename;//"PushSharp-master.zip"; //文件名
            {
                myFileMessage.FileData = fs;
                IFileTransSvc intfFileTrans = ftsc.ChannelFactory.CreateChannel();
                try
                {
                    intfFileTrans.UploadFileMethod(myFileMessage);
                }
                catch { }
                finally
                {
                    fs.Close();
                    fs.Dispose();
                }

            }

            #endregion

            ftsc.Close();
        }
コード例 #2
0
        public ActionResult UploadFile(FormCollection form)
        {
            //return View(true);
            if (HttpContext.Request != null && HttpContext.Request.Files.Count > 0) {
                HttpPostedFileBase file = HttpContext.Request.Files[0];
                string fileName = System.IO.Path.GetFileNameWithoutExtension(file.FileName);
                SMC_PushDll dll = new SMC_PushDll();
                dll.pd_name = fileName;
                //bool exists = BoFactory.GetSMC_PushDllBO.Exists(dll);

                string path = Server.MapPath("~/PushZipPacks/") + fileName + "/";
                SmartBox.Console.Common.ZipHelper.UnpackFiles(file.InputStream, path);
                //TransferFile(file.InputStream);
            }

            Hashtable r = new Hashtable();
            r["result"] = true;
            return Json(r);
        }
コード例 #3
0
 private void changeDllStatus(SMC_PushDll dll, string jostype, bool executeSucced)
 {
     switch (jostype)
     {
         case "AddJobPluginGroup":
             if (executeSucced)
                 dll.pd_dll_status = "已载入";
             break;
         case "RemoveJobPluginGroup":
             if (executeSucced)
                 dll.pd_dll_status = "已载出";
             break;
         case "RestartJobPluginGroup":
             if (executeSucced)
                 dll.pd_dll_status = "已重载";
             break;
         case "SetTargetJobTime":
             break;
         case "PauseTargetJob":
             if (executeSucced)
                 dll.pd_dll_status = "已暂停";
             break;
         case "ContinueTargetJob":
             if (executeSucced)
                 dll.pd_dll_status = "已继续";
             break;
     }
     BoFactory.GetSMC_PushDllBO.Update(dll);
 }
コード例 #4
0
 public virtual void Update(SMC_PushDll role)
 {
     try
     {
         SMC_PushDllDAO.Update(role);
     }
     catch (DalException ex)
     {
         throw new BOException("调用方法Update失败", ex);
     }
 }
コード例 #5
0
        public ActionResult PushDllAdd(string pd_id)
        {
            if (String.IsNullOrEmpty(pd_id))
            {
                SMC_PushDll dll = new SMC_PushDll();
                dll.pd_createdtime = DateTime.Now;
                dll.pd_status = false;
                BoFactory.GetSMC_PushDllBO.Insert(dll);
                ViewData["pd_id"] = dll.pd_id;
                Hashtable initialFiles = new Hashtable();
                initialFiles["files"] = new ArrayList();
                string fstr = Newtonsoft.Json.JsonConvert.SerializeObject(new ArrayList(), Newtonsoft.Json.Formatting.Indented);
                ViewData["f"] = fstr;
                string entity_fstr = Newtonsoft.Json.JsonConvert.SerializeObject(dll, Newtonsoft.Json.Formatting.Indented);
                ViewData["entity"] = entity_fstr;
            }
            else
            {
                ViewData["pd_id"] = pd_id;
                SMC_PushDll _dll = BoFactory.GetSMC_PushDllBO.Get(int.Parse(pd_id));
                Hashtable initialFiles = new Hashtable();
                initialFiles["name"] = _dll.pd_zip_filename;
                initialFiles["extension"] = _dll.pd_zip_extension;
                initialFiles["size"] = _dll.pd_zip_size;
                string fstr = Newtonsoft.Json.JsonConvert.SerializeObject(initialFiles, Newtonsoft.Json.Formatting.Indented);
                ViewData["f"] = "[" + fstr + "]";

                string entity_fstr = Newtonsoft.Json.JsonConvert.SerializeObject(_dll, Newtonsoft.Json.Formatting.Indented);
                ViewData["entity"] = entity_fstr;
            }
            return View();
        }
コード例 #6
0
 public virtual void Save(SMC_PushDll entity)
 {
     if (SMC_PushDllDAO.Get(entity.pd_id) == null)
         SMC_PushDllDAO.Insert(entity);
     else
         SMC_PushDllDAO.Update(entity);
 }
コード例 #7
0
        public virtual bool InsertOrUpdate(SMC_PushDll role)
        {
            try
            {
                int i = 0;
                if (SMC_PushDllDAO.Get(role.pd_id) == null)
                {
                    SMC_PushDllDAO.Insert(role);
                }
                else
                {
                    SMC_PushDllDAO.Update(role);
                }

                return true;
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法InsertOrUpdate失败", ex);
            }
        }
コード例 #8
0
 public virtual void Insert(SMC_PushDll role)
 {
     try
     {
         int maxid = SMC_PushDllDAO.GetMaxID();
         role.pd_id = maxid + 1;
         SMC_PushDllDAO.Insert(role);
     }
     catch (DalException ex)
     {
         throw new BOException("调用方法Insert失败", ex);
     }
 }
コード例 #9
0
 //[Frame(false, false)]
 //public virtual void InsertBatch(IList<SMC_Role> roles, int batchSize)
 //{
 //    try
 //    {
 //        SMC_RoleDao.InsertBatch(roles, batchSize);
 //    }
 //    catch (DalException ex)
 //    {
 //        throw new BOException("调用方法InsertBatch失败", ex);
 //    }
 //}
 public virtual bool ExistsXml(SMC_PushDll entity)
 {
     try
     {
         return SMC_PushDllDAO.ExistsXml(entity);
     }
     catch (DalException ex)
     {
         throw new BOException("调用方法ExistsXml失败", ex);
     }
 }
コード例 #10
0
 public virtual void Delete(SMC_PushDll entity)
 {
     try
     {
         SMC_PushDllDAO.Delete(entity);
         string path = HttpContext.Current.Server.MapPath("~/PushZipPacks/") + entity.pd_id + "\\";
         if (System.IO.Directory.Exists(path))
         {
             System.IO.Directory.Delete(path, true);
         }
     }
     catch (DalException ex)
     {
         throw new BOException("????????????", ex);
     }
 }