Пример #1
0
        // GET: Address/Create
        public ActionResult Create()
        {
            IEnumerable <Customer> customers        = Mapper.Map <IEnumerable <Customers>, IEnumerable <Customer> >((IEnumerable <Customers>)CustomerRepository.GetAll());
            AddressForm            addressViewModel = new AddressForm(customers);

            return(View(addressViewModel));
        }
Пример #2
0
        public EditAddressPage FillAllField(string firstName, string lastName, string company,
                                            string Address1, string Address2, string city, string postCode, string country,
                                            string regionState)
        {
            js = Application.Get().Browser.Driver as IJavaScriptExecutor;

            AddressForm.TypeInFirstName(firstName);
            AddressForm.TypeInLastNameInput(lastName);
            AddressForm.CompanyInput.Clear();
            AddressForm.CompanyInput.SendKeys(company);
            AddressForm.TypeInAddress1Input(Address1);
            AddressForm.Address2Input.Clear();
            AddressForm.Address2Input.SendKeys(Address2);

            js.ExecuteScript("window.scrollBy(0,100)"); //Moving scrollbar down

            AddressForm.TypeInCityInput(city);
            AddressForm.TypeInPostCodeInput(postCode);

            js.ExecuteScript("window.scrollBy(0,200)"); //Moving scrollbar down againe

            AddressForm.ChooseCountry(country);
            AddressForm.ChooseRegionState(regionState);
            return(this);
        }
        /// <summary>
        ///
        /// </summary>
        public async Task <Address> create(AddressForm form)
        {
            this.context.Add(form.infoAddress);

            await this.context.SaveChangesAsync();

            return(form.infoAddress);
        }
Пример #4
0
 private void mnuManageExit_Click(object sender, EventArgs e)
 {
     this.Hide();
     UserForm    = null;
     AddressForm = null;
     CountryForm = null;
     StateForm   = null;
     reLogin.Call();
     this.Close();
 }
Пример #5
0
        // GET: Address/Edit/5
        public ActionResult Edit(int id)
        {
            Address address = Mapper.Map <Addresses, Address> (Repository.GetById(id));
            IEnumerable <Customer> customers        = Mapper.Map <IEnumerable <Customers>, IEnumerable <Customer> >((IEnumerable <Customers>)CustomerRepository.GetAll());
            AddressForm            addressViewModel = new AddressForm(address, customers);

            if (address != null)
            {
                return(View(addressViewModel));
            }
            return(RedirectToAction(nameof(Index)));
        }
Пример #6
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        string[] splitFormName = AddressForm.Split('.');
        // UIForm cant process full path of alternative form if object type is already specified.
        addressForm.AlternativeFormName = splitFormName.LastOrDefault();
        addressForm.OnBeforeSave       += addressForm_OnBeforeSave;
        addressForm.OnAfterDataLoad    += addressForm_OnAfterDataLoad;
        // Hide default submit button
        addressForm.SubmitButton.Visible = false;

        InitializeAddress();
    }
Пример #7
0
 private void mnuAddressbook_Click(object sender, EventArgs e)
 {
     if (objAddressForm == null)
     {
         objAddressForm = new AddressForm();
         objAddressForm.Show();
         objAddressForm.MdiParent    = this;
         objAddressForm.FormClosing += ObjAddressForm_FormClosing;
     }
     else
     {
         objAddressForm.Activate();
     }
 }
Пример #8
0
        public ActionResult Addresses()
        {
            foreach (var address in this.Context.Customer.Addresses)
            {
                var addressForm = new AddressForm();
                addressForm.FormContext = address;
                addressForm.FormType    = "customer_address";
                addressForm.Id          = address.Id;

                Context.Forms.Add(addressForm);
            }

            return(View("customers/addresses"));
        }
Пример #9
0
        // Funkcja do tworzenia adresu odpala formularz do wypełnienia danych adresowych
        public AddressObject CreateAddress()
        {
            AddressObject addressObject = null;

            using (AddressForm addressForm = new AddressForm())
            {
                if (addressForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    addressObject = addressForm.AddressObj;
                }
            }

            return(addressObject);
        }
        //check current address
        public void AddressCurrentAddressErroenousData()
        {
            //create instance to test
            AddressForm aForm = new AddressForm(ref mainform, true);
            //define a test input and out put value

            bool expectedResult = false;

            aForm.SetCurrentAddressAdded("1");

            //runs the method
            bool actualResult = aForm.ValidateFields();

            //check results
            Assert.AreEqual(expectedResult, actualResult);
        }
        private IFormRepository CreateFormRepository(AddressForm addressForm = null, PersonalInformationForm personalInformationForm = null)
        {
            if (addressForm == null)
            {
                addressForm = new AddressForm();
            }
            if (personalInformationForm == null)
            {
                personalInformationForm = new PersonalInformationForm();
            }

            var fake = A.Fake <IFormRepository>();

            A.CallTo(() => fake.GetFormDefinition(AddressForm.FORM_NAME)).Returns(addressForm);
            A.CallTo(() => fake.GetFormDefinition(PersonalInformationForm.FORM_NAME)).Returns(personalInformationForm);
            return(fake);
        }
Пример #12
0
        // UpdateAddress(form)
        public Address UpdateAdresse(Address address, AddressForm form)
        {
            form.ToPo(address);
            this.SaveAddress(address);


            try
            {
                address.FromObject(form);


                return(address);
            }
            catch (Exception ex)
            {
                throw new Exception("UpdateAdresse " + ex.Message, ex);
            }
        }
Пример #13
0
        // CreateAddress(form)
        public Address CreateAddress(AddressForm form)
        {
            try
            {
                Address nouveau = new Address();
                nouveau.FromObject(form);

                nouveau["IDAddress"] = DBNull.Value;

                // Insert
                base.InsertBubble(nouveau, false, true);

                return(nouveau);
            }
            catch (Exception ex)
            {
                throw new Exception("CreateAddress" + ex.Message, ex);
            }
        }
Пример #14
0
        public static Form Call()
        {
            LoginForm    login = new LoginForm();
            Form         form;
            DialogResult dr;

            dr = login.ShowDialog();
            if (dr == DialogResult.Yes)
            {
                form = new MDIParent();
            }
            else if (dr == DialogResult.OK)
            {
                form = new AddressForm();
            }
            else
            {
                form = new LoginForm();
            }
            return(form);
        }
Пример #15
0
        /// <summary>
        ///
        /// </summary>
        public async Task <Response <Address> > handleAsync(AddressCreatorCommand model)
        {
            var response = new Response <Address>();

            var filter = new StateFilter();

            filter.setQuery(StateProjections.basicOne.Key);

            var msg    = new StateFindFromCacheMsg(filter);
            var result = await searchState.handleAsync(msg);

            using (var transaction = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) {
                try {
                    foreach (var item in model.request.listRequest)
                    {
                        var idState = result.Where(x => x.initials == item.initialsState).Select(x => x.id).FirstOrDefault();

                        if (idState == 0)
                        {
                            response.error = true;
                            return(response);
                        }

                        var form = new AddressForm(item.name, idState);

                        var entity = await creator.create(form);

                        response.results.Add(entity);
                    }

                    transaction.Complete();
                }
                catch (System.Exception) {
                    response.error = true;
                }
            }

            return(response);
        }
Пример #16
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        if (!StopProcessing)
        {
            string[] splitFormName = AddressForm.Split('.');

            // UIForm can't process full path of alternative form if object type is already specified
            addressForm.AlternativeFormName = splitFormName.LastOrDefault();
            addressForm.OnBeforeSave       += addressForm_OnBeforeSave;
            addressForm.OnBeforeDataLoad   += addressForm_OnBeforeDataLoad;
            addressForm.OnAfterDataLoad    += addressForm_OnAfterDataLoad;

            // Hide default submit button
            addressForm.SubmitButton.Visible = false;

            InitializeAddress();
        }

        // Propagate StopProcessing to address form to avoid JS errors for missing update panel
        addressForm.StopProcessing = StopProcessing;
    }
Пример #17
0
        /// <summary>
        /// Show Address Main Menu
        /// </summary>
        public static void ShowAddressMenu()
        {
            string menuOption = new string("");
            string menu       = "Adresses\n\n" +
                                "1 - New\n" +
                                "2 - Show all\n" +
                                "3 - Find\n" +
                                "4 - Update\n" +
                                "5 - Set Default Address\n" +
                                "\nb - Back\n\n" +
                                "Option: ";

            do
            {
                Console.Write(menu);
                menuOption = Console.ReadLine();

                switch (menuOption)
                {
                case "1":
                    ClearHelper.Clear();
                    AddressForm.ShowForm();
                    break;

                case "2":
                    ClearHelper.Clear();
                    ShowAllWithAddress.Show();
                    Console.WriteLine();
                    Console.ReadKey();
                    ClearHelper.Clear();
                    break;

                case "3":
                    ClearHelper.Clear();
                    AddressSearch.Search();
                    ClearHelper.Clear();
                    break;

                case "4":
                    ClearHelper.Clear();
                    ShowAllWithAddress.Show();
                    Console.WriteLine();
                    AddressUpdate.Show();
                    break;

                case "5":
                    ClearHelper.Clear();
                    DefaultAddressForm.ShowForm();
                    Console.WriteLine();
                    Console.ReadKey();
                    ClearHelper.Clear();
                    break;

                case "b":
                    ClearHelper.Clear();
                    break;

                default:
                    Console.WriteLine("Wrong option!");
                    Console.ReadKey();
                    ClearHelper.Clear();
                    break;
                }
            } while (menuOption != "b");
        }
Пример #18
0
        //定位图标
        private void imageButton2_Press(object sender, EventArgs e)
        {
            AddressForm form = new AddressForm();

            Show(form);
        }
    /// <summary>
    /// We either want to start or stop searching
    /// </summary>
    private void btnSearch_Click(object sender, System.EventArgs e)
    {
        if (!isSearching)
        {
            if( hostAddress != null )
                hostAddress.Dispose();

            hostAddress = new Address();
            hostAddress.ServiceProvider = deviceAddress.ServiceProvider;

            // See if we should prompt the user for the remote address
            if (ConnectWizard.ProviderRequiresPort(hostAddress.ServiceProvider))
            {
                AddressForm addressDialog = new AddressForm(connectionWizard.DefaultPort);
                addressDialog.ShowDialog(this);

                // If the user cancelled the address form, abort the search
                if (addressDialog.DialogResult != DialogResult.OK)
                    return;

                // If a port was specified, add the component
                if (addressDialog.Hostname != "")
                    hostAddress.AddComponent(Address.KeyHostname, addressDialog.Hostname);

                // If a hostname was specified, add the component
                if (addressDialog.Port > 0)
                    hostAddress.AddComponent(Address.KeyPort, addressDialog.Port);
            }

            //Time to enum our hosts
            ApplicationDescription desc = new ApplicationDescription();
            desc.GuidApplication = connectionWizard.ApplicationGuid;

            // If the user was not already asked for address information, DirectPlay
            // should prompt with native UI
            FindHostsFlags flags = 0;
            if (!ConnectWizard.ProviderRequiresPort(deviceAddress.ServiceProvider))
                flags = FindHostsFlags.OkToQueryForAddressing;

            peer.FindHosts(desc,hostAddress,deviceAddress,null,Timeout.Infinite,0,Timeout.Infinite, flags, out findHostHandle);
            isSearching = true;
            btnCreate.Enabled = false;
            btnSearch.Text = "Stop Search";
        }
        else
        {
            btnSearch.Text = "Stopping...";
            btnSearch.Enabled = false;
            if (findHostHandle != 0)
                peer.CancelAsyncOperation(findHostHandle);
        }
    }
Пример #20
0
 private void ObjAddressForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     objAddressForm = null;
 }
Пример #21
0
    /// <summary>
    /// We either want to start or stop searching
    /// </summary>
    private void btnSearch_Click(object sender, System.EventArgs e)
    {
        if (!isSearching)
        {
            if (hostAddress != null)
            {
                hostAddress.Dispose();
            }

            hostAddress = new Address();
            hostAddress.ServiceProvider = deviceAddress.ServiceProvider;

            // See if we should prompt the user for the remote address
            if (ConnectWizard.ProviderRequiresPort(hostAddress.ServiceProvider))
            {
                AddressForm addressDialog = new AddressForm(connectionWizard.DefaultPort);
                addressDialog.ShowDialog(this);

                // If the user cancelled the address form, abort the search
                if (addressDialog.DialogResult != DialogResult.OK)
                {
                    return;
                }

                // If a port was specified, add the component
                if (addressDialog.Hostname != "")
                {
                    hostAddress.AddComponent(Address.KeyHostname, addressDialog.Hostname);
                }

                // If a hostname was specified, add the component
                if (addressDialog.Port > 0)
                {
                    hostAddress.AddComponent(Address.KeyPort, addressDialog.Port);
                }
            }

            //Time to enum our hosts
            ApplicationDescription desc = new ApplicationDescription();
            desc.GuidApplication = connectionWizard.ApplicationGuid;

            // If the user was not already asked for address information, DirectPlay
            // should prompt with native UI
            FindHostsFlags flags = 0;
            if (!ConnectWizard.ProviderRequiresPort(deviceAddress.ServiceProvider))
            {
                flags = FindHostsFlags.OkToQueryForAddressing;
            }

            peer.FindHosts(desc, hostAddress, deviceAddress, null, Timeout.Infinite, 0, Timeout.Infinite, flags, out findHostHandle);
            isSearching       = true;
            btnCreate.Enabled = false;
            btnSearch.Text    = "Stop Search";
        }
        else
        {
            btnSearch.Text    = "Stopping...";
            btnSearch.Enabled = false;
            if (findHostHandle != 0)
            {
                peer.CancelAsyncOperation(findHostHandle);
            }
        }
    }