コード例 #1
0
 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);
 }
コード例 #2
0
        public ActionResult AddConfigInfo(string id, string pid)
        {
            ConfigInfo CInfo = null;
            if (string.IsNullOrEmpty(id))//id=cofingId
                CInfo = new ConfigInfo();
            else
                CInfo = BoFactory.GetVersionTrackBo.GetConfigInfoById(id);

            IList<ConfigCategory> list = BoFactory.GetVersionTrackBo.GetMainCategoryList();//��ȡ���������÷�����Ϣ
            if (list != null)
            {
                if (list.Count > 0)
                {
                    IResourceData[] datas = new IResourceData[list.Count];
                    for (int i = 0; i < list.Count; i++)
                    {
                        datas[i] = ResourceDataFactory.GetResourceDataInstance();
                        datas[i].Code = list[i].ConfigCategoryCode;
                        datas[i].Name = list[i].DisplayName;
                    }
                    ViewData["list"] = datas;
                }
            }
            ViewData["pid"] = pid;//PluginCode

            return View(CInfo);
        }
コード例 #3
0
        public ActionResult AddConfigInfo(string id, string pid)
        {
            ConfigInfo CInfo = null;
            if (string.IsNullOrEmpty(id))//id=cofingId
                CInfo = new ConfigInfo();
            else
                CInfo = BoFactory.GetVersionTrackBo.GetConfigInfoById(id);

            IResourceData[] datas = new IResourceData[1];
            datas[0] = ResourceDataFactory.GetResourceDataInstance();
            datas[0].Code = "PluginConfig";
            datas[0].Name = "������˲������";
            ViewData["list"] = datas;

            ViewData["pid"] = pid;//pluginId
            return View(CInfo);
        }
コード例 #4
0
        public static ConfigInfo ConvertToConfigInfo(ConfigTemp model)
        {
            ConfigInfo configInfo = new ConfigInfo();

            Type ToModel = configInfo.GetType();
            Type FromModel = model.GetType();
            var fileds = ToModel.GetProperties();
            foreach (var item in fileds)
            {
                object fromValue = Convert.ChangeType(model.GetType().GetProperty(item.Name).GetValue(model, null), item.PropertyType);

                if (fromValue != null)
                {
                    configInfo.GetType().GetProperty(item.Name).SetValue(configInfo, fromValue, null);
                }
            }

            return configInfo;
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        public ActionResult UpdatePluginInfo(string Vid, string IsAdd)
        {
            ViewData["configList"] = 0;
            ViewData["IsAdd"] = IsAdd;
            SearchVersionTrack search = new SearchVersionTrack();
            IList<PluginInfoTemp> plist = new List<PluginInfoTemp>();

            ArrayList arrVid = GetArray(Vid);//����������VID

            foreach (string vid in arrVid)
            {
                search.VID = vid;
                VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];
                PluginInfoTemp p = BoFactory.GetVersionTrackBo.GetPluginTempInfo(v.PluginCode.ToString());

                if (p.IsIgnoreConfig == false)//�������������Ϣ
                {
                    SearchConfig searchc = new SearchConfig();
                    searchc.PluginCode = v.PluginCode.ToString();
                    searchc.ConfigCategoryCode = Constants.configCategory;
                    IList<ConfigInfo> list = BoFactory.GetVersionTrackBo.GetConfigList(searchc);//��ȡԭ�в���

                    Dictionary<string, ConfigInfo> dic = new Dictionary<string, ConfigInfo>();
                    foreach (var item in list)
                    {
                        var key = item.Key1 + "_FG$SP_" + item.PluginCode;
                        ConfigInfo temp = new ConfigInfo();
                        temp.Key1 = item.Key1;
                        temp.OldValue = item.Value1;
                        dic.Add(key, temp);
                    }
                    IList<ConfigTemp> listT = BoFactory.GetVersionTrackBo.GetConfigListTemp(searchc);//������ʱ������
                    foreach (var item in listT)
                    {
                        var key = item.Key1 + "_FG$SP_" + item.PluginCode;
                        if (dic.ContainsKey(key))
                            dic[key].Value1 = item.Value1;
                        else
                        {
                            ConfigInfo temp = new ConfigInfo();
                            temp.Key1 = item.Key1;
                            temp.Value1 = item.Value1;
                            temp.OldValue = "";
                            dic.Add(key, temp);
                        }
                    }
                    p.configList = dic.Values.ToList<ConfigInfo>();
                    ViewData["configList"] = (int)ViewData["configList"] + p.configList.Count;

                    SearchPlugin sh = new SearchPlugin();
                    sh.PluginCateCode = p.PluginCateCode;
                    p.PCname = BoFactory.GetVersionTrackBo.GetPluginCategoryInfos(sh)[0].DisplayName;
                }
                plist.Add(p);
            }
            return View(plist);
        }
コード例 #8
0
        private IList<ConfigInfo> InitConfigs(IList<ConfigInfo> listconfigs)
        {
            ConfigInfo c1 = new ConfigInfo();
            c1.Key1 = "";
            c1.ConfigCategoryCode = Constants.SystemConfig;
            listconfigs.Add(c1);
            ConfigInfo c2 = new ConfigInfo();
            c2.Key1 = "";
            c2.ConfigCategoryCode = Constants.GlobalConfig;
            listconfigs.Add(c2);
            ConfigInfo c3 = new ConfigInfo();
            c3.Key1 = "";
            c3.ConfigCategoryCode = Constants.AppNameConfig;
            listconfigs.Add(c3);

            return listconfigs;
        }
コード例 #9
0
        //�޸�ȫ������
        public ActionResult UpdateGlobalConfigInfo(string id)
        {
            ViewData["vid"] = id;
            IList<PluginInfo> plist = new List<PluginInfo>();
            ViewData["configList"] = 0;

            SearchVersionTrack searchv = new SearchVersionTrack();
            searchv.VID = id;
            //VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(searchv)[0];
            VersionTrack v = new VersionTrack();
            SearchConfig search = new SearchConfig();
            search.PluginCode = Constants.MianName;
            search.ConfigCategoryCode = Constants.GlobalConfig;
            IList<ConfigInfo> listconfigs = BoFactory.GetVersionTrackBo.GetConfigList(search);
            //��ʼ��
            ConfigInfo c2 = new ConfigInfo();
            c2.Key1 = "";
            c2.ConfigCategoryCode = Constants.GlobalConfig;
            listconfigs.Add(c2);

            v.configList = listconfigs;

            IEnumerable<IGrouping<string, ConfigInfo>> listccc = v.configList.GroupBy(T => T.ConfigCategoryCode).ToList();
            ViewData["keys"] = listccc.First().Key;
            ViewData["lists"] = listccc;
            ViewData["configList"] = v.configList.Count;

            return View(v);
        }
コード例 #10
0
 private static IList<ConfigInfo> GetConfigInfoForA(XmlDocument xml, IList<ConfigInfo> list, string cate,string code)
 {
     var configInfonodes = xml.SelectNodes("//appSettings/*");
     ConfigInfo c = null;
     if (configInfonodes == null)
     {
         throw new ArgumentNullException("没有appSettings节点");
     }
     foreach (XmlNode item in configInfonodes)
     {
         c = new ConfigInfo();
         c.Key1 = item.Attributes["key"].Value;
         c.Value1 = item.Attributes["value"].Value;
         c.PluginCode = code;
         c.ConfigCategoryCode = cate;
         list.Add(c);
     }
     return list;
 }
コード例 #11
0
        public virtual void UpdateMainConfigInfos(IList<ConfigInfo> list)
        {
            try
            {
                SearchConfig search = new SearchConfig();
                search.PluginCode = Constants.MianName;
                configInfoDao.DeleteConfigInfo(search);
                //configInfoPCDao.DeleteConfigInfo(search);
                foreach (ConfigInfo c in list)
                {
                    if (string.IsNullOrEmpty(c.Key1))
                        throw new BOException("配置信息中的健值不能为空");
                    SearchConfig searchc = new SearchConfig();
                    searchc.key = c.Key1;
                    searchc.PluginCode = c.PluginCode;
                    searchc.ConfigCategoryCode = c.ConfigCategoryCode;

                    if (searchc.ConfigCategoryCode != "PCGlobalConfig")
                    {
                        IList<ConfigInfo> listc = configInfoDao.GetConfigList(searchc);
                        if (listc != null)
                        {
                            if (listc.Count > 0)
                                throw new BOException("单个插件的关键值不能重复");
                        }
                        configInfoDao.Insert(c);
                    }
                    else
                    {
                        //插入ConfigInfoPC表
                        IList<ConfigInfo> listc = configInfoDao.GetConfigList(searchc);
                        if (listc != null)
                        {
                            if (listc.Count > 0)
                                throw new BOException("单个插件的关键值不能重复");
                        }
                        ConfigInfo pc = new ConfigInfo();
                        pc.ConfigCategoryCode = c.ConfigCategoryCode;
                        pc.Key1 = c.Key1;
                        pc.Value1 = c.Value1;
                        pc.OldValue = c.OldValue;
                        pc.PluginCode = c.PluginCode;
                        pc.UserUId = c.UserUId;
                        pc.Summary = c.Summary;

                        configInfoDao.Insert(pc);
                    }
                }

            }
            catch (DalException ex)
            {
                throw new BOException("更新配置信息出错", ex);
            }
        }
コード例 #12
0
 public virtual void UpdateConfigInfo(ConfigInfo cog)
 {
     try
     {
         configInfoDao.Update(cog);
     }
     catch (DalException ex)
     {
         throw new BOException("修改配置表信息", ex);
     }
 }
コード例 #13
0
 public virtual void SetConfigOfMode(ConfigInfo conf)
 {
     try
     {
         SearchConfig search = new SearchConfig();
         if (string.IsNullOrEmpty(conf.Key1))
             throw new BOException("配置信息中的健值不能为空");
         SearchConfig searchc = new SearchConfig();
         searchc.key = conf.Key1;
         searchc.PluginCode = conf.PluginCode;
         searchc.ConfigCategoryCode = conf.ConfigCategoryCode;
         IList<ConfigInfo> listc = configInfoDao.GetConfigList(searchc);
         if (listc != null)
         {
             if (listc.Count > 0)
             {
                 configInfoDao.Delete(listc[0]);
             }
         }
         configInfoDao.Insert(conf);
     }
     catch (DalException ex)
     {
         throw new BOException("更新配置信息出错", ex);
     }
 }
コード例 #14
0
        private static IList<ConfigInfo> GetPluginConfigListByXml(XmlNode xml)
        {
            var configList = new List<ConfigInfo>();

            var configListNodes = xml.SelectNodes("./Configs/*");
            if (configListNodes == null)
            {
                throw new ArgumentNullException();
            }
            foreach (XmlNode node in configListNodes)
            {
                var key = node.SelectSingleNode("./key");
                var value = node.SelectSingleNode("./value");
                //      var category = node.SelectSingleNode("./category");

                if (key != null && value != null && !string.IsNullOrEmpty(key.InnerText))
                {
                    var config = new ConfigInfo { Key1 = key.InnerText, Value1 = value.InnerText, ConfigCategoryCode = PluginConfigType };
                    configList.Add(config);
                }
            }

            return configList;
        }
コード例 #15
0
 private static IList<ConfigInfo> GetConfigInfoForS(XmlDocument xml, IList<ConfigInfo> list, string cate)
 {
     var configInfonodes = xml.SelectNodes("//SmartBoxConfig/*");
     ConfigInfo c = null;
     if (configInfonodes == null)
     {
         throw new ArgumentNullException("没有SmartBoxConfig节点");
     }
     foreach (XmlNode item in configInfonodes)
     {
         c = new ConfigInfo();
         c.Key1 = GetNodeValue(item.SelectSingleNode("./key"));
         c.Value1 = GetNodeValue(item.SelectSingleNode("./value"));
         c.PluginCode = Constants.MianName;
         c.ConfigCategoryCode = cate;
         list.Add(c);
     }
     return list;
 }
コード例 #16
0
        public ActionResult UpdatePluginInfo(string Vid, string IsAdd)
        {
            ViewData["configList"] = 0;
            ViewData["IsAdd"] = IsAdd;
            SearchVersionTrack search = new SearchVersionTrack();
            search.VID = Vid;
            VersionTrack v = BoFactory.GetVersionTrackBo.GetVersionTrack(search)[0];

            SearchConfig searchc = new SearchConfig();
            searchc.PluginCode = v.PluginCode.ToString();
            searchc.ConfigCategoryCode = Constants.UpdaterConfig;
            IList<ConfigInfo> list = BoFactory.GetVersionTrackBo.GetConfigList(searchc);//��ȡԭ�в���

            Dictionary<string, ConfigInfo> dic = new Dictionary<string, ConfigInfo>();
            foreach (var item in list)
            {
                var key = item.Key1 + "_FG$SP_" + item.PluginCode + "_FG$SP_" + item.ConfigCategoryCode;
                ConfigInfo temp = new ConfigInfo();
                temp.Key1 = item.Key1;
                temp.OldValue = item.Value1;
                temp.ConfigCategoryCode = item.ConfigCategoryCode;
                temp.PluginCode = Constants.UpdaterCode;
                dic.Add(key, temp);
            }
            IList<ConfigTemp> listT = BoFactory.GetVersionTrackBo.GetConfigListTemp(searchc);//������ʱ������
            foreach (var item in listT)
            {
                var key = item.Key1 + "_FG$SP_" + item.PluginCode + "_FG$SP_" + item.ConfigCategoryCode;
                if (dic.ContainsKey(key))
                    dic[key].Value1 = item.Value1;
                else
                {
                    ConfigInfo temp = new ConfigInfo();
                    temp.Key1 = item.Key1;
                    temp.Value1 = item.Value1;
                    temp.OldValue = "";
                    temp.PluginCode = Constants.UpdaterCode;
                    temp.ConfigCategoryCode = item.ConfigCategoryCode;
                    dic.Add(key, temp);
                }
            }

            IList<ConfigInfo> listconfigs = dic.Values.ToList<ConfigInfo>();
            listconfigs = InitConfigs(listconfigs);//��ʼ��
            v.configList = listconfigs;

            IEnumerable<IGrouping<string, ConfigInfo>> listccc = v.configList.GroupBy(T => T.ConfigCategoryCode).ToList();
            listccc = listccc.OrderBy(T => T.Key);
            ViewData["keys"] = listccc.First().Key;
            ViewData["lists"] = listccc;
            ViewData["configList"] = v.configList.Count;

            return View(v);
        }
コード例 #17
0
        private IList<ConfigInfo> InitConfigs(IList<ConfigInfo> listconfigs)
        {
            ConfigInfo c1 = new ConfigInfo();
            c1.Key1 = "";
            c1.ConfigCategoryCode = Constants.UpdaterConfig;
            listconfigs.Add(c1);

            return listconfigs;
        }
コード例 #18
0
        public JsonResult SetMode(string Mode)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "设置成功" };
            try
            {
                ConfigInfo conf = new ConfigInfo();
                conf.UserUId = CurrentUser.UserUId;
                conf.ConfigCategoryCode = "SysCommonConfig";
                conf.Key1 = "DeviceBindMode";
                conf.Value1 = Mode;
                conf.PluginCode = "smartbox";

                BoFactory.GetVersionTrackBo.SetConfigOfMode(conf);
            }
            catch (Exception ex)
            {
                data.IsSuccess = false;
                data.Msg = ex.Message;
            }
            return Json(data);
        }