/// <summary>
        /// <para>Initializes the provider with a <see cref="ConfigurationView"/>.</para>
        /// </summary>
        /// <param name="configurationView">
        /// <para>A <see cref="ConfigurationView"/> object.</para>
        /// </param>
        /// <remarks>
        /// <para>The method expects a <see cref="RuntimeConfigurationView"/> object for the <paramref name="configurationView"/></para>
        /// </remarks>
        public override void Initialize(ConfigurationView configurationView)
        {
            ArgumentValidation.CheckForNullReference(configurationView, "configurationView");

            runtimeConfigurationView = GetStorageCursor(configurationView);
            GetFileKeyAlgorithmPairStorageProviderData();
        }
        private static RuntimeConfigurationView GetStorageCursor(ConfigurationView configurationView)
        {
            ArgumentValidation.CheckExpectedType(configurationView, typeof (RuntimeConfigurationView));

            RuntimeConfigurationView runtimeConfigurationView = (RuntimeConfigurationView) configurationView;
            return runtimeConfigurationView;
        }
Example #3
0
 /// <summary>
 /// <para>
 /// Initializes the provider with its name and any attributes associated with the provider.
 /// </para>
 /// </summary>
 /// <param name="configurationView">A <see cref="SecurityConfigurationView"></see> object</param>
 public override void Initialize(ConfigurationView configurationView)
 {
     ArgumentValidation.CheckForNullReference(configurationView, "configurationView");
     ArgumentValidation.CheckExpectedType(configurationView, typeof(SecurityConfigurationView));
     securityConfigurationView = (SecurityConfigurationView)configurationView;
 }
Example #4
0
 /// <summary>
 /// <para>When overridden by a class, initializes the provider with a <see cref="ConfigurationView"/>.</para>
 /// </summary>
 /// <param name="configurationView">
 /// <para>A <see cref="ConfigurationView"/> object.</para>
 /// </param>
 public abstract void Initialize(ConfigurationView configurationView);
Example #5
0
 public override void Initialize(ConfigurationView configurationView)
 {
     serializer = new XmlSerializer(typeof(MockConfigurationData));
 }
        private void GetStorageCursor(ConfigurationView configurationView)
        {
            ArgumentValidation.CheckExpectedType(configurationView, typeof(RuntimeConfigurationView));

            runtimeConfigurationView = (RuntimeConfigurationView)configurationView;
        }
Example #7
0
 public ConfigurationPresenter(ConfigurationModel model, ConfigurationView view)
 {
     this.model     = model;
     this.view      = view;
     view.Presenter = this;
 }
Example #8
0
        private void SelectNode(object sender, TreeViewEventArgs e)
        {
            string name = treeView.SelectedNode.Text;

            switch (name)
            {
            case "Quản lý nhân viên":
                var userView = new UserView {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(userView);
                break;

            case "Quản lý cấu hình hệ thống":
                var configurationView = new ConfigurationView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(configurationView);
                break;

            case "Quản lý nội dung tin nhắn":
                var smsView = new SmsView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(smsView);
                break;

            case "Quản lý nội dung email":
                var emailView = new EmailView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(emailView);
                break;

            case "Quản lý khách hàng":
                var customerView = new CustomerView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(customerView);
                break;

            case "Quản lý loại sản phẩm":
                var productTypeView = new ProductTypeView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(productTypeView);
                break;

            case "Quản lý sản phẩm":
                var productView = new ProductView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(productView);
                break;

            case "Quản lý sản phẩm LD":
                var productLDView = new ProductLDView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(productLDView);
                break;

            case "Quản lý thiết bị vận chuyển":
                var vehicleView = new VehicleView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(vehicleView);
                break;

            case "Quản lý đơn hàng":
                var orderView = new OrderView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(orderView);
                break;

            case "Quản lý thông tin vận chuyển":
                var mainView = new MainView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(mainView);
                break;

            case "Bảng thông tin đơn hàng":
                var frm = new DashboardForm {
                    Dock = DockStyle.Fill, TopLevel = true
                };
                frm.ShowDialog();
                break;

            case "Quản lý tên thành phố":
                var cityView = new CityView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(cityView);
                break;

            case "Quản lý quyền truy cập":
                var roleView = new RoleView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(roleView);
                break;

            case "Quản lý cập nhật dữ liệu":
                var lockingView = new LockingView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(lockingView);
                break;

            case "Quản lý thông tin email":
                var emailDataView = new EmailDataView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(emailDataView);
                break;

            case "Quản lý thông tin tin nhắn":
                var smsDataView = new SmsDataView(CurrentUser)
                {
                    Dock = DockStyle.Fill, TopLevel = false
                };
                OpenForm(smsDataView);
                break;

            default:
                break;
            }
        }
Example #9
0
 /// <summary>
 /// <para>When overridden by a class, initializes the provider with a <see cref="ConfigurationView"/>.</para>
 /// </summary>
 /// <param name="configurationView">
 /// <para>A <see cref="ConfigurationView"/> object.</para>
 /// </param>
 public abstract void Initialize(ConfigurationView configurationView);
Example #10
0
 public override void Initialize(ConfigurationView configurationView)
 {
     throw new NotImplementedException();
 }
Example #11
0
 public override void Initialize(ConfigurationView configurationView)
 {
     serializer = new XmlSerializer(typeof(MockConfigurationData));
 }
        public void Should_not_be_possible_save_a_configuration_with_empty_server_or_target_configuration()
        {
            MockRepository mocks = new MockRepository();

            var fakeView = new ConfigurationView();
            var fakeController = mocks.DynamicMock<ConfigurationController>(new object[] { fakeView });

            using (mocks.Record())
            {
                Expect.Call(() => fakeController.CreateProgramFolder()).IgnoreArguments();
            }

            mocks.ReplayAll();

            fakeController.view_OnWriteConfiguration(this, EventArgs.Empty);

            mocks.VerifyAll();

            Assert.IsNull(fakeController.Section);
            Assert.AreEqual(Resource.InvalidConfiguration, fakeView.LastErrorMessage);
        }
        public void If_there_are_errors_getting_a_configuration_an_error_message_is_expected()
        {
            MockRepository mocks = new MockRepository();

            var view = new ConfigurationView();
            var fakeController = mocks.DynamicMock<ConfigurationController>(new object[] { view });

            using (mocks.Record())
            {
                Expect.Call(fakeController.FileExists(null)).IgnoreArguments().Return(true);
                Expect.Call(fakeController.ReadConfigurationSection(null)).IgnoreArguments().Throw(new Exception("Exception handling test", new Exception("Inner Exception test")));
            }

            mocks.ReplayAll();

            fakeController.view_OnReadConfiguration(this, EventArgs.Empty);

            mocks.VerifyAll();

            Assert.AreEqual("Exception handling test\r\nInner Exception:\r\nInner Exception test", view.LastErrorMessage);
        }
Example #14
0
        public ActionResult ConfigCalc(ConfigurationView cView)
        {
            //Add bind includes
            //Add validate anti forgery
            //Add Is Model Valid?

            #region Fetch OAUTHtoken
            if (!Helper.CheckSessionOAUTHToken((OAUTHtoken)this.Session["OAUTHtoken"]))
            {
                this.Session["OAUTHtoken"] = Helper.GetOAUTHToken();
            }

            OAUTHtoken token = (OAUTHtoken)this.Session["OAUTHtoken"];
            #endregion

            List <Parameter> theParams = new List <Parameter>();

            #region Fetch list of parameters

            using (HttpClient client = NetworkHelper.GetHttpClient(ConfigurationManager.AppSettings[ConfigurationParams.ServiceGatewayURI], token.access_token))
            {
                HttpResponseMessage response = client.GetAsync(String.Format(ServiceGatewayURI.ParameterURI)).Result;
                if (response != null)
                {
                    using (response)
                    {
                        if (response.StatusCode == HttpStatusCode.OK)
                        {
                            theParams = response.Content.ReadAsAsync <List <Parameter> >().Result;
                        }
                        else
                        {
                            return(new HttpStatusCodeResult(response.StatusCode));
                        }
                    }
                }
            }
            #endregion

            ConfigurationDetail configurationDetail = new ConfigurationDetail()
            {
                //CustomerCode = cView.SelectedCustomerCode,
                ConfigurationTypeID = cView.SelectedConfigurationType,
                Name        = cView.Name,
                Description = cView.Description,
                Id          = Guid.NewGuid().ToString(),
                ConfigurationParameterValues = new List <ConfigurationParameterValue>()
            };

            foreach (String pipyString in cView.ListOfConfigurationParameterValues)
            {
                String        id            = pipyString.Split('|')[0];
                String        value         = pipyString.Split('|')[1];
                String        parameterName = null;
                AttributeType parameterType = 0;

                foreach (Parameter param in theParams)
                {
                    if (param.Id.ToString() == id)
                    {
                        parameterName = param.Name;
                        parameterType = param.ParameterType1;
                    }
                }

                configurationDetail.ConfigurationParameterValues.Add(new ConfigurationParameterValue()
                {
                    ConfigurationID = configurationDetail.Id, ParameterID = id, ParameterName = parameterName, ParameterType1 = parameterType, Value = value
                });
            }

            string JSONdocType = JsonConvert.SerializeObject(configurationDetail);

            StringContent content = new StringContent(JSONdocType, Encoding.UTF8, "application/json");

            #region POST params to ConfigDetail controller
            using (HttpClient client = NetworkHelper.GetHttpClient(ConfigurationManager.AppSettings[ConfigurationParams.ServiceGatewayURI], token.access_token))
            {
                HttpResponseMessage response = client.PostAsync(String.Format(ServiceGatewayURI.ConfigurationDetailURI), content).Result;
                if (response != null)
                {
                    using (response)
                    {
                        if (response.StatusCode == HttpStatusCode.OK)
                        {
                            configurationDetail = response.Content.ReadAsAsync <ConfigurationDetail>().Result;
                        }
                        else
                        {
                            return(new HttpStatusCodeResult(response.StatusCode));
                        }
                    }
                }
            }
            #endregion

            foreach (ConfigurationTypeOutput output in configurationDetail.ConfigurationTypeOutputs)
            {
                if (output.ValueType == AttributeType.FloatType)
                {
                    if (output.Value != null)
                    {
                        output.Value = String.Format("£{0:n}", float.Parse(output.Value));
                    }
                    else
                    {
                        return(new JsonHttpStatusResult(configurationDetail.OutputText, HttpStatusCode.InternalServerError));
                    }
                }
            }

            string outputValues = JsonConvert.SerializeObject(configurationDetail);

            //return View(configurationDetail);
            //return new HttpResponseMessage() { Content = new StringContent(configurationDetail.OutputText, Encoding.UTF8, "text/html") };
            return(Content(outputValues));
        }
Example #15
0
        /// <summary>
        /// <para>Initializes this provider to the correct state and context used by the factory creating it.</para>
        /// </summary>
        /// <param name="configurationView">
        /// <para>The cursor to use to get the data specific for the transformer.</para>
        /// </param>
        /// <exception cref="ArgumentException">
        /// <para><paramref name="configurationView"/> must be of type <see cref="EnterpriseLibrary.Configuration.RuntimeConfigurationView"/>.</para>
        /// <para>- or -</para>
        /// <para>The <see cref="StorageProviderData"/> from the cursor should be of type <see cref="XmlFileStorageProviderData"/>.</para>
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="configurationView"/> is a <see langword="null"/> reference (Nothing in Visual Basic).</para>
        /// </exception>
        public override void Initialize(ConfigurationView configurationView)
        {
            ArgumentValidation.CheckForNullReference(configurationView, "configurationView");

            GetStorageCursor(configurationView);
            StorageProviderData storageProviderData = runtimeConfigurationView.GetStorageProviderData(CurrentSectionName);
            ArgumentValidation.CheckExpectedType(storageProviderData, typeof(XmlFileStorageProviderData));

            XmlFileStorageProviderData xmlFileStorageProvider = (XmlFileStorageProviderData)storageProviderData;
            SetCurrentDirectory(runtimeConfigurationView);
            SetApplicationDocumentPathSetting(xmlFileStorageProvider);
        }
Example #16
0
        /// <summary>
        /// Initializes the LogDistributor with its current configuration
        /// </summary>
        /// <param name="configurationView">View of configuration used by the LogDistributor</param>
        public override void Initialize(ConfigurationView configurationView)
        {
            ArgumentValidation.CheckForNullReference(configurationView, "configurationView");

            this.logDistributor = new LogDistributor(configurationView.ConfigurationContext);
        }
Example #17
0
 public override void Initialize(ConfigurationView configurationView)
 {
     this.initialized = true;
 }
 public ConfigurationWindow(IGestureRecognizer rec, GesturePack gestures)
 {
     // Take advantage of closure to get reference to the uninitialized view
     model = new ConfigurationModel(new ModelToViewAdapter(() => { return view; }), rec, gestures);
     view = new ConfigurationView(new ViewToModelAdapter(() => { return model;  }));
 }
Example #19
0
 public override void Initialize(ConfigurationView configurationView)
 {
 }
        /// <summary>
        /// Restart Mde Service
        /// </summary>
        public void RestartMdeService()
        {
            ConfigurationView view = new ConfigurationView("Market Data Engine");

            view.ShowDialog();
        }
 public override void Initialize(ConfigurationView configurationView)
 {
 }
Example #22
0
 public ConfigurationPage(IBootstrapperController bootstrapperController, IEnumerable <ConfigurationItem> configurationItems) : base(bootstrapperController)
 {
     this.ConfigurationView = new ConfigurationView(new ConfigurationViewmodel(bootstrapperController, configurationItems));
 }