Example #1
0
        private void btn_group_save_Click(object sender, EventArgs e)
        {
            var group = new Four51WebGroup(txt_sharedsecret.Text, txt_serviceid.Text)
            {
                InteropID             = txt_group_interopid.Text == "" ? Guid.NewGuid().To <string>() : txt_group_interopid.Text,
                BuyerCompanyInteropID = txt_group_companyinteropid.Text,
                Description           = txt_group_description.Text,
                Name = txt_group_name.Text
            };

            foreach (DataGridViewRow row in grid_group_address.Rows)
            {
                if (row.Cells[0].Value == null)
                {
                    break;
                }
                group.Address.Add(new Four51WebAddressAssignment()
                {
                    AddressInteropID = row.Cells[0].Value.To <string>(),
                    UseForShipping   = row.Cells[1].Value.To <bool>(),
                    UseForBilling    = row.Cells[2].Value.To <bool>()
                });
            }

            try
            {
                group.Save();
                MessageBox.Show("Saved: " + group.InteropID);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void btn_group_delete_Click(object sender, EventArgs e)
        {
            var group = new Four51WebGroup(txt_sharedsecret.Text, txt_serviceid.Text)
            {
                InteropID             = txt_group_interopid.Text,
                BuyerCompanyInteropID = txt_group_companyinteropid.Text
            };

            try
            {
                group.Delete();
                MessageBox.Show("Deleted: " + group.InteropID);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }