Esempio n. 1
0
        public void OnPost()
        {
            string Parameter;
            bool   confirm;
            ABCCS  systemControl = new ABCCS();

            Parameter = SearchParameter;
            string[] subs = Submit.Split(' ');

            switch (subs[0])
            {
            case "Search":
                _sampleObjectCollection = systemControl.SearchCustomersByParam(Parameter);
                //  Message = $"OnPost - First - {FirstInputField}";
                break;

            case "Delete":
                confirm = systemControl.DeleteCustomer(subs[1]);
                if (confirm)
                {
                    Message = $"{subs[1]} deleted";
                    _sampleObjectCollection = systemControl.SearchCustomersByParam(Parameter);
                }
                else
                {
                    Message = "Error";
                }
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
        public void OnPost()
        {
            string Parameter;
            bool   confirm;
            ABCCS  systemControl = new ABCCS();

            Parameter = SearchParameter;
            string[] subs = Submit.Split(' ');

            switch (subs[0])
            {
            case "Search":

                _sampleObjectCollection = systemControl.SearchCustomersByParam(Parameter);
                //  Message = $"OnPost - First - {FirstInputField}";
                break;

            case "Select":
                Customer customer = new Customer();
                customer                = systemControl.GetACustomer(subs[1]);
                CustomerIDField         = customer.CustomerID;
                CustomerNameField       = customer.CustomerName;
                AddressField            = customer.Address;
                CityField               = customer.City;
                ProvinceField           = customer.Province;
                PostalCodeField         = customer.PostalCode;
                Message                 = $"{subs[1]} selected";
                _sampleObjectCollection = systemControl.SearchCustomersByParam(Parameter);

                break;

            case "Update":
                Customer customer2 = new Customer()
                {
                    CustomerID = CustomerIDField, CustomerName = CustomerNameField, Address = AddressField, City = CityField, Province = ProvinceField, PostalCode = PostalCodeField
                };
                try
                {
                    confirm = systemControl.UpdateACustomer(customer2);
                    Message = $"{customer2.CustomerID} updated : {confirm}";
                }
                catch (Exception e)
                {
                    Message = $"Error {e}";
                    throw;
                }

                break;

            default:
                break;
            }
        }