public static ConfigInfoPC ConvertToConfigInfoPC(ConfigTemp model)
        {
            ConfigInfoPC configInfo = new ConfigInfoPC();

            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;
        }
        public ActionResult SaveConfigInfo(FormCollection form, string Vid)
        {
            var vmobject = new JsonReturnMessages();
            try
            {
                string type = form["tp"].ToLower();

                if (type == "pc")
                {
                    IList<ConfigInfoPC> list = new List<ConfigInfoPC>();
                    string[] keys = form.AllKeys;

                    for (int i = 0; i < keys.Length; i++)
                    {
                        if (keys[i].EndsWith(".Key1"))
                        {
                            ConfigInfoPC config = new ConfigInfoPC();
                            string prefix = keys[i].Split('.')[0];
                            UpdateModel(config, prefix);  //��������ͬʱ���Ի������ʵ�����
                            config.PluginCode = Constants.MianName;
                            list.Add(config);
                        }
                    }
                    //����
                    BoFactory.GetVersionTrackBo.UpdateMainConfigInfoPCs(list);//����
                    InsertConfigXml(Vid);//����config
                }
                else if (type == "mobile")
                {
                    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.MianName;
                            list.Add(config);
                        }
                    }
                    //����
                    BoFactory.GetVersionTrackBo.UpdateMainConfigInfos(list);//����
                }

                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 virtual void UpdateMainConfigInfoPCs(IList<ConfigInfoPC> list)
        {
            try
            {
                ConfigInfoPCDao configInfoDao = new ConfigInfoPCDao(AppConfig.mainDbKey);
                SearchConfig search = new SearchConfig();
                search.PluginCode = Constants.MianName;
                //configInfoDao.DeleteConfigInfo(search);
                configInfoPCDao.DeleteConfigInfo(search);
                foreach (ConfigInfoPC 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<ConfigInfoPC> listc = configInfoDao.GetConfigList(searchc);
                        if (listc != null)
                        {
                            if (listc.Count > 0)
                                throw new BOException("单个插件的关键值不能重复");
                        }
                        configInfoDao.Insert(c);
                    }
                    else
                    {
                        //插入ConfigInfoPC表
                        IList<ConfigInfoPC> listc = configInfoPCDao.GetConfigList(searchc);
                        if (listc != null)
                        {
                            if (listc.Count > 0)
                                throw new BOException("单个插件的关键值不能重复");
                        }
                        ConfigInfoPC pc = new ConfigInfoPC();
                        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;

                        configInfoPCDao.Insert(pc);
                    }
                }

            }
            catch (DalException ex)
            {
                throw new BOException("更新配置信息出错", ex);
            }
        }
 private static IList<ConfigInfoPC> GetConfigInfoForS(XmlDocument xml, IList<ConfigInfoPC> list, string cate)
 {
     var configInfonodes = xml.SelectNodes("//SmartBoxConfig/*");
     ConfigInfoPC c = null;
     if (configInfonodes == null)
     {
         throw new ArgumentNullException("没有SmartBoxConfig节点");
     }
     foreach (XmlNode item in configInfonodes)
     {
         c = new ConfigInfoPC();
         c.Key1 = GetNodeValue(item.SelectSingleNode("./key"));
         c.Value1 = GetNodeValue(item.SelectSingleNode("./value"));
         c.PluginCode = Constants.MianName;
         c.ConfigCategoryCode = cate;
         list.Add(c);
     }
     return list;
 }
 private static IList<ConfigInfoPC> GetConfigInfoForA(XmlDocument xml, IList<ConfigInfoPC> list, string cate, string code)
 {
     var configInfonodes = xml.SelectNodes("//appSettings/*");
     ConfigInfoPC c = null;
     if (configInfonodes == null)
     {
         throw new ArgumentNullException("没有appSettings节点");
     }
     foreach (XmlNode item in configInfonodes)
     {
         c = new ConfigInfoPC();
         c.Key1 = item.Attributes["key"].Value;
         c.Value1 = item.Attributes["value"].Value;
         c.PluginCode = code;
         c.ConfigCategoryCode = cate;
         list.Add(c);
     }
     return list;
 }