public JsonResult DeletePushNotifications(string ids)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "" };

            try
            {
                string[] idarray = ids.Split(",".ToCharArray());
                VersionTrackBo verBO = BoFactory.GetVersionTrackBo;

                List<SMC_PackageExt> exts = new List<SMC_PackageExt>();
                foreach (string id in idarray)
                {
                    if (String.IsNullOrEmpty(id))
                        continue;
                    BoFactory.GetPushManageBO.DeletePushNotifications(id);
                }

                //BoFactory.GetAppCenterBO.AddSMC_PackageExt(exts);
                data.IsSuccess = true;
                data.Msg = "删除推送日志成功!";
            }
            catch (Exception e)
            {
                data.IsSuccess = false;
                data.Msg = e.Message;
            }
            return Json(data);
        }
 public JsonResult DeleteSkin(FormCollection form)
 {
     string tempSkinRoot = System.IO.Path.Combine(Server.MapPath("/"), @"res_temp\themes");
     JsonReturnMessages result = new JsonReturnMessages();
     try
     {
         string delSkinName = form["SkinName"];
         if (!string.IsNullOrEmpty(delSkinName))
         {
             string delSkinFolder = System.IO.Path.Combine(tempSkinRoot, delSkinName);
             if (System.IO.Directory.Exists(delSkinFolder))
             {
                 System.IO.Directory.Delete(delSkinFolder, true);
                 result.IsSuccess = true;
                 result.Msg = "删除皮肤成功!";
                 result.Data = delSkinName;
             }
             else
             {
                 result.Data = delSkinName;
                 throw new Exception("该皮肤还未上传!");
             }
         }
         else
             throw new Exception("皮肤名称为空!");
     }
     catch (Exception ex)
     {
         result.IsSuccess = false;
         result.Msg ="删除失败," +ex.Message;
     }
     return Json(result, "text/html");
 }
        public ActionResult GetDownLoadFile(FormCollection form)
        {
            var vmobject = new JsonReturnMessages();

            try
            {
                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = form["vid"].ToString();
                VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                string[] codes = v.FilePath.Split(new string[] { "\\" }, StringSplitOptions.None);
                string filename = Path.Combine(AppConfig.SaveZipPath, codes[codes.Length - 1] + ".zip");
                MemoryStream m = new MemoryStream(System.IO.File.ReadAllBytes(filename));
                DownLoadFile(m.ToArray(), v.PluginCode + v.VersionName + ".zip", m);

            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = ex.Message;
            }

            vmobject.IsSuccess = true;

            return Json(vmobject);
        }
        public ActionResult DelVersions(string vid)
        {
            var vmobject = new JsonReturnMessages();
            try
            {
                SearchVersionTrack searchv = new SearchVersionTrack();
                searchv.VID = vid;
                var p = BoFactory.GetVersionTrackBo.GetVersionTrack(searchv)[0];
                ArrayList arr = new ArrayList();
                arr.Add(vid);
                if (p.VersionStatus == 2)
                {
                    BoFactory.GetVersionTrackBo.DelVersion(arr);
                    vmobject.IsSuccess = true;
                }
                else if (p.VersionStatus == 1)
                {
                    BoFactory.GetVersionTrackBo.DelActiveVersionByUpdater(arr);
                    vmobject.IsSuccess = true;
                }
                else
                {
                    vmobject.IsSuccess = false;
                    vmobject.Msg = "����ɾ��δ�����İ汾,������ɷ���,����ɾ��������������";
                }
            }
            catch (Exception e)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = e.Message;
            }

            return Json(vmobject);
        }
 public ActionResult EditConfigs(FormCollection form, ConfigInfo cog)
 {
     var vmobject = new JsonReturnMessages();
     try
     {
         cog.Key1 = form["[key]"];
         if (string.IsNullOrEmpty(cog.ConfigId))
         {
             IList<ConfigInfo> list = new List<ConfigInfo>();
             list.Add(cog);
             //BoFactory.GetVersionTrackBo.InserConfigInfo(list, cog.PluginCode);
         }
         else
         {
             BoFactory.GetVersionTrackBo.UpdateConfigInfo(cog);
         }
         vmobject.IsSuccess = true;
         vmobject.Msg = "�����ɹ�!";
     }
     catch (Exception ex)
     {
         vmobject.IsSuccess = false;
         vmobject.Msg = ex.Message;
     }
     return Json(vmobject);
 }
 public JsonResult DeleteIOSOutsideApp(string id)
 {
     JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
     try
     {
         BoFactory.GetVersionTrackBo.DeleteIOSOutSideApp(id);
     }
     catch (Exception ex)
     {
         data.IsSuccess = false;
         data.Msg = ex.Message;
     }
     return Json(data);
 }
 public JsonResult ApproveApply(string id, string Operation)
 {
     JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
     try
     {
         BoFactory.GetVersionTrackBo.ApproveApplyDeviceBind(id, Operation);
     }
     catch (Exception ex)
     {
         data.IsSuccess = false;
         data.Msg = ex.Message;
     }
     return Json(data);
 }
        public ActionResult DelAllVersions(string vid)
        {
            var vmobject = new JsonReturnMessages();
            try
            {
                ArrayList arr = GetArrays(vid);
                BoFactory.GetVersionTrackBo.DelAllVersion(arr);
                vmobject.IsSuccess = true;
            }
            catch (Exception e)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = e.Message;
            }

            return Json(vmobject);
        }
예제 #9
0
        public ActionResult RegUser(FormCollection form)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };

            SMC_UserList ur = new SMC_UserList();

            ur.UL_ID = -1;
            ur.UL_UID = form[0];
            ur.UL_Name = form[1];
            ur.UL_PWD = form[2];
            ur.UL_MobilePhone = form[4];
            ur.UL_MailAddress = form[5];
            ur.Unit_ID =form[6];
            ur.UL_Sequence = Int32.Parse(form[7]);
            ur.UL_Demo = form[8];
            ur.UL_Gender = form[9];

            BoFactory.GetSMC_UserListBo.InsertOrUpdate(ur);

            return Json(data);
        }
        public ActionResult DelAllVersions()
        {
            var vmobject = new JsonReturnMessages();
            try
            {
                SearchVersionTrack search = new SearchVersionTrack();
                search.PluginCode = Constants.UpdaterCode;
                var p = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                ArrayList arr = new ArrayList();
                arr.Add(p.VersionId.ToString());
                BoFactory.GetVersionTrackBo.DelAllVersionByMain(arr);
                vmobject.IsSuccess = true;
            }
            catch (Exception e)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = e.Message;
            }

            return Json(vmobject);
        }
        public ActionResult AddSomeUserInfos(string id, string pid)
        {
            var vmobject = new JsonReturnMessages();
            try
            {
                if (!string.IsNullOrEmpty(id))
                {
                    string[] idsArray = id.Split(',');
                    IList<UserPluginRef> list = new List<UserPluginRef>();

                    for (int i = 0; i < idsArray.Length; i++)
                    {
                        var item = idsArray[i];
                        if (!string.IsNullOrEmpty(item))
                        {
                            UserPluginRef c = new UserPluginRef();
                            c.UserUId = Convert.ToString(item);
                            c.PluginCode = pid;
                            list.Add(c);
                        }

                    }
                    BoFactory.GetVersionTrackBo.InsertUserRef(list);
                    vmobject.IsSuccess = true;
                    vmobject.Msg = "�����ɹ�!";
                }
                else
                {
                    vmobject.IsSuccess = false;
                    vmobject.Msg = "��û��ѡ��";
                }
            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = ex.Message;
            }
            return Json(vmobject);
        }
        public ActionResult DelSomeConfigInfos(string id)
        {
            var vmobject = new JsonReturnMessages();
            try
            {
                if (!string.IsNullOrEmpty(id))
                {
                    string[] idsArray = id.Split(',');
                    IList<ConfigInfo> list = new List<ConfigInfo>();

                    for (int i = 0; i < idsArray.Length; i++)
                    {
                        var item = idsArray[i];
                        if (!string.IsNullOrEmpty(item))
                        {
                            ConfigInfo c = new ConfigInfo();
                            c.ConfigId = Convert.ToString(item);
                            list.Add(c);
                        }

                    }
                    BoFactory.GetVersionTrackBo.DelConfigInfo(list);
                    vmobject.IsSuccess = true;
                    vmobject.Msg = "�����ɹ�!";
                }
                else
                {
                    vmobject.IsSuccess = false;
                    vmobject.Msg = "��û��ѡ��";
                }
            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = ex.Message;
            }
            return Json(vmobject);
        }
 public JsonResult PublicSkin(FormCollection form)
 {
     string tempSkinRoot = System.IO.Path.Combine(Server.MapPath("/"), @"res_temp\themes");
     JsonReturnMessages result = new JsonReturnMessages();
     try
     {
         //初始化发布器
         var publicor = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
         var smartBoxInfo = SmartBox.Console.Bo.BoFactory.GetVersionTrackBo.GetCurrentSmartBoxInfo();
         //SmartBox根路径
         string smartBoxRootPath = smartBoxInfo.FilePath;  //@"D:\WorkPlace\SmartBox2\SmartBox.Console\SmartBox.Console\SmartBox.Console.Web\MainSystem\SmartBox\SmartBox_1";
         if (string.IsNullOrEmpty(smartBoxRootPath) || !System.IO.Directory.Exists(smartBoxRootPath))
             throw new Exception("SmartBox主程序未发布!");
         string skinPubFolder = System.IO.Path.Combine(smartBoxRootPath, @"res\themes");
         if (!System.IO.Directory.Exists(tempSkinRoot) || System.IO.Directory.GetDirectories(tempSkinRoot).Length == 0)
         {
             throw new Exception("未上传皮肤");
         }
         else
         {
             if (!System.IO.Directory.Exists(skinPubFolder))
                 System.IO.Directory.CreateDirectory(skinPubFolder);
             Beyondbit.AutoUpdate.FileHelper.MergeCopyDir(tempSkinRoot, skinPubFolder);
             //删除临时数据
             Directory.Delete(tempSkinRoot,true);
             result.IsSuccess = true;
             result.Msg = "发布成功!";
         }
         //更新SmartBox主程序
         publicor.UpdateApplication(smartBoxRootPath, "smartbox");
     }
     catch (Exception ex)
     {
         result.IsSuccess = false;
         result.Msg = "发布失败,"+ex.Message;
     }
     return Json(result, "text/html");
 }
        public ActionResult AddModifyRoleSave(int Role_ID, string Unit_ID, string Role_Name, int Role_Sequence, string Role_Demo)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
            SMC_Role role = null;
            if (Role_ID == 0)
            {
                role = new SMC_Role();
                role.Role_CreatedTime = DateTime.Now;
            }
            else
            {
                role = BoFactory.GetSMC_RoleBo.Get(Role_ID);
            }

            role.Role_ID = Role_ID;
            role.Unit_ID = Unit_ID;
            role.Role_Name = Role_Name;
            role.Role_Sequence = Role_Sequence;
            role.Role_Demo = Role_Demo;

            BoFactory.GetSMC_RoleBo.InsertOrUpdate(role);

            return Json(data);
        }
 public JsonResult UpdateImage(FormCollection form)
 {
     JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg="上传成功" };
     try
     {
         var file = Request.Files[0];
         string fileName = System.IO.Path.GetExtension(file.FileName).ToLower();
         if (!".jpg".Equals(fileName) &&
             !".jpeg".Equals(fileName) &&
             !".gif".Equals(fileName) &&
             !".png".Equals(fileName) &&
             !".bmp".Equals(fileName))
         {
             throw new Exception("请上传图片文件");
         }
         BoFactory.GetVersionTrackBo.InsertImage(file.InputStream);
     }
     catch (Exception ex)
     {
         data.IsSuccess = false;
         data.Msg = ex.Message;
     }
     return Json(data, "text/html");
 }
        public ActionResult AddModifyFunctionSave(string FN_ID, string Unit_ID, string FN_Code, string Upper_FN_ID,string Upper_FN_Name, string fn_type, string fn_disabled, string fn_visibletype, string FN_Name, string FN_Url, int FN_Sequence, string FN_Demo)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
            if (BoFactory.GetSMC_FunctionsBo.ExistsByCode(FN_Code) && int.Parse(FN_ID) == 0)
            {
                data = new JsonReturnMessages() { IsSuccess = false, Msg = "权限Code已经存在!" };
                return Json(data);
            }

            SMC_Functions func = null;
            if (FN_ID == "0" || String.IsNullOrEmpty(FN_ID))
            {
                func = new SMC_Functions();
                func.FN_CreatedTime = DateTime.Now;
            }
            else
            {
                func = BoFactory.GetSMC_FunctionsBo.Get(int.Parse(FN_ID));
            }
            func.FN_VisibleType = fn_visibletype;
            func.FN_Disabled = fn_disabled == "1" ? true : false;
            func.FN_Demo = FN_Demo;
            func.FN_Name = FN_Name;
            func.FN_Code = FN_Code;
            func.FN_Sequence = FN_Sequence;
            int upper_fn_id = 0;
            if (!String.IsNullOrEmpty(Upper_FN_Name))
                upper_fn_id = int.Parse(Upper_FN_Name);
            //int unit_id = 0;
            //if (!String.IsNullOrEmpty(Unit_ID))
            //    unit_id = int.Parse(Unit_ID);

            func.Upper_FN_ID = upper_fn_id;
            func.FN_ID = int.Parse(FN_ID);
            func.FN_Url = FN_Url;
            func.FN_Type = fn_type;
            func.Unit_ID = Unit_ID;

            BoFactory.GetSMC_FunctionsBo.InsertOrUpdate(func);

            string saveDir = HttpRuntime.AppDomainAppPath + AppConfig.FuncIconFolder;
            string savePath = "";
            if (Request.Files.Count > 0)
            {
                if (Request.Files[0].ContentLength > 0)
                {
                    //有小图标文件
                    string fileName = func.FN_ID.ToString() + "_SIcon.png";
                    savePath = System.IO.Path.Combine(saveDir, fileName);
                    if (!System.IO.Directory.Exists(saveDir))
                    {
                        System.IO.Directory.CreateDirectory(saveDir);
                    }
                    if (System.IO.File.Exists(savePath))
                    {
                        System.IO.File.Delete(savePath);
                    }
                    Request.Files[0].SaveAs(savePath);
                }
                if (Request.Files[1].ContentLength > 0)
                {
                    //有图标文件
                    string fileName = func.FN_ID.ToString() + "_Icon.png";
                    savePath = System.IO.Path.Combine(saveDir, fileName);
                    if (!System.IO.Directory.Exists(saveDir))
                    {
                        System.IO.Directory.CreateDirectory(saveDir);
                    }
                    if (System.IO.File.Exists(savePath))
                    {
                        System.IO.File.Delete(savePath);
                    }
                    Request.Files[1].SaveAs(savePath);
                }
            }

            return Json(data, "text/html");
        }
        public ActionResult DelUser(int ul_id)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
            SMC_UserList ur = BoFactory.GetSMC_UserListBo.Get(ul_id);
            if (ur != null && CurrentUser.UserUId != ur.UL_UID)
            {
                BoFactory.GetSMC_UserListBo.Delete(ur);
            }
            else
            {
                data.IsSuccess = false;
                data.Msg = "不能删除自己的账号";
            }

            return Json(data);
        }
        public ActionResult DelUnit(string unit_id)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
            SMC_Unit unit = BoFactory.GetSMC_UnitBo.Get(unit_id);
            if (unit != null)
            {
                //判断是否被关联引用
                PageView view = new PageView();
                view.PageIndex = 0;
                view.PageSize = 15;

                //看是否有下级组织机构
                var units = BoFactory.GetSMC_UnitBo.QueryUnitByUpperUnitCode(view,unit_id);
                if (units.total > 0)
                {
                    data.IsSuccess = false;
                    data.Msg = "该组织存在下级组织,请先删除下级组织后再执行此操作!";
                    return Json(data);
                }

                var rel = BoFactory.GetSMC_RoleBo.QueryRolesByUnitID(view,unit_id);
                if (rel.total > 0)
                {
                    data.IsSuccess = false;
                    data.Msg = "有角色的组织不能删除,请先删除组织下的角色后再执行此操作!";
                    return Json(data);
                }
                else
                {
                    rel = BoFactory.GetSMC_UserListBo.QueryUserListByUnitID(view,unit_id);
                    if (rel.total > 0)
                    {
                        data.IsSuccess = false;
                        data.Msg = "有用户的组织不能删除,请先删除组织下的用户后再执行此操作!";
                        return Json(data);
                    }
                }

            }
            else
            {
                data.IsSuccess = false;
                data.Msg = "组织不存在";
            }

            try
            {
                //从同意授权
                Beyondbit.BUA.Client.IOrgService os = Beyondbit.BUA.Client.ServiceFactory.Instance().GetOrgService();
                os.DelOrg(unit_id);

            }
            catch (Exception e)
            {
                //ata.IsSuccess = false;
                //data.Msg = e.Message;
            }

            if (unit != null)
            {
                BoFactory.GetSMC_UnitBo.Delete(unit);
            }

            return Json(data);
        }
        public ActionResult DelRole(int role_id)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
            SMC_Role role = BoFactory.GetSMC_RoleBo.Get(role_id);

            if (role != null)
            {
                //判断是否被关联引用
                PageView view = new PageView();
                view.PageIndex = 0;
                view.PageSize = 15;

                var rel=BoFactory.GetSMC_UserListBo.QueryUserListHasRole(view, role_id);
                if (rel.total > 0)
                {
                    data.IsSuccess = false;
                    data.Msg = "角色已经分配给用户,请先取消分配关系!";
                    return Json(data);
                }
                else
                {
                    if (BoFactory.GetSMC_FunctionRoleBo.IsFuncAssigned(role_id))
                    {
                        data.IsSuccess = false;
                        data.Msg = "角色已经分配了权限,请先取消分配关系!";
                        return Json(data);
                    }
                }
            }
            else
            {
                data.IsSuccess = false;
                data.Msg = "角色不存在";
            }
            if (role != null)
            {
                //BoFactory.GetSMC_UserListBo.DeleteByRoleID(role_id);
                BoFactory.GetSMC_RoleBo.Delete(role);
            }
            return Json(data);
        }
        public ActionResult DelFunction(int fn_id)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
            SMC_Functions fn = BoFactory.GetSMC_FunctionsBo.Get(fn_id);

            //判断权限是否有下一级权限,如有则不能删除
            var func=BoFactory.GetSMC_FunctionsBo.GetFunctionsByUpperId(fn_id);
            int i = func.Count;

            //判断有否有角色关联
            //BoFactory.GetSMC_FunctionsBo.QueryFunctionsByRoleID

            if (i > 0)
            {
                data.IsSuccess = false;
                data.Msg = "已有下级权限,请先删除下级权限!";
            }else
            if (fn != null)
            {
                BoFactory.GetSMC_FunctionRoleBo.DeleteByFID(fn_id);
                BoFactory.GetSMC_FunctionsBo.Delete(fn);

                //删除图标
                string saveDir = HttpRuntime.AppDomainAppPath + AppConfig.FuncIconFolder;
                string savePath = "";
                string fileName = fn_id.ToString() + "_SIcon.png";
                savePath = System.IO.Path.Combine(saveDir, fileName);
                if (System.IO.File.Exists(savePath))
                {
                    System.IO.File.Delete(savePath);
                }
                fileName = fn_id.ToString() + "_Icon.png";
                savePath = System.IO.Path.Combine(saveDir, fileName);
                if (System.IO.File.Exists(savePath))
                {
                    System.IO.File.Delete(savePath);
                }

            }
            return Json(data);
        }
        public ActionResult AddModifyUnitSave(string Unit_ID, string Upper_Unit_ID, string Unit_Name, int Unit_Sequence, string Unit_Demo)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
            SMC_Unit unit = null;
            if (String.IsNullOrEmpty(Unit_ID))
            {
                unit = new SMC_Unit();
                unit.Unit_CreatedTime = DateTime.Now;
            }
            else
            {
                unit = BoFactory.GetSMC_UnitBo.Get(Unit_ID);
            }
            unit.Unit_Demo = Unit_Demo;
            unit.Unit_Name = Unit_Name;
            unit.Unit_Sequence = Unit_Sequence;
            unit.Upper_Unit_ID = Upper_Unit_ID;
            unit.Unit_ID = Unit_ID;

            try
            {
                BoFactory.GetSMC_UnitBo.InsertOrUpdate(unit);
            }
            catch (Exception ex)
            {
                data.IsSuccess = false;
                data.Msg = ex.Message;
                return Json(data);
            }

            SMC_Unit _old_unit = unit;

            string pathString = unit.Unit_ID.ToString();
            while (unit != null && !String.IsNullOrEmpty(unit.Upper_Unit_ID))
            {
                pathString = unit.Upper_Unit_ID + ".." + pathString;
                if (String.IsNullOrEmpty(unit.Upper_Unit_ID))
                    unit = null;
                else
                    unit = BoFactory.GetSMC_UnitBo.Get(unit.Upper_Unit_ID);
            }
            _old_unit.Unit_Path = pathString;
            BoFactory.GetSMC_UnitBo.InsertOrUpdate(_old_unit);

            return Json(data);
        }
 public ActionResult SetDisableStatus(string pid, string status, FormCollection form)
 {
     var vmobject = new JsonReturnMessages();
     try
     {
         BoFactory.GetVersionTrackBo.UpdateStatusByPlugin(pid, Convert.ToBoolean(Convert.ToInt32(status)));
         vmobject.IsSuccess = true;
         vmobject.Msg = "�����ɹ�!";
     }
     catch (Exception ex)
     {
         vmobject.IsSuccess = false;
         vmobject.Msg = ex.Message;
     }
     return Json(vmobject);
 }
        public JsonResult EditIOSOutsideApp(IOSOutsideApp webApplication)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
            webApplication.UpdateTime = DateTime.Now;
            webApplication.UpdateUid = CurrentUser.UserUId;
            try
            {
                if (string.IsNullOrEmpty(Convert.ToString(webApplication.ID)) || webApplication.ID == 0)
                {//新增
                    webApplication.CreateTime = DateTime.Now;
                    webApplication.CreateUid = CurrentUser.UserUId;
                    BoFactory.GetVersionTrackBo.InsertIOSOutSideApp(webApplication);
                }
                else
                {
                    BoFactory.GetVersionTrackBo.UpdateIOSOutSideApp(webApplication);
                }

                SMC_PackageExt packageExt = new SMC_PackageExt();
                packageExt.pe_id = BoFactory.GetVersionTrackBo.GetMaxPackageExtId() + 1;
                packageExt.pe_ClientType = webApplication.ClientType;

                packageExt.pe_IsTJ = Request.Form["IsRecom"];
                packageExt.pe_IsBB = Request.Form["IsMust"];
                //FileInfo fi = new FileInfo(saveFilePath);
                packageExt.pe_Size = 0;// (int)fi.Length;
                packageExt.TableName = "IOSOutsideApplication";
                packageExt.TableID = webApplication.ID;
                packageExt.pe_UnitCode = Request.Form["Unit"];
                packageExt.pe_CategoryID = Request.Form["Cate"];
                packageExt.pe_Category = BoFactory.GetVersionTrackBo.GetApplicationCategory(Request.Form["Cate"]).DisplayName;
                packageExt.pe_ApplicationCode = Request.Form["AppID"];

                if (!String.IsNullOrEmpty(packageExt.pe_ApplicationCode))
                {
                    string[] appIds = packageExt.pe_ApplicationCode.Split(",".ToCharArray());
                    string appNames = "";
                    foreach (string appid in appIds)
                    {
                        Application application = Bo.BoFactory.GetVersionTrackBo.GetApplication(appid);
                        if (application != null)
                        {
                            appNames += application.DisplayName + ",";
                        }
                    }
                    packageExt.pe_ApplicationName = appNames;
                }

                packageExt.pe_UnitName = BoFactory.GetSMC_UnitBo.Get(packageExt.pe_UnitCode).Unit_Name;
                packageExt.pe_CreateUid = CurrentUser.UserUId;
                packageExt.pe_CreatedTime = DateTime.Now;
                packageExt.pe_UpdateUid = CurrentUser.UserUId;
                packageExt.pe_UpdateTime = DateTime.Now;
                packageExt.pe_Version = Request.Form["Version"];// form["packageVersion"];
                packageExt.pe_BuildVer = Request.Form["BuildVer"];// form["packageBuildVer"];
                packageExt.pe_Name = Request.Form["DisplayName"];// form["packageDisplayName"];
                packageExt.pe_DisplayName = Request.Form["DisplayName"];// form["packageDisplayName"];
                packageExt.pe_Description = "";// form["packageDescription"];
                packageExt.pe_Firmware = Request.Form["Firmware"];
                packageExt.pe_DownloadUri = Request.Form["Uri"];

                string conSolePath = HttpRuntime.AppDomainAppPath;//服务器路径
                string pDir = SAVEOUTPATH + @"\" + packageExt.pe_id.ToString();//相对路径 用安装包ID做文件夹名
                string saveDir = conSolePath + pDir;

                //生成下载url,并生成二维码
                string url = packageExt.pe_DownloadUri;
                string uri = base.Save2DPicture(packageExt.pe_id, url);
                packageExt.pe_2dPictureUrl = uri;

                int i = Request.Files.Count;
                string iconSavePath = "";
                if (i > 0)
                {
                    //保存安装包图标
                    HttpPostedFileBase icon = Request.Files[0];
                    string iconFileName = "AppIcon.png";
                    iconSavePath = System.IO.Path.Combine(saveDir, iconFileName);
                    if (System.IO.File.Exists(iconSavePath))
                    {
                        System.IO.File.Delete(iconSavePath);
                    }
                    icon.SaveAs(iconSavePath);

                    packageExt.pe_PictureUrl = @"~/" + pDir + "/AppIcon.png";
                    packageExt.pe_PictureUrl = packageExt.pe_PictureUrl.Replace(@"\\", "/");
                }

                GlobalParam parm = Bo.BoFactory.GetGlobalParamBO.GetGlobalParam("app_sj_need_auth");
                if (parm.ConfigValue == "1")
                {
                    //需要审核
                    packageExt.pe_AuthStatus = 0;//待审核
                    packageExt.pe_AuthSubmitTime = DateTime.Now;
                    packageExt.pe_AuthSubmitName = CurrentUser.FullName;
                    packageExt.pe_AuthSubmitUID = CurrentUser.UserUId;
                    packageExt.pe_Direction = "发布";
                    packageExt.pe_Type = "ios_out";
                    packageExt.pe_UsefulStstus = "0";
                    packageExt.pe_UsefulTime = DateTime.Now;
                    packageExt.pe_UsefulOperatorUID = CurrentUser.UserUId;
                    packageExt.pe_UsefulOperatorName = CurrentUser.FullName;
                }
                else
                {
                    packageExt.pe_AuthStatus = 1;//审核通过
                    packageExt.pe_AuthSubmitTime = DateTime.Now;
                    packageExt.pe_AuthTime = DateTime.Now;
                    packageExt.pe_AuthSubmitName = CurrentUser.FullName;
                    packageExt.pe_AuthSubmitUID = CurrentUser.UserUId;
                    packageExt.pe_AuthManUID = CurrentUser.UserUId;
                    packageExt.pe_AuthMan = CurrentUser.FullName;
                    packageExt.pe_SyncStatus = 0;
                    packageExt.pe_Direction = "发布";
                    packageExt.pe_Type = "ios_out";
                    packageExt.pe_UsefulStstus = "1";
                    packageExt.pe_UsefulTime = DateTime.Now;
                    packageExt.pe_UsefulOperatorUID = CurrentUser.UserUId;
                    packageExt.pe_UsefulOperatorName = CurrentUser.FullName;
                }

                BoFactory.GetVersionTrackBo.InsertPackageExt(packageExt);
                if (parm.ConfigValue == "0")
                {
                    //不需要审核,直接同步到应用中心
                    //同步至外网数据
                    _SyncPackageExt(packageExt);
                }
            }
            catch (Exception ex)
            {
                data.IsSuccess = false;
                data.Msg = ex.Message.Replace("'", "`");
                Log4NetHelper.Error(ex);
            }
            return Json(data);
        }
        public ActionResult ResumeVersions(string vid)
        {
            var vmobject = new JsonReturnMessages();
            try
            {
                SearchVersionTrack searchv = new SearchVersionTrack();
                searchv.VID = vid;
                var p = BoFactory.GetVersionTrackBo.GetVersionTrack(searchv)[0];
                if (p.VersionStatus != 2)
                {
                    vmobject.IsSuccess = false;
                    vmobject.Msg = "��ǰΪ�ѷ����İ汾���߻�δ������,��ѡ����ڰ汾!";
                }
                ArrayList arr = new ArrayList();
                arr.Add(vid);

                BoFactory.GetVersionTrackBo.ResumeExpiredVesionByUpdater(arr);
                vmobject.IsSuccess = true;
            }
            catch (Exception e)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = e.Message;
            }

            return Json(vmobject);
        }
        public ActionResult SaveConfigInfo(FormCollection form, string Vid)
        {
            var vmobject = new JsonReturnMessages();
            try
            {
                IList<ConfigInfo> list = new List<ConfigInfo>();
                string[] keys = form.AllKeys;
                for (int i = 0; i < keys.Length; i++)
                {
                    if (keys[i].EndsWith(".Key1"))
                    {
                        ConfigInfo config = new ConfigInfo();
                        string prefix = keys[i].Split('.')[0];
                        UpdateModel(config, prefix);  //��������ͬʱ���Ի������ʵ�����
                        config.PluginCode = Constants.UpdaterCode;
                        list.Add(config);
                    }
                }
                //����
                BoFactory.GetVersionTrackBo.UpdateUpdaterConfigInfos(list);//����

                InsertConfigXml(Vid);//����config

                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = Vid;
                VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                string[] codes = v.FilePath.Split(new string[] { "\\" }, StringSplitOptions.None);
                string name = codes[codes.Length - 2];//��ȡ���code

                Beyondbit.AutoUpdate.IPublisher pub = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
                if (Directory.Exists(Path.Combine(AppConfig.pubFolder, name + AppConfig.subFix)))//������ڴ��ļ���
                    pub.UpdateApplication(v.FilePath, name);
                else
                    pub.CreateApplication(v.FilePath, name);

                vmobject.IsSuccess = true;
                vmobject.Msg = "�����ɹ�";

            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = ex.Message;
            }
            return Json(vmobject);
        }
        public ActionResult JobCommandCtrl(FormCollection form)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "" };
            string s1 = form["JosType"];
            string s2 = form["ComdArgs"];
            string spd_id = form["pd_id"];
            int pd_id = 0;
            if (!String.IsNullOrEmpty(spd_id)) {
                pd_id = int.Parse(spd_id);
            }
            SMC_PushDll dll = BoFactory.GetSMC_PushDllBO.Get(pd_id);
            s2 = dll.pd_xml_filename + ".xml" + s2;
            string rtv = "";

            if (s1 == "AddJobPluginGroup")
            {
                TransferFile(dll);
            }
            if (s1 != "" && s2 != "")
            {
                try
                {
                    CommandSvcClient cmdClient = new CommandSvcClient();

                    rtv = cmdClient.ExecCommand(s1, s2);

                    if (rtv == "文件名参数不正确,请重试!")
                    {
                        data.IsSuccess = false;
                        data.Msg = rtv;
                    }
                    cmdClient.Close();
                }
                catch (Exception e)
                {
                    data.IsSuccess = false;
                    data.Msg = e.Message;
                }
                if (data.IsSuccess)
                {
                    data.Msg = rtv;
                }

                changeDllStatus(dll, s1, data.IsSuccess);
            }
            else
            {
                data.Msg = "请选择任务类型和输入参数文件名!";
            }

            return Json(data);
        }
        public ActionResult SavePluginInfos(FormCollection form, ConfigTemp c, string IsAdd)
        {
            var vmobject = new JsonReturnMessages();
            IList<ConfigTemp> list = new List<ConfigTemp>();

            try
            {
                string[] keys = form.AllKeys;
                //��ȡ�б����
                for (int i = 0; i < keys.Length; i++)
                {
                    if (keys[i].EndsWith(".Key1"))
                    {
                        ConfigTemp config = new ConfigTemp();
                        string prefix = keys[i].Split('.')[0];
                        UpdateModel(config, prefix);  //��������ͬʱ���Ի������ʵ�����
                        config.PluginCode = Constants.UpdaterCode;
                        list.Add(config);
                    }
                }

                BoFactory.GetVersionTrackBo.UpdateUpdaterTempPlugin(list, base.CurrentUser.UserUId);
            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = ex.Message;
                return Json(vmobject);
            }

            vmobject.IsSuccess = true;
            vmobject.Msg = form["ver"].ToString();
            return Json(vmobject);
        }
        public ActionResult SaveFileInfo(VersionTrack ver, string IsAdd, string IsUpdate, FormCollection form)
        {
            var vmobject = new JsonReturnMessages();
            string vid = form["VersionIds"].ToString();
            XmlMainConfigInfo xmlInfo = null;

            try
            {
                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = vid;
                VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                if (Request.Files.Count > 0)//�����ϴ��ļ�
                    xmlInfo = Decompressing(v.VersionName);//��ѹ

                vid = BoFactory.GetVersionTrackBo.SaveUpdaterZipInfo(ver, xmlInfo, IsAdd, IsUpdate, base.CurrentUser.UserUId, form["VersionIds"].ToString());

                if (Request.Files.Count > 0)//�����ϴ��ļ�
                    MoveFolder(xmlInfo, v.VersionName);//�ƶ��ļ��м��ļ�
            }
            catch (Exception ex)
            {
                try
                {
                    string thisFilePath = AppConfig.filePath + Common.Entities.Constants.TempName;
                    while (Directory.Exists(thisFilePath))//��ɾ��ԭ����ʱ�ļ���
                    {
                        Directory.Delete(thisFilePath, true);
                    }
                    if (!string.IsNullOrEmpty(xmlInfo.savefile))
                    {
                        FileInfo f = new FileInfo(xmlInfo.savefile);//ɾ��ԭ�������zip
                        if (f.Exists)
                            f.Delete();
                    }
                }
                catch (Exception fe)
                {
                    vmobject.IsSuccess = false;
                    vmobject.Msg = fe.Message;
                }

                vmobject.IsSuccess = false;
                vmobject.Msg = vmobject.Msg + "," + ex.Message;
                return Json(vmobject, "text/html");
            }

            vmobject.Msg = vid;
            vmobject.IsSuccess = true;
            return Json(vmobject, "text/html");
        }
        public ActionResult SavePublishInfo(string Vid, FormCollection form)
        {
            var vmobject = new JsonReturnMessages();
            try
            {
                XmlMainConfigInfo x = InsertXml(Vid);//�XML
                SearchVersionTrack search = new SearchVersionTrack();
                search.VID = Vid;
                VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                string[] codes = v.FilePath.Split(new string[] { "\\" }, StringSplitOptions.None);
                string name = codes[codes.Length - 2];//��ȡ���code

                Beyondbit.AutoUpdate.IPublisher pub = new Beyondbit.SmartBox.Publisher.SmartBoxPublisher();
                if (Directory.Exists(Path.Combine(AppConfig.pubFolder ,name + AppConfig.subFix)))//������ڴ��ļ���
                    pub.UpdateApplication(v.FilePath, name);
                else
                    pub.CreateApplication(v.FilePath, name);

                BoFactory.GetVersionTrackBo.UpdateUpdaterPlushVersionTracks(x, Vid, base.CurrentUser.UserUId);//����״̬

                vmobject.IsSuccess = true;
                vmobject.Msg = "�����ɹ�";
            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = ex.Message;
            }

            return Json(vmobject);
        }
        public ActionResult SaveVersions(string IsAdd, string IsUpdate, string Vid, VersionTrack version, FormCollection form)
        {
            var vmobject = new JsonReturnMessages();
            string vid = "";
            try
            {
                vid = BoFactory.GetVersionTrackBo.SaveUpdaterVerInfo(version, IsAdd, IsUpdate, base.CurrentUser.UserUId, Vid);
            }
            catch (Exception ex)
            {
                vmobject.IsSuccess = false;
                vmobject.Msg = ex.Message;
                return Json(vmobject, "text/html");
            }

            vmobject.Msg = vid;
            vmobject.IsSuccess = true;
            return Json(vmobject, "text/html");
        }