コード例 #1
0
        public void Set(ScrapParameter param)
        {
            if (!FlowMap.ContainsKey(param.Code))
            {
                throw new ScraperException("Code is not defined. Please check code of parameter. Code : " + param.Code);
            }
            FlowType type = FlowMap[param.Code];

            this.flow      = Activator.CreateInstance(type.Flow, this, param, type.LoginMode) as IScrapFlow;
            this.parameter = param;
            Gecko.LauncherDialog.Download += (sender, e) =>
            {
                String       tempPath  = ConfigSystem.ReadConfig("Config", "Temp", "Path");
                String       file      = Path.Combine(tempPath, DateTime.Now.ToString("yyyyMMddHHmmss") + e.Filename);
                nsILocalFile objTarget = (nsILocalFile)Xpcom.NewNativeLocalFile(file);
                e.HelperAppLauncher.SaveToDisk(objTarget, false);
                Action <String, String> action = flow.DownloadProcedure(e.Url);
                action(e.Url, file);
            };
            timer.Interval = 10 * 1000;
            timer.Tick    += (s, e) =>
            {
                Ping(parameter.Keycode);
            };
            timer.Start();
            this.Navigate(flow.StartPage());
        }
コード例 #2
0
 public Config(ConfigSystem cs, string key, object value)
 {
     ConfigSystemInfo = cs;
     ConfigSystem     = cs.ToString();
     ConfigKey        = key;
     ConfigValue      = value?.ToString().Trim();
 }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: Gz1d/Gz
        public void Changejurisdiction()
        {
            ConfigSystem cfg = ConfigManager.Instance.ConfigSystem;

            MainForm1.mainfrm.Invoke(new EventHandler(delegate
            {
                try {
                    if (cfg.State == 3)//操作员operator无示教和保存参数权限
                    {
                        //VisionTeachBtn.Enabled = false;
                        //VisionParaSaveBtn.Enabled = false;
                        //dataGridView1.Enabled = false;
                        //dataGridView2.Enabled = false;
                    }
                    if (cfg.State == 2)//用户User只能示教熟悉流程,不能保存参数权限
                    {
                        //VisionTeachBtn.Enabled = true;
                        //VisionParaSaveBtn.Enabled = false;
                    }
                    if (cfg.State == 1)//管理员Administrator具有示教和保存参数的权限
                    {
                        //VisionTeachBtn.Enabled = true;
                        //VisionParaSaveBtn.Enabled = true;
                    }
                }
                catch (Exception)
                { }
            }));
        }
コード例 #4
0
    public void BinData()
    {
        Model.Config config       = new Model.Config();
        ConfigSystem configSystem = new ConfigSystem();

        config       = configSystem.Get_Config();
        Content.Text = config.Contact;
    }
コード例 #5
0
ファイル: about.aspx.cs プロジェクト: zhenghua75/kmdx_web
    public void BinData()
    {
        Config       config       = new Config();
        ConfigSystem configSystem = new ConfigSystem();

        config      = configSystem.Get_Config();
        Abouts.Text = config.About;
    }
コード例 #6
0
ファイル: Program.cs プロジェクト: nowonbun/nowonbunstore
 static void Main()
 {
     LoggerBuilder.Init(LogTemplate.GetLogTemp(ConfigSystem.ReadConfig("Config", "Log", "Path"))).Set("Server").Info("Server Program Start");
     FactoryDao.CreateInstance(ConfigSystem.ReadConfig("Config", "DB", "Connection"), ConfigSystem.ReadConfig("Config", "Log", "Path"));
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new MainForm());
 }
コード例 #7
0
        public void Select()
        {
            var dr = DataAccess.Config.GetConfigByID(ConfigSystem.ToString(), ConfigKey);

            if (dr != null)
            {
                InitConfig(dr);
            }
        }
コード例 #8
0
    public void BinData()
    {
        Config       config       = new Config();
        ConfigSystem configSystem = new ConfigSystem();

        config        = configSystem.Get_Config();
        About.Value   = config.About;
        Contact.Value = config.Contact;
    }
コード例 #9
0
        private void button3_Click(object sender, EventArgs e)
        {
            UserLogin frmuser = new UserLogin();

            frmuser.ShowDialog();
            ConfigSystem cfg = ConfigManager.Instance.ConfigSystem;

            label_ShowUserName.Text = cfg.Admin[cfg.State - 1];
        }
コード例 #10
0
        private void UserLogin_Load(object sender, EventArgs e)
        {
            this.CenterToScreen();
            cfg = ConfigManager.Instance.ConfigSystem;

            foreach (string item in cfg.Admin)
            {
                comboBox1.Items.Add(item);
            }
        }
コード例 #11
0
        public void Init()
        {
            adventurerSystemBehaviour = GameObject.FindObjectOfType <AdventurerSystemBehaviour>();
            adventurerSystem          = adventurerSystemBehaviour.system;

            SpawnAgents();

            //Get Adventurer Agent
            getAdventurerAgent = GameObject.FindObjectOfType <GetCurrentAdventurerAgent>();
            adventurerAgent    = getAdventurerAgent.CurrentAgent;

            //Generate travelSubsystem of the adventurerSystem
            travelSubsystem = adventurerSystem.travelSubsystem;
            travelSubsystem.Start();
            adventurerSystem.travelSubsystem = travelSubsystem;

            //Request System
            requestShopSystemBehaviour = GameObject.FindObjectOfType <RequestShopSystemBehaviour>();
            requestShopSystem          = requestShopSystemBehaviour.system;
            requestSystem = requestShopSystem.requestSystem;
            requestSystem.Start();

            //Generate PlayerFighterData of the adventurerAgent
            adventurerAgent.gameObject.GetComponent <AdventurerFighterData>().Start();
            //Generate adventurerInventory of the adventurerAgent
            adventurerInventory = adventurerAgent.adventurerInventory;
            //Generate agentInventory of the adventurerAgent
            adventurerAgentInventory = adventurerAgent.inventory;
            adventurerAgent.ResetEconomyAgent();
            //Generate AdventurerRequestTaker
            adventurerAgent.requestTaker.Start();


            //Get ShopAgent
            getShopAgent = GameObject.FindObjectOfType <GetCurrentShopAgent>();
            shopAgent    = getShopAgent.CurrentAgent;
            shopAgent.shopInput.Awake();
            shopAgent.agentInventory.ResetInventory();
            shopAgent.craftingInventory.ResetInventory();
            shopAgent.wallet.Reset();

            //ShopSystem
            shopCraftingSystemBehaviour = GameObject.FindObjectOfType <ShopCraftingSystemBehaviour>();
            shopCraftingSystemBehaviour.Start();
            agentShopSubSystem = shopCraftingSystemBehaviour.system.shopSubSubSystem;
            craftingSubSystem  = shopCraftingSystemBehaviour.system.craftingSubSubSystem;

            //ResetSystem
            environmentReset = GameObject.FindObjectOfType <EnvironmentReset>();
            environmentReset.Start();

            //Config
            configSystem = GameObject.FindObjectOfType <EconomyProject.Scripts.ConfigSystem>();
            configSystem.Start();
        }
コード例 #12
0
 private static void SaveSettingFile(string filePath)
 {
     if (filePath == null)
     {
         SaveFileDialog saveFileDialog = new SaveFileDialog
         {
             Filter           = "Setting File|config.ini",
             InitialDirectory = AppDomain.CurrentDomain.BaseDirectory
         };
         if (saveFileDialog.ShowDialog() == true)
         {
             SaveSettingFile(saveFileDialog.FileName);
             return;
         }
     }
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionPort, PaymapSettingKeys.IntPortMain, App.PaymapSettings.PortMain.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionPort, PaymapSettingKeys.IntPortRemote, App.PaymapSettings.PortRemote.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionPort, PaymapSettingKeys.IntPortDEVX, App.PaymapSettings.PortDEVX.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionAuth, PaymapSettingKeys.BoolAuthLevel1, App.PaymapSettings.AuthLevel1.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionAuth, PaymapSettingKeys.BoolAuthLevel2, App.PaymapSettings.AuthLevel2.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionAuth, PaymapSettingKeys.BoolAuthLevel3, App.PaymapSettings.AuthLevel3.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionVersion, PaymapSettingKeys.IntVersionLive, App.PaymapSettings.VersionLive.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionVersion, PaymapSettingKeys.IntVersionMin, App.PaymapSettings.VersionMin.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionAuth, PaymapSettingKeys.BoolAuthLevel1, App.PaymapSettings.AuthLevel1.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionThread, PaymapSettingKeys.BoolThreadDashboard, App.PaymapSettings.ThreadSwitchDashboard.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionThread, PaymapSettingKeys.IntThreadIntervalDashboard, App.PaymapSettings.ThreadIntervalDashboard.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionThread, PaymapSettingKeys.BoolThreadDEVX, App.PaymapSettings.ThreadSwitchDEVX.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionThread, PaymapSettingKeys.IntThreadIntervalDEVX, App.PaymapSettings.ThreadIntervalDEVX.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionAPI, PaymapSettingKeys.StringAPIFirebase, App.PaymapSettings.APIFirebase);
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionAPI, PaymapSettingKeys.StringAPICatcher, App.PaymapSettings.APICatcher);
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionAPI, PaymapSettingKeys.StringAPIReviewer, App.PaymapSettings.APIReviewer);
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionDB, PaymapSettingKeys.StringDBAddress, App.PaymapSettings.DBAddress);
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionDB, PaymapSettingKeys.IntDBPort, App.PaymapSettings.DBPort.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionDEVX, PaymapSettingKeys.BoolDEVXMaster, App.PaymapSettings.DEVXMaster.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionDEVX, PaymapSettingKeys.BoolDEVXReport, App.PaymapSettings.DEVXReport.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionDEVX, PaymapSettingKeys.BoolDEVXCommand, App.PaymapSettings.DEVXCommand.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogLevel1, App.PaymapSettings.LogLevel1.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogLevel2, App.PaymapSettings.LogLevel2.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogLevel3, App.PaymapSettings.LogLevel3.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogLevel4, App.PaymapSettings.LogLevel4.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogLevel5, App.PaymapSettings.LogLevel5.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterLevel1, App.PaymapSettings.LogFilterLevel1.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterLevel2, App.PaymapSettings.LogFilterLevel2.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterLevel3, App.PaymapSettings.LogFilterLevel3.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterLevel4, App.PaymapSettings.LogFilterLevel4.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterLevel5, App.PaymapSettings.LogFilterLevel5.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterType1, App.PaymapSettings.LogFilterType1.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterType2, App.PaymapSettings.LogFilterType2.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterType3, App.PaymapSettings.LogFilterType3.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterType4, App.PaymapSettings.LogFilterType4.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterType5, App.PaymapSettings.LogFilterType5.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterType6, App.PaymapSettings.LogFilterType6.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterType7, App.PaymapSettings.LogFilterType7.ToString());
     ConfigSystem.WriteConfig(filePath, PaymapSettingKeys.SectionLog, PaymapSettingKeys.BoolLogFilterType8, App.PaymapSettings.LogFilterType8.ToString());
 }
コード例 #13
0
 protected void UpdateData()
 {
     if (Debug.IsDebug())
     {
         try
         {
             foreach (var item in common_data_list)
             {
                 this.buffer.Append(item.KeyCode).Append("||");
                 this.buffer.Append(item.KeyIndex).Append("||");
                 this.buffer.Append(item.Data).Append("||");
                 this.buffer.Append(item.CreateDate).AppendLine();
             }
             String filepath = Path.Combine(ConfigSystem.ReadConfig("Config", "Temp", "Path"), DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".csv");
             using (FileStream stream = new FileStream(filepath, FileMode.Create, FileAccess.Write))
             {
                 byte[] buffer = Encoding.UTF8.GetBytes(this.buffer.ToString());
                 stream.Write(buffer, 0, buffer.Length);
             }
             logger.Debug("common_data_list - " + filepath);
         }
         finally
         {
             this.buffer.Clear();
         }
         try
         {
             foreach (var item in package_data_list)
             {
                 this.buffer.Append(item.KeyCode).Append("||");
                 this.buffer.Append(item.KeyIndex).Append("||");
                 this.buffer.Append(item.Separation).Append("||");
                 this.buffer.Append(item.Data).Append("||");
                 this.buffer.Append(item.CreateDate).AppendLine();
             }
             String filepath = Path.Combine(ConfigSystem.ReadConfig("Config", "Temp", "Path"), DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".csv");
             using (FileStream stream = new FileStream(filepath, FileMode.Create, FileAccess.Write))
             {
                 byte[] buffer = Encoding.UTF8.GetBytes(this.buffer.ToString());
                 stream.Write(buffer, 0, buffer.Length);
             }
             logger.Debug("package_data_list - " + filepath);
         }
         finally
         {
             this.buffer.Clear();
         }
         Finally();
     }
     else
     {
         commondao.InsertList(common_data_list);
         packagedao.InsertList(package_data_list);
     }
 }
コード例 #14
0
        private void MainForm1_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            dockPanel1.Dock  = DockStyle.Fill;
            ConfigSystem cfg = ConfigManager.Instance.ConfigSystem;

            label_ShowUserName.Text = cfg.Admin[cfg.State - 1];
            mainForm.Show(this.dockPanel1, DockState.Document);
            this.WindowState = FormWindowState.Normal;
            //this.FormClosing += MyFormClosing;
        }
コード例 #15
0
 /// <summary>
 /// Disposes of the object
 /// </summary>
 /// <param name="Managed">
 /// Determines if all objects should be disposed or just managed objects
 /// </param>
 protected override void Dispose(bool Managed)
 {
     if (ConfigSystems != null)
     {
         foreach (IDisposable ConfigSystem in ConfigSystems.OfType <IDisposable>())
         {
             ConfigSystem.Dispose();
         }
         ConfigSystems = null;
     }
 }
コード例 #16
0
 protected void Update_Btn_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         Config config = new Config();
         config.About   = About.Value.ToString();
         config.Contact = Contact.Value.ToString();
         ConfigSystem configSystem = new ConfigSystem();
         configSystem.Update_Config(config);
         Response.Write("<script>alert('修改成功');location.href='Content.aspx';</script>");
     }
 }
コード例 #17
0
        internal ClientConfigurationSystem()
        {
            IConfigSystem configSystem = new ConfigSystem();

            configSystem.Init(typeof(ClientConfigurationHost), null, null);

            _configHost = configSystem.Host;
            _configRoot = configSystem.Root;

            _configRoot.ConfigRemoved += OnConfigRemoved;

            _isAppConfigHttp = ((IInternalConfigHostPaths)_configHost).IsAppConfigHttp;
        }
コード例 #18
0
 public ActionResult Banner()
 {
     languagecode = HttpContext.Request.Cookies["languagecode"];
     if (languagecode != null && languagecode.Value == "en")
     {
         ConfigSystem result = _configService.GetByName("Banneren");
         return(PartialView(result));
     }
     else
     {
         ConfigSystem result = _configService.GetByName("Banner");
         return(PartialView(result));
     }
 }
コード例 #19
0
        public bool Any()
        {
            var sql =
                $"SELECT * FROM {Repository.GetTableAttr<Config>().Name} WHERE ConfigSystem = @configSystem AND ConfigKey = @configKey";

            SqlParameter[] para =
            {
                new SqlParameter("@configSystem", ConfigSystem.ToString()),
                new SqlParameter("@configKey",    ConfigKey)
            };

            var ds = DataAccess.ExecuteDataset(sql, para);

            return(ds.Tables[0].Rows.Count > 0);
        }
コード例 #20
0
        static void Main(string[] args)
        {
            Logger logger = null;

            try
            {
                if (Debug.IsDebug())
                {
                    args = new String[] { Debug.GetDebugKey(), Debug.GetDebugParam() };
                }
                if (args.Length != 2)
                {
                    throw new ScraperException("Parameter Length Error " + args.Length);
                }
                logger = LoggerBuilder.Init(LogTemplate.GetLogTemp(ConfigSystem.ReadConfig("Config", "Log", "WritePath") + "\\" + args[0] + ".log")).Set("Server").Info("Client Program Start");
                logger.Debug("arg[0] : " + args[0]);
                logger.Debug("arg[1] : " + args[1]);
                FactoryDao.CreateInstance(ConfigSystem.ReadConfig("Config", "DB", "Connection"), ConfigSystem.ReadConfig("Config", "Temp", "Path"));
                IScrapingStatusDao dao = FactoryDao.GetInstance().GetDao <IScrapingStatusDao>();
                if (!Debug.IsDebug())
                {
                    ScrapingStatus entity = dao.GetEntity(args[0]);

                    if (entity == null)
                    {
                        throw new ScraperException("Nothing entity " + args[0]);
                    }

                    if (entity.Status != "0")
                    {
                        throw new ScraperException("entity status" + args[0]);
                    }
                    entity.Status = "1";
                    dao.Update(entity);
                }
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new ScraperContext(args[0], args[1]));
            }
            catch (Exception e)
            {
                if (logger != null)
                {
                    logger.Error(e.ToString());
                }
                Exit();
            }
        }
コード例 #21
0
        public void Update(SqlTransaction trans = null)
        {
            Contract.Requires(Any());

            var sql =
                $"UPDATE {Repository.GetTableAttr<Config>().Name} SET ConfigValue = @configValue WHERE ConfigSystem = @configSystem AND ConfigKey = @configKey";

            SqlParameter[] para =
            {
                new SqlParameter("@configSystem", ConfigSystem.ToString()),
                new SqlParameter("@configKey",    ConfigKey),
                new SqlParameter("@configValue",  ConfigValue)
            };

            DataAccess.ExecuteNonQuery(sql, para, trans);
        }
コード例 #22
0
        static void Main()
        {
            string   mtxName = "WebScraping";
            Mutex    mtx     = new Mutex(true, mtxName);
            TimeSpan tsWait  = new TimeSpan(0, 0, 1);
            bool     success = mtx.WaitOne(tsWait);

            if (!success)
            {
                MessageBox.Show("이미실행중입니다.");
                return;
            }
            LoggerBuilder.Init(LogTemplate.GetLogTemp(ConfigSystem.ReadConfig("Config", "Log", "WritePath") + "\\Broker.log"));
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Main());
        }
コード例 #23
0
ファイル: ConfigSystemTools.cs プロジェクト: pointcache/URSA
        public static void LoadSelectedConfig()
        {
            var go = Selection.activeGameObject;

            if (!go)
            {
                return;
            }

            var cfg = go.GetComponent <ConfigBase>();

            if (!cfg)
            {
                return;
            }

            ConfigSystem.TryLoadSingle(cfg);
        }
コード例 #24
0
        static void Main(string[] args)
        {
            Logger logger = null;

            try
            {
                String arg = null;
                if (Debug.IsDebug())
                {
                    arg = Debug.GetDebugParam();
                }
                else
                {
                    if (args.Length != 1)
                    {
                        throw new ScraperException("Parameter Length Error " + args.Length);
                    }
                    byte[] buffer = Convert.FromBase64String(args[0]);
                    arg = Encoding.UTF8.GetString(buffer);
                }
                Parameter param = JsonConvert.DeserializeObject <Parameter>(arg);
                logger = LoggerBuilder.Init(LogTemplate.GetLogTemp(ConfigSystem.ReadConfig("Config", "Log", "WritePath") + "\\" + param.Key + ".log")).Set("Server").Info("Client Program Start");
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                if (Debug.IsDebug())
                {
                    Application.Run(new ScraperForm(param));
                }
                else
                {
                    Application.Run(new ScraperContext(param));
                }
            }
            catch (Exception e)
            {
                if (logger != null)
                {
                    logger.Error(e.ToString());
                }
                Exit();
            }
        }
コード例 #25
0
        private void Insert()
        {
            using (var conn = SQLConn.GetConnection())
            {
                conn.Open();
                var trans = conn.BeginTransaction();
                try
                {
                    DataAccess.Config.InsertConfig(ConfigSystem.ToString(), ConfigKey, ConfigValue, trans);

                    trans.Commit();
                }
                catch
                {
                    trans.Rollback();
                }

                //conn.Close();
            }
        }
コード例 #26
0
ファイル: Test.xaml.cs プロジェクト: nhl7198/QLGV_NOSQL
        public Test()
        {
            DateTime ngayBatDau = new DateTime(2018, 1, 2);

            DateTime ngayKetThuc = new DateTime(2018, 6, 2);
            int      buoiHoc     = 15;

            BO.ConfigSystem config = new BO.ConfigSystem()
            {
                NgayBatDau  = ngayBatDau,
                NgayKetThuc = ngayKetThuc,
                SoBuoi      = buoiHoc
            };
            ConfigSystem doConfigSystem = new ConfigSystem();

            doConfigSystem.LuuConfigSystem(config);

            LuuDuLieu.DocExcel(@"D:\Project\T_Manager\T_Manager\bin\Debug\gvv.xlsx");
            InitializeComponent();
        }
コード例 #27
0
        private void luu_Click(object sender, RoutedEventArgs e)
        {
            int _soBuoiHoc;

            if (string.IsNullOrEmpty(excelName.Text) || string.IsNullOrEmpty(ngayBatDau.Text) || string.IsNullOrEmpty(ngayKetThuc.Text) || !int.TryParse(SoBuoiHoc.Text, out _soBuoiHoc))
            {
                return;
            }
            MongoDB <int> .XoaData();

            ConfigSystem config = new ConfigSystem()
            {
                NgayBatDau  = ngayBatDau.SelectedDate.Value,
                NgayKetThuc = ngayKetThuc.SelectedDate.Value,
                SoBuoi      = int.Parse(SoBuoiHoc.Text)
            };

            DO.ConfigSystem doConfig = new DO.ConfigSystem();
            doConfig.LuuConfigSystem(config);
            LuuDuLieu.DocExcel(linkExcel);
        }
コード例 #28
0
        public void Save(SqlTransaction trans = null)
        {
            if (Any())
            {
                Update();
            }
            else
            {
                var sql =
                    $"INSERT INTO {Repository.GetTableAttr<Config>().Name} (ConfigValue, ConfigSystem, ConfigKey) VALUES (@configValue, @configSystem, @configKey)";

                SqlParameter[] para =
                {
                    new SqlParameter("@configSystem", ConfigSystem.ToString()),
                    new SqlParameter("@configKey",    ConfigKey),
                    new SqlParameter("@configValue",  ConfigValue)
                };

                DataAccess.ExecuteNonQuery(sql, para, trans);
            }
        }
コード例 #29
0
        public void SaveData(string _key, string _value)
        {
            var entity = _Repository.GetByKey(_key);

            if (entity != null)
            {
                entity.configValue = _value;
                _Repository.Update(entity);
                _unitOfWork.Commit();
            }
            else
            {
                entity = new ConfigSystem
                {
                    configKey   = _key,
                    configValue = _value
                };
                _Repository.Add(entity);
                _unitOfWork.Commit();
            }
        }
コード例 #30
0
        public void Set(Parameter param)
        {
            if (!FlowMap.ContainsKey(param.MallCD))
            {
                throw new ScraperException("The code is not defined. Please check code of parameter. Code : " + param.MallCD);
            }
            Type type = FlowMap[param.MallCD];

            this.flow = Activator.CreateInstance(type, this, param) as IScrapFlow;
            this.flow.Initialize(flowModelData);
            this.parameter = param;

            Gecko.LauncherDialog.Download += (sender, e) =>
            {
                String       tempPath  = ConfigSystem.ReadConfig("Config", "Temp", "Path");
                String       file      = Path.Combine(tempPath, DateTime.Now.ToString("yyyyMMddHHmmss") + e.Filename);
                nsILocalFile objTarget = (nsILocalFile)Xpcom.NewNativeLocalFile(file);
                e.HelperAppLauncher.SaveToDisk(objTarget, false);
                Procedure(new Uri(e.Url), null, file);
            };
            this.Navigate(flow.StartPage(flowModelData));
        }
コード例 #31
0
ファイル: Config.cs プロジェクト: CyranoChen/Arsenalcn
            public static Dictionary<string, string> GetDictionaryByConfigSystem(ConfigSystem cs)
            {
                var list = ConfigList.FindAll(x => x.ConfigSystem.Equals(cs));

                if (list.Count > 0)
                {
                    var dict = new Dictionary<string, string>();

                    foreach (var c in list)
                    {
                        try
                        {
                            dict.Add(c.ConfigKey, c.ConfigValue);
                        }
                        catch
                        {
                            // ignored
                        }
                    }

                    return dict;
                }
                return null;
            }
コード例 #32
0
ファイル: Config.cs プロジェクト: CyranoChen/Arsenalcn
 public static IEnumerable<Config> All(ConfigSystem cs)
 {
     return All().Where(x => x.ConfigSystem.Equals(cs));
 }
コード例 #33
0
ファイル: Config.cs プロジェクト: CyranoChen/Arsenalcn
 public static string LoadDict(ConfigSystem cs, string key)
 {
     return GetDictionaryByConfigSystem(cs)[key];
 }
コード例 #34
0
ファイル: Config.cs プロジェクト: CyranoChen/Arsenalcn
 public static Config Load(ConfigSystem cs, string key)
 {
     return ConfigList.Find(x => x.ConfigSystem.Equals(cs) && x.ConfigKey.Equals(key));
 }
コード例 #35
0
ファイル: Config.cs プロジェクト: CyranoChen/Arsenalcn
        protected static Dictionary<string, string> GetDictionaryByConfigSystem(ConfigSystem cs)
        {
            var list = Cache.ConfigList.FindAll(delegate(Config c) { return c.ConfigSystem.Equals(cs); });

            if (list != null && list.Count > 0)
            {
                var dict = new Dictionary<string, string>();

                foreach (var c in list)
                {
                    try
                    {
                        dict.Add(c.ConfigKey, c.ConfigValue);
                    }
                    catch
                    {
                    }
                }

                return dict;
            }
            return null;
        }
コード例 #36
0
ファイル: Config.cs プロジェクト: CyranoChen/Arsenalcn
 public static Config Load(ConfigSystem cs, string key)
 {
     return
         ConfigList.Find(delegate(Config c) { return c.ConfigSystem.Equals(cs) && c.ConfigKey.Equals(key); });
 }
コード例 #37
0
ファイル: Config.cs プロジェクト: CyranoChen/Arsenalcn
        public static void UpdateAssemblyInfo(Assembly assembly, ConfigSystem configSystem)
        {
            if (assembly != null)
            {
                //[assembly: AssemblyTitle("Arsenalcn.Core")]
                //[assembly: AssemblyDescription("沪ICP备12045527号")]
                //[assembly: AssemblyConfiguration("*****@*****.**")]
                //[assembly: AssemblyCompany("Arsenal China Official Supporters Club")]
                //[assembly: AssemblyProduct("Arsenalcn.com")]
                //[assembly: AssemblyCopyright("© 2015")]
                //[assembly: AssemblyTrademark("ArsenalCN")]
                //[assembly: AssemblyCulture("")]
                //[assembly: AssemblyVersion("1.8.*")]
                //[assembly: AssemblyFileVersion("1.8.2")]

                var c = new Config();
                c.ConfigSystem = configSystem;

                //AssemblyTitle
                c.ConfigKey = "AssemblyTitle";
                c.ConfigValue =
                    ((AssemblyTitleAttribute) Attribute.GetCustomAttribute(assembly, typeof (AssemblyTitleAttribute)))?
                        .Title;

                c.Save();

                //AssemblyDescription
                c.ConfigKey = "AssemblyDescription";
                c.ConfigValue =
                    ((AssemblyDescriptionAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyDescriptionAttribute)))?.Description;

                c.Save();

                //AssemblyConfiguration
                c.ConfigKey = "AssemblyConfiguration";
                c.ConfigValue =
                    ((AssemblyConfigurationAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyConfigurationAttribute)))?.Configuration;

                c.Save();

                //AssemblyCompany
                c.ConfigKey = "AssemblyCompany";
                c.ConfigValue =
                    ((AssemblyCompanyAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyCompanyAttribute)))?.Company;

                c.Save();

                //AssemblyProduct
                c.ConfigKey = "AssemblyProduct";
                c.ConfigValue =
                    ((AssemblyProductAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyProductAttribute)))?.Product;

                c.Save();

                //AssemblyCopyright
                c.ConfigKey = "AssemblyCopyright";
                c.ConfigValue =
                    ((AssemblyCopyrightAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyCopyrightAttribute)))?.Copyright;

                c.Save();

                //AssemblyTrademark
                c.ConfigKey = "AssemblyTrademark";
                c.ConfigValue =
                    ((AssemblyTrademarkAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyTrademarkAttribute)))?.Trademark;

                c.Save();

                //AssemblyCulture
                c.ConfigKey = "AssemblyCulture";
                c.ConfigValue =
                    ((AssemblyCultureAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyCultureAttribute)))?.Culture;

                c.Save();

                //AssemblyVersion
                var assemblyName = assembly.GetName();
                var version = assemblyName.Version;

                c.ConfigKey = "AssemblyVersion";
                c.ConfigValue = version?.ToString();

                c.Save();

                //AssemblyFileVersion
                c.ConfigKey = "AssemblyFileVersion";
                c.ConfigValue =
                    ((AssemblyFileVersionAttribute)
                        Attribute.GetCustomAttribute(assembly, typeof (AssemblyFileVersionAttribute)))?.Version;

                c.Save();
            }
        }