using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using GZTW.AyaNova.BLL; using Outlook = Microsoft.Office.Interop.Outlook; using Office = Microsoft.Office.Core; namespace AyaNovaOL { public partial class ContactExportOptions : Form { public ContactExportOptions() { InitializeComponent(); } private void ContactExportOptions_Load(object sender, EventArgs e) { //Util.d("ContactExportOptions_Load"); Util.Localize(this); Util.FillGZComboBoxWithNameIDList("Region", cbRegion, false, Guid.Empty, true); Util.ComboSelectGuid(cbRegion, GZTW.AyaNova.BLL.Region.DefaultRegionID); Util.FillGZComboBoxWithNameIDList("DispatchZone", cbDispatchZone, false, Guid.Empty, true); Util.FillGZComboBoxWithNameIDList("Contract", cbContractID, false, Guid.Empty, true); Infragistics.Win.ValueListItem vli = cbVendorType.Items.Add(VendorTypes.Manufacturer, Util.LocaleText.GetLocalizedText("Vendor.Label.VendorType.Manufacturer")); cbVendorType.Items.Add(VendorTypes.Shipper, Util.LocaleText.GetLocalizedText("Vendor.Label.VendorType.Shipper")); cbVendorType.Items.Add(VendorTypes.SubContractor, Util.LocaleText.GetLocalizedText("Vendor.Label.VendorType.SubContractor")); cbVendorType.Items.Add(VendorTypes.ThirdPartyRepair, Util.LocaleText.GetLocalizedText("Vendor.Label.VendorType.ThirdPartyRepair")); cbVendorType.Items.Add(VendorTypes.Wholesaler, Util.LocaleText.GetLocalizedText("Vendor.Label.VendorType.Wholesaler")); cbVendorType.SelectedItem = vli; LoadSettings(false); //Util.d("ContactExportOptions_Load BOTTOM"); } private void btnCancel_Click(object sender, EventArgs e) { Close(); } private void btnOK_Click(object sender, EventArgs e) { SaveSettings(); Util.MapFields(); DialogResult = DialogResult.OK; Close(); } private void radClient_CheckedChanged(object sender, EventArgs e) { AdjustDisplay(); } private void radHeadOffice_CheckedChanged(object sender, EventArgs e) { AdjustDisplay(); } private void radVendor_CheckedChanged(object sender, EventArgs e) { AdjustDisplay(); } private void AdjustDisplay() { if (bIgnoreRadChecks) return; // Util.d("AdjustDisplay top"); SaveSettings(); bool bVend = radVendor.Checked; cbVendorType.Enabled = bVend; cbContractID.Enabled = !bVend; cbDispatchZone.Enabled = !bVend; cbRegion.Enabled = !bVend; LoadSettings(true); //Util.d("AdjustDisplay bottom"); } bool bIgnoreRadChecks = false; private void LoadSettings(bool bPhoneOnly) { //Util.d("LoadSettings top phone only="+bPhoneOnly.ToString()); bIgnoreRadChecks = true; if (!bPhoneOnly) { Util.ComboSelectGuid(cbRegion, AyaNovaOL.Properties.Settings.Default.Region); Util.ComboSelectGuid(cbDispatchZone, AyaNovaOL.Properties.Settings.Default.Zone); Util.ComboSelectGuid(cbContractID, AyaNovaOL.Properties.Settings.Default.Contract); switch ((RootObjectTypes)AyaNovaOL.Properties.Settings.Default.RootObjectType) { case RootObjectTypes.Client: radClient.Checked = true; break; case RootObjectTypes.HeadOffice: radHeadOffice.Checked = true; break; case RootObjectTypes.Vendor: radVendor.Checked = true; cbSelectVendorType(cbVendorType, AyaNovaOL.Properties.Settings.Default.VendorType); break; } } bIgnoreRadChecks = false; //Util.d("LoadSettings bottom"); } private void SaveSettings() { // Util.d("SaveSettings top"); if (radClient.Checked) { AyaNovaOL.Properties.Settings.Default.RootObjectType = (int)RootObjectTypes.Client; } if (radHeadOffice.Checked) { AyaNovaOL.Properties.Settings.Default.RootObjectType = (int)RootObjectTypes.HeadOffice; } if (radVendor.Checked) { AyaNovaOL.Properties.Settings.Default.RootObjectType = (int)RootObjectTypes.Vendor; AyaNovaOL.Properties.Settings.Default.VendorType = (int)(VendorTypes)cbVendorType.SelectedItem.DataValue; } AyaNovaOL.Properties.Settings.Default.Zone = (Guid)cbDispatchZone.Value; AyaNovaOL.Properties.Settings.Default.Region = (Guid)cbRegion.Value; AyaNovaOL.Properties.Settings.Default.Contract = (Guid)cbContractID.Value; AyaNovaOL.Properties.Settings.Default.Save(); //Util.d("SaveSettings bottom"); } private void cbSelectPhone(GZTW.WinForm.Controls.GZUltraComboEditor cb, int phtype) { foreach (Infragistics.Win.ValueListItem vi in cb.Items) { if ((AYOLPhoneNumberType)vi.DataValue == (AYOLPhoneNumberType)phtype) { cb.SelectedItem = vi; break; } } } private void cbSelectAddress(GZTW.WinForm.Controls.GZUltraComboEditor cb, int adrtype) { foreach (Infragistics.Win.ValueListItem vi in cb.Items) { if ((AYOLAddressType)vi.DataValue == (AYOLAddressType)adrtype) { cb.SelectedItem = vi; break; } } } private void cbSelectVendorType(GZTW.WinForm.Controls.GZUltraComboEditor cb, int vendtype) { foreach (Infragistics.Win.ValueListItem vi in cb.Items) { if ((VendorTypes)vi.DataValue == (VendorTypes)vendtype) { cb.SelectedItem = vi; break; } } } private void btnMap_Click(object sender, EventArgs e) { MapPhoneAddress d = new MapPhoneAddress(); d.ShowDialog(); d.Dispose(); } //yadda yadda yadda end of class blah blah blah blah } }