Files
ayanova7/source/Plugins/AyaNova.Plugin.PTI/Map.cs
2018-06-29 19:47:36 +00:00

1835 lines
75 KiB
C#

using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using GZTW.AyaNova.BLL;
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win;
using System.Text;
namespace AyaNova.PlugIn.PTI
{
/// <summary>
/// Summary description for Map.
/// </summary>
public class Map : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel Map_Fill_Panel;
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _Map_Toolbars_Dock_Area_Left;
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _Map_Toolbars_Dock_Area_Right;
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _Map_Toolbars_Dock_Area_Top;
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _Map_Toolbars_Dock_Area_Bottom;
private Infragistics.Win.UltraWinGrid.UltraGrid gridPT;
private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager tbManager;
private Infragistics.Win.UltraWinGrid.UltraGrid gridAya;
private System.ComponentModel.IContainer components;
public Map()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
_aya=new DataTable("AyaNova");
_aya.Columns.Add("ID",typeof(Guid));
_aya.Columns.Add("Name",typeof(string));
_aya.Columns.Add("Linked",typeof(bool));
_aya.DefaultView.Sort = "Name asc";
_pt=new DataTable("Peachtree");
_pt.Columns.Add("ID",typeof(string));
_pt.Columns.Add("Name",typeof(string));
_pt.Columns.Add("Linked",typeof(bool));
_pt.DefaultView.Sort = "Name asc";
this.gridAya.DataSource=_aya;
this.gridPT.DataSource=_pt;
//Setup grids
SetupGrid(gridAya);
SetupGrid(gridPT);
gridAya.DisplayLayout.Rows.TemplateAddRow.Cells["Name"].Value="Drop here to import Peachtree item(s)";
gridPT.DisplayLayout.Rows.TemplateAddRow.Cells["Name"].Value="Drop here to import AyaNova item(s)";
this.Icon = Resource.PTI16icon;
}
private void SetupGrid(UltraGrid g)
{
//Set the caption to be on the left side of the grid
g.DisplayLayout.CaptionVisible=DefaultableBoolean.True;
g.DisplayLayout.CaptionAppearance.TextHAlign=HAlign.Left;
g.DisplayLayout.Bands[0].Columns["ID"].Hidden=true;
g.DisplayLayout.Bands[0].Columns["Linked"].Hidden=true;
g.DisplayLayout.Bands[0].Columns["Name"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
g.DisplayLayout.Override.TemplateAddRowAppearance.BackColor=System.Drawing.SystemColors.Window;
g.DisplayLayout.Rows.TemplateAddRow.Cells["Name"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.Edit;
g.DisplayLayout.Rows.TemplateAddRow.Appearance.FontData.Bold=DefaultableBoolean.True;
g.DisplayLayout.Override.SpecialRowSeparatorHeight=15;
g.DisplayLayout.Override.SpecialRowSeparatorAppearance.BackColor=System.Drawing.SystemColors.Control;
//Util.Image("Link24.png");
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
Infragistics.Win.UltraWinToolbars.OptionSet optionSet1 = new Infragistics.Win.UltraWinToolbars.OptionSet("OSShow");
Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("tbMap");
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool1 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Object");
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool2 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Show");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Auto link");
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool3 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Object");
Infragistics.Win.Appearance appearance29 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance30 = new Infragistics.Win.Appearance();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Map));
Infragistics.Win.Appearance appearance31 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Clients");
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool4 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Service rates");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Parts");
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool5 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Vendors");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Clients");
Infragistics.Win.Appearance appearance32 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance33 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Parts");
Infragistics.Win.Appearance appearance34 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance35 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool6 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Show");
Infragistics.Win.UltraWinToolbars.StateButtonTool stateButtonTool1 = new Infragistics.Win.UltraWinToolbars.StateButtonTool("All items linked or unlinked", "OSShow");
Infragistics.Win.UltraWinToolbars.StateButtonTool stateButtonTool2 = new Infragistics.Win.UltraWinToolbars.StateButtonTool("Linked items only", "OSShow");
Infragistics.Win.UltraWinToolbars.StateButtonTool stateButtonTool3 = new Infragistics.Win.UltraWinToolbars.StateButtonTool("Unlinked items only", "OSShow");
Infragistics.Win.UltraWinToolbars.StateButtonTool stateButtonTool4 = new Infragistics.Win.UltraWinToolbars.StateButtonTool("Linked items only", "OSShow");
Infragistics.Win.UltraWinToolbars.StateButtonTool stateButtonTool5 = new Infragistics.Win.UltraWinToolbars.StateButtonTool("Unlinked items only", "OSShow");
Infragistics.Win.UltraWinToolbars.StateButtonTool stateButtonTool6 = new Infragistics.Win.UltraWinToolbars.StateButtonTool("All items linked or unlinked", "OSShow");
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool7 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Vendors");
Infragistics.Win.Appearance appearance36 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance37 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Manufacturer ");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Shipper ");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("SubContractor ");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Third party repair center");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Wholesaler");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Manufacturer ");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool12 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Shipper ");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool13 = new Infragistics.Win.UltraWinToolbars.ButtonTool("SubContractor ");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool14 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Third party repair center");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool15 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Wholesaler");
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool8 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Service rates");
Infragistics.Win.Appearance appearance38 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance39 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool16 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Service rate");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool17 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Travel rate");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool18 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Service rate");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool19 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Travel rate");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool20 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Auto link");
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool9 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Synchronize");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool21 = new Infragistics.Win.UltraWinToolbars.ButtonTool("SyncPrices");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool22 = new Infragistics.Win.UltraWinToolbars.ButtonTool("SyncNames");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool23 = new Infragistics.Win.UltraWinToolbars.ButtonTool("SyncContactInfo");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool24 = new Infragistics.Win.UltraWinToolbars.ButtonTool("SyncPrices");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool25 = new Infragistics.Win.UltraWinToolbars.ButtonTool("SyncNames");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool26 = new Infragistics.Win.UltraWinToolbars.ButtonTool("SyncContactInfo");
Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance8 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance10 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance11 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance12 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance13 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance14 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance15 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance16 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance17 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance18 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance19 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance20 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance21 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance22 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance23 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance24 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance25 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance26 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance27 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance28 = new Infragistics.Win.Appearance();
this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components);
this.Map_Fill_Panel = new System.Windows.Forms.Panel();
this.gridAya = new Infragistics.Win.UltraWinGrid.UltraGrid();
this.gridPT = new Infragistics.Win.UltraWinGrid.UltraGrid();
this._Map_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
this._Map_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
this._Map_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
this._Map_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
((System.ComponentModel.ISupportInitialize)(this.tbManager)).BeginInit();
this.Map_Fill_Panel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridAya)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridPT)).BeginInit();
this.SuspendLayout();
//
// tbManager
//
this.tbManager.DesignerFlags = 1;
this.tbManager.DockWithinContainer = this;
this.tbManager.DockWithinContainerBaseType = typeof(System.Windows.Forms.Form);
optionSet1.AllowAllUp = false;
this.tbManager.OptionSets.Add(optionSet1);
this.tbManager.ShowFullMenusDelay = 500;
ultraToolbar1.DockedColumn = 0;
ultraToolbar1.DockedRow = 0;
ultraToolbar1.NonInheritedTools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
popupMenuTool1,
popupMenuTool2,
buttonTool1});
ultraToolbar1.Settings.AllowCustomize = Infragistics.Win.DefaultableBoolean.False;
ultraToolbar1.Settings.AllowFloating = Infragistics.Win.DefaultableBoolean.False;
ultraToolbar1.Settings.AllowHiding = Infragistics.Win.DefaultableBoolean.False;
ultraToolbar1.Text = "tbMap";
this.tbManager.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] {
ultraToolbar1});
popupMenuTool3.Settings.IsSideStripVisible = Infragistics.Win.DefaultableBoolean.True;
appearance29.BackColor = System.Drawing.Color.Red;
appearance29.BackColor2 = System.Drawing.Color.Yellow;
appearance29.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
appearance29.FontData.BoldAsString = "True";
appearance29.FontData.Name = "Arial";
appearance29.FontData.SizeInPoints = 16F;
appearance29.ForeColor = System.Drawing.Color.Black;
appearance29.ImageVAlign = Infragistics.Win.VAlign.Top;
appearance29.TextHAlignAsString = "Center";
popupMenuTool3.Settings.SideStripAppearance = appearance29;
popupMenuTool3.Settings.SideStripText = "AyaNova";
popupMenuTool3.Settings.SideStripWidth = 18;
appearance30.Image = ((object)(resources.GetObject("appearance30.Image")));
popupMenuTool3.SharedPropsInternal.AppearancesLarge.Appearance = appearance30;
appearance31.Image = ((object)(resources.GetObject("appearance31.Image")));
popupMenuTool3.SharedPropsInternal.AppearancesSmall.Appearance = appearance31;
popupMenuTool3.SharedPropsInternal.Caption = "&Object";
popupMenuTool3.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
popupMenuTool3.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
buttonTool2,
popupMenuTool4,
buttonTool3,
popupMenuTool5});
appearance32.Image = ((object)(resources.GetObject("appearance32.Image")));
buttonTool4.SharedPropsInternal.AppearancesLarge.Appearance = appearance32;
appearance33.Image = ((object)(resources.GetObject("appearance33.Image")));
buttonTool4.SharedPropsInternal.AppearancesSmall.Appearance = appearance33;
buttonTool4.SharedPropsInternal.Caption = "&Clients";
appearance34.Image = ((object)(resources.GetObject("appearance34.Image")));
buttonTool5.SharedPropsInternal.AppearancesLarge.Appearance = appearance34;
appearance35.Image = ((object)(resources.GetObject("appearance35.Image")));
buttonTool5.SharedPropsInternal.AppearancesSmall.Appearance = appearance35;
buttonTool5.SharedPropsInternal.Caption = "&Parts";
popupMenuTool6.SharedPropsInternal.Caption = "&Show";
stateButtonTool1.Checked = true;
stateButtonTool1.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark;
stateButtonTool2.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark;
stateButtonTool3.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark;
popupMenuTool6.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
stateButtonTool1,
stateButtonTool2,
stateButtonTool3});
stateButtonTool4.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark;
stateButtonTool4.OptionSetKey = "OSShow";
stateButtonTool4.SharedPropsInternal.Caption = "&Linked items only";
stateButtonTool5.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark;
stateButtonTool5.OptionSetKey = "OSShow";
stateButtonTool5.SharedPropsInternal.Caption = "&Unlinked items only";
stateButtonTool6.Checked = true;
stateButtonTool6.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark;
stateButtonTool6.OptionSetKey = "OSShow";
stateButtonTool6.SharedPropsInternal.Caption = "&All items linked or unlinked";
appearance36.Image = ((object)(resources.GetObject("appearance36.Image")));
popupMenuTool7.SharedPropsInternal.AppearancesLarge.Appearance = appearance36;
appearance37.Image = ((object)(resources.GetObject("appearance37.Image")));
popupMenuTool7.SharedPropsInternal.AppearancesSmall.Appearance = appearance37;
popupMenuTool7.SharedPropsInternal.Caption = "&Vendors";
popupMenuTool7.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
buttonTool6,
buttonTool7,
buttonTool8,
buttonTool9,
buttonTool10});
buttonTool11.SharedPropsInternal.Caption = "Manufacturer ";
buttonTool12.SharedPropsInternal.Caption = "Shipper ";
buttonTool13.SharedPropsInternal.Caption = "SubContractor ";
buttonTool14.SharedPropsInternal.Caption = "Third party repair center";
buttonTool15.SharedPropsInternal.Caption = "Wholesaler";
appearance38.Image = ((object)(resources.GetObject("appearance38.Image")));
popupMenuTool8.SharedPropsInternal.AppearancesLarge.Appearance = appearance38;
appearance39.Image = ((object)(resources.GetObject("appearance39.Image")));
popupMenuTool8.SharedPropsInternal.AppearancesSmall.Appearance = appearance39;
popupMenuTool8.SharedPropsInternal.Caption = "&Service rates";
popupMenuTool8.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
buttonTool16,
buttonTool17});
buttonTool18.SharedPropsInternal.Caption = "&Service rate";
buttonTool19.SharedPropsInternal.Caption = "&Travel rate";
buttonTool20.SharedPropsInternal.Caption = "&Auto link";
buttonTool20.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways;
popupMenuTool9.SharedPropsInternal.Caption = "S&ynchronize";
popupMenuTool9.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
buttonTool21,
buttonTool22,
buttonTool23});
buttonTool24.SharedPropsInternal.Caption = "AyaNova price and cost from linked Peachtree object";
buttonTool25.SharedPropsInternal.Caption = "AyaNova names from linked Peachtree object";
buttonTool26.SharedPropsInternal.Caption = "AyaNova contact and address information from linked Peachtree object";
this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
popupMenuTool3,
buttonTool4,
buttonTool5,
popupMenuTool6,
stateButtonTool4,
stateButtonTool5,
stateButtonTool6,
popupMenuTool7,
buttonTool11,
buttonTool12,
buttonTool13,
buttonTool14,
buttonTool15,
popupMenuTool8,
buttonTool18,
buttonTool19,
buttonTool20,
popupMenuTool9,
buttonTool24,
buttonTool25,
buttonTool26});
this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick);
//
// Map_Fill_Panel
//
this.Map_Fill_Panel.Controls.Add(this.gridAya);
this.Map_Fill_Panel.Controls.Add(this.gridPT);
this.Map_Fill_Panel.Cursor = System.Windows.Forms.Cursors.Default;
this.Map_Fill_Panel.Dock = System.Windows.Forms.DockStyle.Fill;
this.Map_Fill_Panel.Location = new System.Drawing.Point(0, 26);
this.Map_Fill_Panel.Name = "Map_Fill_Panel";
this.Map_Fill_Panel.Size = new System.Drawing.Size(632, 427);
this.Map_Fill_Panel.TabIndex = 0;
//
// gridAya
//
this.gridAya.AllowDrop = true;
appearance1.BackColor = System.Drawing.SystemColors.Window;
appearance1.BorderColor = System.Drawing.SystemColors.InactiveCaption;
this.gridAya.DisplayLayout.Appearance = appearance1;
this.gridAya.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns;
appearance2.BackColor = System.Drawing.Color.Yellow;
appearance2.BackColor2 = System.Drawing.Color.Red;
appearance2.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
appearance2.FontData.BoldAsString = "True";
appearance2.FontData.SizeInPoints = 12F;
appearance2.ForeColor = System.Drawing.Color.Black;
this.gridAya.DisplayLayout.CaptionAppearance = appearance2;
this.gridAya.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False;
appearance3.BackColor = System.Drawing.SystemColors.ActiveBorder;
appearance3.BackColor2 = System.Drawing.SystemColors.ControlDark;
appearance3.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
appearance3.BorderColor = System.Drawing.SystemColors.Window;
this.gridAya.DisplayLayout.GroupByBox.Appearance = appearance3;
appearance4.ForeColor = System.Drawing.SystemColors.GrayText;
this.gridAya.DisplayLayout.GroupByBox.BandLabelAppearance = appearance4;
this.gridAya.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
appearance5.BackColor = System.Drawing.SystemColors.ControlLightLight;
appearance5.BackColor2 = System.Drawing.SystemColors.Control;
appearance5.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
appearance5.ForeColor = System.Drawing.SystemColors.GrayText;
this.gridAya.DisplayLayout.GroupByBox.PromptAppearance = appearance5;
this.gridAya.DisplayLayout.MaxColScrollRegions = 1;
this.gridAya.DisplayLayout.MaxRowScrollRegions = 1;
appearance6.BackColor = System.Drawing.SystemColors.Window;
appearance6.ForeColor = System.Drawing.SystemColors.ControlText;
this.gridAya.DisplayLayout.Override.ActiveCellAppearance = appearance6;
appearance7.BackColor = System.Drawing.SystemColors.Highlight;
appearance7.ForeColor = System.Drawing.SystemColors.HighlightText;
this.gridAya.DisplayLayout.Override.ActiveRowAppearance = appearance7;
this.gridAya.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.FixedAddRowOnTop;
this.gridAya.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
this.gridAya.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
this.gridAya.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.Dotted;
this.gridAya.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Dotted;
appearance8.BackColor = System.Drawing.SystemColors.Window;
this.gridAya.DisplayLayout.Override.CardAreaAppearance = appearance8;
appearance9.BorderColor = System.Drawing.Color.Silver;
appearance9.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;
this.gridAya.DisplayLayout.Override.CellAppearance = appearance9;
this.gridAya.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
this.gridAya.DisplayLayout.Override.CellPadding = 0;
appearance10.BackColor = System.Drawing.SystemColors.Control;
appearance10.BackColor2 = System.Drawing.SystemColors.ControlDark;
appearance10.BackGradientAlignment = Infragistics.Win.GradientAlignment.Element;
appearance10.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
appearance10.BorderColor = System.Drawing.SystemColors.Window;
this.gridAya.DisplayLayout.Override.GroupByRowAppearance = appearance10;
appearance11.TextHAlignAsString = "Left";
this.gridAya.DisplayLayout.Override.HeaderAppearance = appearance11;
this.gridAya.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
this.gridAya.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.WindowsXPCommand;
appearance12.BackColor = System.Drawing.Color.Yellow;
appearance12.BackColor2 = System.Drawing.Color.Red;
appearance12.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
appearance12.FontData.BoldAsString = "True";
appearance12.ForeColor = System.Drawing.Color.Black;
this.gridAya.DisplayLayout.Override.HotTrackRowAppearance = appearance12;
appearance13.BackColor = System.Drawing.SystemColors.Window;
appearance13.BorderColor = System.Drawing.Color.Silver;
this.gridAya.DisplayLayout.Override.RowAppearance = appearance13;
this.gridAya.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True;
this.gridAya.DisplayLayout.Override.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.None;
this.gridAya.DisplayLayout.Override.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.None;
this.gridAya.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.ExtendedAutoDrag;
appearance14.BackColor = System.Drawing.Color.White;
this.gridAya.DisplayLayout.Override.TemplateAddRowAppearance = appearance14;
this.gridAya.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
this.gridAya.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
this.gridAya.Location = new System.Drawing.Point(5, 3);
this.gridAya.Name = "gridAya";
this.gridAya.Size = new System.Drawing.Size(177, 231);
this.gridAya.TabIndex = 0;
this.gridAya.Text = "AyaNova";
this.gridAya.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.gridAya_InitializeRow);
this.gridAya.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.gridAya_ClickCellButton);
this.gridAya.DragDrop += new System.Windows.Forms.DragEventHandler(this.gridAya_DragDrop);
this.gridAya.DragEnter += new System.Windows.Forms.DragEventHandler(this.gridAya_DragEnter);
this.gridAya.MouseDown += new System.Windows.Forms.MouseEventHandler(this.gridAya_MouseDown);
this.gridAya.MouseMove += new System.Windows.Forms.MouseEventHandler(this.gridAya_MouseMove);
this.gridAya.MouseUp += new System.Windows.Forms.MouseEventHandler(this.gridAya_MouseUp);
//
// gridPT
//
this.gridPT.AllowDrop = true;
appearance15.BackColor = System.Drawing.SystemColors.Window;
appearance15.BorderColor = System.Drawing.SystemColors.InactiveCaption;
this.gridPT.DisplayLayout.Appearance = appearance15;
this.gridPT.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns;
this.gridPT.DisplayLayout.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
appearance16.BackColor = System.Drawing.Color.Gold;
appearance16.FontData.BoldAsString = "True";
appearance16.FontData.SizeInPoints = 12F;
appearance16.ForeColor = System.Drawing.Color.Black;
this.gridPT.DisplayLayout.CaptionAppearance = appearance16;
this.gridPT.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False;
appearance17.BackColor = System.Drawing.SystemColors.ActiveBorder;
appearance17.BackColor2 = System.Drawing.SystemColors.ControlDark;
appearance17.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
appearance17.BorderColor = System.Drawing.SystemColors.Window;
this.gridPT.DisplayLayout.GroupByBox.Appearance = appearance17;
appearance18.ForeColor = System.Drawing.SystemColors.GrayText;
this.gridPT.DisplayLayout.GroupByBox.BandLabelAppearance = appearance18;
this.gridPT.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
this.gridPT.DisplayLayout.GroupByBox.Hidden = true;
appearance19.BackColor = System.Drawing.SystemColors.ControlLightLight;
appearance19.BackColor2 = System.Drawing.SystemColors.Control;
appearance19.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
appearance19.ForeColor = System.Drawing.SystemColors.GrayText;
this.gridPT.DisplayLayout.GroupByBox.PromptAppearance = appearance19;
this.gridPT.DisplayLayout.MaxColScrollRegions = 1;
this.gridPT.DisplayLayout.MaxRowScrollRegions = 1;
appearance20.BackColor = System.Drawing.SystemColors.Window;
appearance20.ForeColor = System.Drawing.SystemColors.ControlText;
this.gridPT.DisplayLayout.Override.ActiveCellAppearance = appearance20;
appearance21.BackColor = System.Drawing.SystemColors.Highlight;
appearance21.ForeColor = System.Drawing.SystemColors.HighlightText;
this.gridPT.DisplayLayout.Override.ActiveRowAppearance = appearance21;
this.gridPT.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.FixedAddRowOnTop;
this.gridPT.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
this.gridPT.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
this.gridPT.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.Dotted;
this.gridPT.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Dotted;
appearance22.BackColor = System.Drawing.SystemColors.Window;
this.gridPT.DisplayLayout.Override.CardAreaAppearance = appearance22;
appearance23.BorderColor = System.Drawing.Color.Silver;
appearance23.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;
this.gridPT.DisplayLayout.Override.CellAppearance = appearance23;
this.gridPT.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
this.gridPT.DisplayLayout.Override.CellPadding = 0;
appearance24.BackColor = System.Drawing.SystemColors.Control;
appearance24.BackColor2 = System.Drawing.SystemColors.ControlDark;
appearance24.BackGradientAlignment = Infragistics.Win.GradientAlignment.Element;
appearance24.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
appearance24.BorderColor = System.Drawing.SystemColors.Window;
this.gridPT.DisplayLayout.Override.GroupByRowAppearance = appearance24;
appearance25.TextHAlignAsString = "Left";
this.gridPT.DisplayLayout.Override.HeaderAppearance = appearance25;
this.gridPT.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
this.gridPT.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.WindowsXPCommand;
appearance26.BackColor = System.Drawing.Color.Gold;
appearance26.FontData.BoldAsString = "True";
appearance26.ForeColor = System.Drawing.Color.White;
this.gridPT.DisplayLayout.Override.HotTrackRowAppearance = appearance26;
appearance27.BorderColor = System.Drawing.Color.Silver;
this.gridPT.DisplayLayout.Override.RowAppearance = appearance27;
this.gridPT.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True;
this.gridPT.DisplayLayout.Override.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.None;
this.gridPT.DisplayLayout.Override.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.None;
this.gridPT.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.ExtendedAutoDrag;
appearance28.BackColor = System.Drawing.SystemColors.ControlLight;
this.gridPT.DisplayLayout.Override.TemplateAddRowAppearance = appearance28;
this.gridPT.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
this.gridPT.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
this.gridPT.Location = new System.Drawing.Point(211, 3);
this.gridPT.Name = "gridPT";
this.gridPT.Size = new System.Drawing.Size(190, 235);
this.gridPT.TabIndex = 0;
this.gridPT.Text = "Peachtree";
this.gridPT.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.gridQB_InitializeRow);
this.gridPT.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.gridQB_ClickCellButton);
this.gridPT.DragDrop += new System.Windows.Forms.DragEventHandler(this.gridQB_DragDrop);
this.gridPT.DragEnter += new System.Windows.Forms.DragEventHandler(this.gridQB_DragEnter);
this.gridPT.MouseDown += new System.Windows.Forms.MouseEventHandler(this.gridQB_MouseDown);
this.gridPT.MouseMove += new System.Windows.Forms.MouseEventHandler(this.gridQB_MouseMove);
this.gridPT.MouseUp += new System.Windows.Forms.MouseEventHandler(this.gridQB_MouseUp);
//
// _Map_Toolbars_Dock_Area_Left
//
this._Map_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
this._Map_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control;
this._Map_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left;
this._Map_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText;
this._Map_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 26);
this._Map_Toolbars_Dock_Area_Left.Name = "_Map_Toolbars_Dock_Area_Left";
this._Map_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 427);
this._Map_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager;
//
// _Map_Toolbars_Dock_Area_Right
//
this._Map_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
this._Map_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control;
this._Map_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right;
this._Map_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText;
this._Map_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(632, 26);
this._Map_Toolbars_Dock_Area_Right.Name = "_Map_Toolbars_Dock_Area_Right";
this._Map_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 427);
this._Map_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager;
//
// _Map_Toolbars_Dock_Area_Top
//
this._Map_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
this._Map_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control;
this._Map_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top;
this._Map_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText;
this._Map_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0);
this._Map_Toolbars_Dock_Area_Top.Name = "_Map_Toolbars_Dock_Area_Top";
this._Map_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(632, 26);
this._Map_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager;
//
// _Map_Toolbars_Dock_Area_Bottom
//
this._Map_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
this._Map_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control;
this._Map_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom;
this._Map_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText;
this._Map_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 453);
this._Map_Toolbars_Dock_Area_Bottom.Name = "_Map_Toolbars_Dock_Area_Bottom";
this._Map_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(632, 0);
this._Map_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager;
//
// Map
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
this.ClientSize = new System.Drawing.Size(632, 453);
this.Controls.Add(this.Map_Fill_Panel);
this.Controls.Add(this._Map_Toolbars_Dock_Area_Left);
this.Controls.Add(this._Map_Toolbars_Dock_Area_Right);
this.Controls.Add(this._Map_Toolbars_Dock_Area_Bottom);
this.Controls.Add(this._Map_Toolbars_Dock_Area_Top);
this.Name = "Map";
this.Text = "Map / Import";
this.Closing += new System.ComponentModel.CancelEventHandler(this.Map_Closing);
this.Load += new System.EventHandler(this.Map_Load);
this.SizeChanged += new System.EventHandler(this.Map_SizeChanged);
((System.ComponentModel.ISupportInitialize)(this.tbManager)).EndInit();
this.Map_Fill_Panel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridAya)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridPT)).EndInit();
this.ResumeLayout(false);
}
#endregion
// __ _ _ ___ ____ __ __ __ __ __ ___ ___
// / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
// ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
// \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)
//************************************************************
#region attributes
private RootObjectTypes _Type=RootObjectTypes.Client;
private DataTable _aya;
private DataTable _pt;
//private ClientPickList Util.AyaClientList=null;
//private VendorPickList Util.AyaVendorList=null;
//private RatePickList _ratelist=null;
private VendorTypes _currentVendorType=0;
private viewtypes _currentView=viewtypes.All;
private RateTypes _currentRateType=0;
private Guid _MostLikelyRateUnitChargeDescriptionID=Guid.Empty;
//private PartPickList _partlist=null;
#endregion
#region Form Load / Close / Sizechanged
private void Map_SizeChanged(object sender, System.EventArgs e)
{
int nWidth=(Map_Fill_Panel.DisplayRectangle.Width/2);
int nHeight=Map_Fill_Panel.DisplayRectangle.Height;
this.gridAya.SuspendLayout();
this.gridPT.SuspendLayout();
this.gridAya.Bounds=new Rectangle(0,0,nWidth-15,nHeight);
this.gridPT.Bounds=new Rectangle(nWidth+15,0,nWidth-15,nHeight);
this.gridAya.ResumeLayout();
this.gridPT.ResumeLayout();
}
private void Map_Load(object sender, System.EventArgs e)
{
Map_SizeChanged(null,null);
Initialize();
//Load the grid layout from file
//if(System.IO.File.Exists("MapGrid.lyt"))
//grid.DisplayLayout.Load("MapGrid.lyt");
}
private void Map_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
//grid.DisplayLayout.Save("MapGrid.lyt");
}
#endregion
#region Initialize lists
private enum viewtypes
{
All,
Unlinked,
Linked
}
private void Initialize()
{
this.gridPT.BeginUpdate();
this.gridAya.BeginUpdate();
//clear both lists
_aya.Rows.Clear();
_pt.Rows.Clear();
//Some AyaNova objects can't be imported to qb so normally
//show the import drop target but items below may re-hide it
gridPT.DisplayLayout.Rows.TemplateAddRow.Hidden=false;
switch(_Type)
{
case RootObjectTypes.Client:
#region client
foreach(ClientPickList.ClientPickListInfo i in Util.AyaClientList)
{
if(i.Active)
{
bool bLinked=Util.PTI.Maps.Contains(i.ID);
if(DisplayRow(bLinked))
_aya.Rows.Add(new object[] {i.ID,i.Name,bLinked});
}
}
//Fill PT table with PT Customers from prefetched table
foreach(DataRow dr in Util.PTClients.Rows)
{
bool bLinked=Util.PTI.Maps.Contains(dr["ID"].ToString(),RootObjectTypes.Client);
if(DisplayRow(bLinked))
_pt.Rows.Add(new object[] { dr["ID"].ToString(), dr["ID"].ToString() + " " + dr["FullName"].ToString(), bLinked });
}
#endregion client
break;
case RootObjectTypes.Vendor:
#region Vendor
foreach(VendorPickList.VendorPickListInfo i in Util.AyaVendorList)
{
if(i.Active && i.VendorType==_currentVendorType)
{
bool bLinked=Util.PTI.Maps.Contains(i.ID);
if(DisplayRow(bLinked))
_aya.Rows.Add(new object[] {i.ID,i.Name,bLinked});
}
}
//Fill PT table with PT Customers from prefetched table
foreach(DataRow dr in Util.PTVendors.Rows)
{
bool bLinked=Util.PTI.Maps.Contains(dr["ID"].ToString(),RootObjectTypes.Vendor);
if(DisplayRow(bLinked))
_pt.Rows.Add(new object[] { dr["ID"].ToString(), dr["ID"].ToString() + " " + dr["FullName"].ToString(), bLinked });
}
#endregion Vendor
break;
case RootObjectTypes.Rate:
#region Service rates
_MostLikelyRateUnitChargeDescriptionID=Guid.Empty;
gridPT.DisplayLayout.Rows.TemplateAddRow.Hidden=true;
foreach(RatePickList.RatePickListInfo i in Util.AyaRateList)
{
if(i.Active && i.RateType==_currentRateType )
{
// //Determine the most likely description for purposes
// //of importing a rate from PT later by picking the first one
// //in the existing rate list that is non-empty
// //typically this will just be hours and every rate will
// //probably use the same one or for travel "miles" or "km's" etc
// if(_MostLikelyRateUnitChargeDescriptionID==Guid.Empty && i.RateUnitChargeDescriptionID!=Guid.Empty)
// _MostLikelyRateUnitChargeDescriptionID=i.RateUnitChargeDescriptionID;
//After discussion we decided to not us any rate unit charge description
//so leaving the code in but defaulted to guid.empty for now.
bool bLinked=Util.PTI.Maps.Contains(i.ID);
if(DisplayRow(bLinked))
_aya.Rows.Add(new object[] {i.ID,i.Name,bLinked});
}
}
//Fill PT table with PT items from prefetched table
foreach(DataRow dr in Util.PTItems.Rows)
{
if((Util.ptitemtype)dr["Type"]==Util.ptitemtype.Service || (Util.ptitemtype)dr["Type"]==Util.ptitemtype.OtherCharge)
{
bool bLinked=Util.PTI.Maps.Contains(dr["ID"].ToString(),RootObjectTypes.Rate);
if(DisplayRow(bLinked))
_pt.Rows.Add(new object[] { dr["ID"].ToString(), dr["ID"].ToString()+" " +dr["SalesDesc"].ToString(), bLinked });
}
}
#endregion Rate
break;
case RootObjectTypes.Part:
#region Service parts
gridPT.DisplayLayout.Rows.TemplateAddRow.Hidden=true;
foreach(PartPickList.PartPickListInfo i in Util.AyaPartList)
{
if(i.Active )
{
bool bLinked=Util.PTI.Maps.Contains(i.ID);
if(DisplayRow(bLinked))
_aya.Rows.Add(new object[] {i.ID,i.DisplayName(Util.GlobalSettings.DefaultPartDisplayFormat),bLinked});//changed: 21-June-2006 from i.Name to display formatted name
}
}
//Fill PT table with PT items from prefetched table
foreach(DataRow dr in Util.PTItems.Rows)
{
if((Util.ptitemtype)dr["Type"]==Util.ptitemtype.Inventory ||
(Util.ptitemtype)dr["Type"]==Util.ptitemtype.NonInventory ||
(Util.ptitemtype)dr["Type"]==Util.ptitemtype.OtherCharge ||//Case 338
(Util.ptitemtype)dr["Type"]==Util.ptitemtype.Assembly)
{
bool bLinked=Util.PTI.Maps.Contains(dr["ID"].ToString(),RootObjectTypes.Part);
if(DisplayRow(bLinked))
_pt.Rows.Add(new object[] { dr["ID"].ToString(), dr["ID"].ToString() + " " + dr["SalesDesc"].ToString(), bLinked });
}
}
#endregion Part
break;
}
this.gridPT.EndUpdate();
this.gridAya.EndUpdate();
}
/// <summary>
/// Determine if row should be added to grid or now
/// based on current view preferences and if item is already
/// linked or not
/// </summary>
/// <param name="bLinked"></param>
/// <returns></returns>
private bool DisplayRow(bool bLinked)
{
switch(_currentView)
{
case viewtypes.All:
return true;
case viewtypes.Linked:
return bLinked;
case viewtypes.Unlinked:
return !bLinked;
}
return true;
}
private void gridAya_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
if((bool)e.Row.Cells["Linked"].Value == true)
{
e.Row.Cells["Name"].Appearance.Image = Resource.Link24;
}
}
private void gridQB_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
if((bool)e.Row.Cells["Linked"].Value == true)
{
e.Row.Cells["Name"].Appearance.Image = Resource.Link24;
}
}
#endregion
#region Toolbar
private void tbManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
switch (e.Tool.Key)
{
case "Linked items only": // StateButtonTool
if(_currentView==viewtypes.Linked) return;
_currentView=viewtypes.Linked;
Initialize();
break;
case "Unlinked items only": // StateButtonTool
if(_currentView==viewtypes.Unlinked) return;
_currentView=viewtypes.Unlinked;
Initialize();
break;
case "All items linked or unlinked": // StateButtonTool
if(_currentView==viewtypes.All) return;
_currentView=viewtypes.All;
Initialize();
break;
case "Clients": // ButtonTool
//do nothing if same
if(_Type==RootObjectTypes.Client) return;
_Type=RootObjectTypes.Client;
this.Text="Map / Import - Clients";
Initialize();
break;
case "Service rate": // ButtonTool
if(_Type==RootObjectTypes.Rate && _currentRateType==RateTypes.Service) return;
_Type=RootObjectTypes.Rate;
this._currentRateType=RateTypes.Service;
this.Text="Map / Import - Service rates";
Initialize();
break;
case "Travel rate": // ButtonTool
if(_Type==RootObjectTypes.Rate && _currentRateType==RateTypes.Travel) return;
_Type=RootObjectTypes.Rate;
this._currentRateType=RateTypes.Travel;
this.Text="Map / Import - Travel rates";
Initialize();
break;
case "Parts": // ButtonTool
//do nothing if same
if(_Type==RootObjectTypes.Part) return;
_Type=RootObjectTypes.Part;
this.Text="Map / Import - Parts";
Initialize();
if(!Util.PTI.Maps.ContainsType(RootObjectTypes.Vendor))
{
MessageBox.Show(
"If you plan on importing Peachtree items into AyaNova parts\r\n" +
"we recommend you import or link Peachtree vendors first.\r\n\r\n" +
"This will ensure items in Peachtree with a preferred vendor\r\n" +
"are imported into AyaNova as parts with their Wholesaler field \r\n"+
"set in AyaNova to a matching Peachtree vendor",
"No Peachtree vendors are linked");
}
break;
case "Manufacturer ": // ButtonTool
if(_Type==RootObjectTypes.Vendor && _currentVendorType==VendorTypes.Manufacturer) return;
_Type=RootObjectTypes.Vendor;
_currentVendorType=VendorTypes.Manufacturer;
this.Text="Map / Import - Manufacturers";
Initialize();
break;
case "Shipper ": // ButtonTool
if(_Type==RootObjectTypes.Vendor && _currentVendorType==VendorTypes.Shipper) return;
_Type=RootObjectTypes.Vendor;
_currentVendorType=VendorTypes.Shipper;
this.Text="Map / Import - Shippers";
Initialize();
break;
case "SubContractor ": // ButtonTool
if(_Type==RootObjectTypes.Vendor && _currentVendorType==VendorTypes.SubContractor) return;
_Type=RootObjectTypes.Vendor;
_currentVendorType=VendorTypes.SubContractor;
this.Text="Map / Import - Sub contractors";
Initialize();
break;
case "Third party repair center": // ButtonTool
if(_Type==RootObjectTypes.Vendor && _currentVendorType==VendorTypes.ThirdPartyRepair) return;
_Type=RootObjectTypes.Vendor;
_currentVendorType=VendorTypes.ThirdPartyRepair;
this.Text="Map / Import - Third party repair centers";
Initialize();
break;
case "Wholesaler": // ButtonTool
if(_Type==RootObjectTypes.Vendor && _currentVendorType==VendorTypes.Wholesaler) return;
_Type=RootObjectTypes.Vendor;
_currentVendorType=VendorTypes.Wholesaler;
this.Text="Map / Import - Wholesalers and suppliers";
Initialize();
break;
case "Auto link": // ButtonTool
AutoLink();
Initialize();
break;
}
}
#endregion
#region drag n drop & Grid events
private bool m_dragging=false;
#region AyaGrid
private void gridAya_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
return;
Point gridPoint = new Point(e.X, e.Y);
UIElement element = gridAya.DisplayLayout.UIElement.ElementFromPoint(gridPoint);
if (element != null)
{
Type selectedType = element.GetContext().GetType();
if (selectedType == typeof(UltraGridRow)
//|| selectedType == typeof(UltraGridCell)
//|| selectedType == typeof(UltraGridColumn)
)
m_dragging = true;
}
}
private void gridAya_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
m_dragging = false;
}
private void gridAya_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left && m_dragging
&& gridAya.Selected.Rows.Count > 0 && !gridAya.Selected.Rows[0].IsAddRow)
{
GridRowMoveData moveData = new GridRowMoveData(gridAya,false);
gridAya.DoDragDrop(moveData, DragDropEffects.Link);
}
}
private void gridAya_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(GridRowMoveData)))
{
e.Effect = DragDropEffects.Link;
}
else
e.Effect = DragDropEffects.None;
}
private void gridAya_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Effect == DragDropEffects.Link)
{
GridRowMoveData moveData =
(GridRowMoveData)e.Data.GetData(typeof(GridRowMoveData));
if(gridAya.Equals(moveData.Source))
return; // don't allow drop on same grid
//Get the row being dropped onto
UltraGridRow rowdrop=GetDropRow(gridAya,e);
if (rowdrop != null)
{
if(rowdrop.IsTemplateAddRow)
{
if(MessageBox.Show(
"Import and link the selected Peachtree objects into AyaNova.\r\n\r\n" +
"Are you sure?","Import Peachtree objects",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
==DialogResult.No) return;
ImportToAyaNova(moveData);
switch(_Type)
{
case RootObjectTypes.Client:
Util.PopulateAyaClientList();
break;
case RootObjectTypes.Vendor:
Util.PopulateAyaVendorList();
break;
case RootObjectTypes.Rate:
Util.PopulateAyaRateList();
break;
case RootObjectTypes.Part:
Util.PopulateAyaPartList();
break;
}
Initialize();
}
else
{
if(moveData.Rows.Count>1)
{
MessageBox.Show("You can not link more than one Peachtree\r\n" +
"object to a single AyaNova object","Not supported",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
else
{
PTNameID q=(PTNameID)moveData.Rows[0];
if(MessageBox.Show(
"Link the Peachtree object: " + q.Name + "\r\n" +
"to the AyaNova object: " + rowdrop.Cells["Name"].Value.ToString() + "\r\n\r\n" +
"Are you sure?","Link Peachtree object",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
==DialogResult.No) return;
//ok, link away...
Guid dropID=(Guid)rowdrop.Cells["ID"].Value;
IntegrationMap m=null;
//Is it already present?
if(Util.PTI.Maps.Contains(dropID))
{
m=Util.PTI.Maps[dropID];
m.ForeignID=q.ID;
m.Name=q.Name;
m.LastSync=System.DateTime.Now;
}
else
{
//not already present, so add it
m=Util.PTI.Maps.Add(Util.PTI);
m.RootObjectID=dropID;
m.RootObjectType=_Type;
m.ForeignID=q.ID;
m.Name=q.Name;
m.LastSync=System.DateTime.Now;
}
Util.PTI=(Integration)Util.PTI.Save();
Initialize();
//this.Text="STUB: Drop op " + moveData.Rows.Count + " rows dropped on " + rowdrop.Cells["Name"].Value.ToString();
}
}
}
}
}
/// <summary>
/// Handle a click on an item
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void gridAya_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
{
AyaMapDetails m=new AyaMapDetails();
m.ObjectDescription=e.Cell.Value.ToString();
m.IsLinked=(bool)e.Cell.Row.Cells["Linked"].Value;
bool bWasLinked=m.IsLinked;
IntegrationMap im=null;
if(bWasLinked)
{
im=Util.PTI.Maps[(Guid)e.Cell.Row.Cells["ID"].Value];
m.LinkedToDescription=im.Name;
}
else
m.LinkedToDescription="Not linked";
if(m.ShowDialog()!=DialogResult.OK) return;
//Unlinked?
if(m.IsLinked==false && bWasLinked)
{
Util.PTI.Maps.Remove(im);
Util.PTI=(Integration)Util.PTI.Save();
Initialize();
}
}
#endregion ayagrid
#region PT Grid
private void gridQB_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button != MouseButtons.Left)
return;
Point gridPoint = new Point(e.X, e.Y);
UIElement element = gridPT.DisplayLayout.UIElement.ElementFromPoint(gridPoint);
if (element != null)
{
Type selectedType = element.GetContext().GetType();
if (selectedType == typeof(UltraGridRow)
//|| selectedType == typeof(UltraGridCell)
//|| selectedType == typeof(UltraGridColumn)
)
m_dragging = true;
}
}
private void gridQB_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
m_dragging = false;
}
private void gridQB_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left && m_dragging
&& gridPT.Selected.Rows.Count > 0 && !gridPT.Selected.Rows[0].IsAddRow)
{
GridRowMoveData moveData = new GridRowMoveData(gridPT,true);
gridPT.DoDragDrop(moveData, DragDropEffects.Link);
}
}
private void gridQB_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(GridRowMoveData)))
e.Effect = DragDropEffects.Link;
else
e.Effect = DragDropEffects.None;
}
private void gridQB_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Effect == DragDropEffects.Link)
{
GridRowMoveData moveData =
(GridRowMoveData)e.Data.GetData(typeof(GridRowMoveData));
if(gridPT.Equals(moveData.Source))
return; // don't allow drop on same grid
//Get the row being dropped onto
UltraGridRow rowdrop=GetDropRow(gridPT,e);
if (rowdrop != null)
{
//IMPORT?
if(rowdrop.IsTemplateAddRow)
{
if(MessageBox.Show(
"Import and link the selected AyaNova objects into Peachtree.\r\n\r\n" +
"Are you sure?","Import AyaNova objects",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
==DialogResult.No) return;
ImportToPeachtree(moveData);
Initialize();
}
else
{//LINKING
LinkAyaObjectToQBConfirm d=new LinkAyaObjectToQBConfirm();
d.ToLabel="To Peachtree object:\r\n" + rowdrop.Cells["Name"].Value.ToString();
DataTable dtTemp=new DataTable();
dtTemp.Columns.Add("Name",typeof(string));
foreach(object o in moveData.Rows)
{
dtTemp.Rows.Add(new object[] {((AyaNameID)o).Name});
}
d.DTRows=dtTemp;
if(d.ShowDialog()!=DialogResult.OK) return;
//
// PTNameID q=(PTNameID)moveData.Rows[0];
// if(MessageBox.Show(
// "Link the AyaNova object(s): " + q.Name + "\r\n" +
// "to the Peachtree object: " + + "\r\n\r\n" +
// "Are you sure?","Link Peachtree object",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
// ==DialogResult.No) return;
//ok, link away...
foreach(object o in moveData.Rows)
{
//qb listid
string dropID=rowdrop.Cells["ID"].Value.ToString();
string dropName=rowdrop.Cells["Name"].Value.ToString();
IntegrationMap m=null;
//Is AyaNova object already mapped?
if(Util.PTI.Maps.Contains(((AyaNameID)o).ID))
{
//Get the mapping
m=Util.PTI.Maps[((AyaNameID)o).ID];
//Is it already linked to the selected qb object?
//Yes so do nothing and continue on to the next object
if(m.ForeignID==dropID)
continue;
else
{
//No, AyaNova object was mapped elsewhere, prompt user if this is ok
if(MessageBox.Show(
"AyaNova object: " + ((AyaNameID)o).Name + "\r\n" +
"Is already linked to Peachtree object: " + m.Name + "\r\n" +
"Do you really want to change the link to the Peachtree object: " + dropName + "\r\n",
"Change link?",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
==DialogResult.No) continue;
}
//If we're here it's because the object is already mapped
//but the users has signified they want to change the map to another object so...
m.ForeignID=dropID;
m.Name=rowdrop.Cells["Name"].Value.ToString();
m.LastSync=System.DateTime.Now;
}
else
{
//not already present, so add it, easy peasy...
m=Util.PTI.Maps.Add(Util.PTI);
m.RootObjectID=((AyaNameID)o).ID;
m.RootObjectType=_Type;
m.ForeignID=dropID;
m.Name=dropName;
m.LastSync=System.DateTime.Now;
}
}
Util.PTI=(Integration)Util.PTI.Save();
Initialize();
//this.Text="STUB: Drop op " + moveData.Rows.Count + " rows dropped on " + rowdrop.Cells["Name"].Value.ToString();
}
}
}
}
/// <summary>
/// Handle click on item in grid
/// (for unlinking and viewing details)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void gridQB_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
{
QBMapDetails d=new QBMapDetails();
string qbid=e.Cell.Row.Cells["ID"].Value.ToString();
d.ToLabel="Currently linked to Peachtree object:\r\n" + e.Cell.Row.Cells["Name"].Value.ToString();
DataTable dtTemp=new DataTable();
dtTemp.Columns.Add("ID",typeof(Guid));
dtTemp.Columns.Add("AyaNova object",typeof(string));
dtTemp.Columns.Add("Linked",typeof(bool));
foreach(IntegrationMap m in Util.PTI.Maps)
{
if(m.RootObjectType==_Type && m.ForeignID==qbid)
dtTemp.Rows.Add(new object[] {m.RootObjectID,FetchAyaNovaName(m.RootObjectID),true});
}
d.DTRows=dtTemp;
if(d.ShowDialog()!=DialogResult.OK) return;
bool bChanges=false;
foreach(DataRow dr in dtTemp.Rows)
{
if((bool)dr["Linked"]==false)
{
Util.PTI.Maps.Remove(Util.PTI.Maps[(Guid)dr["ID"]]);
bChanges=true;
}
}
if(bChanges)
{
Util.PTI=(Integration)Util.PTI.Save();
Initialize();
}
}
#endregion PT Grid
#region Drop target
/// <summary>
/// Takes a grid and drag event arg and returns the
/// row that was dropped onto
/// </summary>
/// <param name="grid"></param>
/// <param name="e"></param>
/// <returns></returns>
private UltraGridRow GetDropRow(UltraGrid grid, System.Windows.Forms.DragEventArgs e)
{
UltraGridRow rowdrop=null;
UIElement element = grid.DisplayLayout.UIElement.ElementFromPoint(grid.PointToClient(new Point(e.X,e.Y)));
if(element!=null)
rowdrop=(UltraGridRow)element.GetContext(typeof(UltraGridRow));
return rowdrop;
}
#endregion
#region GridMovementData
public struct PTNameID
{
public string Name;
public string ID;
}
public struct AyaNameID
{
public string Name;
public Guid ID;
}
/// <summary>
/// A class to hold dragging data for drop
/// </summary>
public class GridRowMoveData
{
private UltraGrid m_source;
private ArrayList m_rows;
private bool m_isQBData;
public GridRowMoveData(UltraGrid source, bool IsQBData)
{
if (source == null)
throw new ArgumentNullException("source");
m_isQBData=IsQBData;
m_source = source;
m_rows = GetRowsFromSource();
}
public UltraGrid Source {get{return m_source;}}
public ArrayList Rows {get{return m_rows;}}
private ArrayList GetRowsFromSource()
{
ArrayList selectedRows = new ArrayList(Source.Selected.Rows.Count);
for (int i = 0; i < Source.Selected.Rows.Count; i++)
{
if(m_isQBData)
{
PTNameID q=new PTNameID();
q.ID=Source.Selected.Rows[i].Cells["ID"].Value.ToString();
q.Name=Source.Selected.Rows[i].Cells["Name"].Value.ToString();
selectedRows.Add(q);
}
else
{
AyaNameID a=new AyaNameID();
a.ID=(Guid)Source.Selected.Rows[i].Cells["ID"].Value;
a.Name=Source.Selected.Rows[i].Cells["Name"].Value.ToString();
selectedRows.Add(a);
}
}
return selectedRows;
}
}
#endregion gridrowmovedata
#region Import to AyaNova
private void ImportToAyaNova(GridRowMoveData moveData)
{
this.Refresh();
Cursor.Current=Cursors.WaitCursor;
ArrayList alErrors=new ArrayList();
Waiting w=new Waiting();
w.Show();
w.Ops="Importing from Peachtree...";
try
{
switch(_Type)
{
case RootObjectTypes.Client:
foreach(object o in moveData.Rows)
{
w.Step=((PTNameID)o).Name;
Util.ImportPTCustomer(((PTNameID)o).ID,alErrors);
}
break;
case RootObjectTypes.Vendor:
foreach(object o in moveData.Rows)
{
w.Step=((PTNameID)o).Name;
Util.ImportPTVendor(((PTNameID)o).ID,this._currentVendorType,alErrors);
}
break;
case RootObjectTypes.Rate:
foreach(object o in moveData.Rows)
{
w.Step=((PTNameID)o).Name;
Util.ImportPTRate(((PTNameID)o).ID,this._currentRateType,_MostLikelyRateUnitChargeDescriptionID,alErrors);
}
break;
case RootObjectTypes.Part:
foreach(object o in moveData.Rows)
{
w.Step=((PTNameID)o).Name;
Util.ImportPTPart(((PTNameID)o).ID,alErrors);
}
break;
default:
throw new System.NotSupportedException("ImportToAyaNova: NOT SUPPORTED (STUB): " + _Type.ToString());
}
//display errors if any
if(alErrors.Count!=0)
{
w.Visible=false;
StringBuilder sb=new StringBuilder();
sb.Append("Import completed with some errors:\r\n\r\n");
foreach(object o in alErrors)
{
sb.Append((string)o);
sb.Append("\r\n************\r\n");
}
CopyableMessageBox cb=new CopyableMessageBox(sb.ToString());
cb.ShowDialog();
}
}
catch(Exception ex)
{
w.Visible=false;
CopyableMessageBox cb=new CopyableMessageBox("ImportToAyaNova error: " + ex.Message);
cb.ShowDialog();
}
finally
{
w.Close();
}
}
#endregion Import to AyaNova
#region Import to Peachtree
private void ImportToPeachtree(GridRowMoveData moveData)
{
this.Refresh();
Cursor.Current=Cursors.WaitCursor;
ArrayList alErrors=new ArrayList();
Waiting w=new Waiting();
w.Show();
w.Ops="Importing from AyaNova...";
try
{
switch(_Type)
{
case RootObjectTypes.Client:
foreach(object o in moveData.Rows)
{
w.Step=((AyaNameID)o).Name;
Util.ImportAyaClient(((AyaNameID)o).ID,alErrors);
}
break;
case RootObjectTypes.Vendor:
foreach(object o in moveData.Rows)
{
w.Step=((AyaNameID)o).Name;
Util.ImportAyaVendor(((AyaNameID)o).ID,alErrors);
}
break;
case RootObjectTypes.Rate:
MessageBox.Show("Rates are not currently not importable to Peachtree");
break;
default:
throw new System.NotSupportedException("ImportToPeachtree: NOT SUPPORTED (STUB): " + _Type.ToString());
}
//display errors if any
if(alErrors.Count!=0)
{
w.Visible=false;
StringBuilder sb=new StringBuilder();
sb.Append("Import completed with some errors:\r\n\r\n");
foreach(object o in alErrors)
{
sb.Append((string)o);
sb.Append("\r\n************\r\n");
}
CopyableMessageBox cb=new CopyableMessageBox(sb.ToString());
cb.ShowDialog();
cb.Dispose();
}
}
catch(Exception ex)
{
CopyableMessageBox cb=new CopyableMessageBox("ImportToPeachtree error: " + ex.Message);
cb.ShowDialog();
cb.Dispose();
}
finally
{
w.Close();
}
}
#endregion importtoqb
#endregion dragndrop
#region AyaNova object namefetcher
/// <summary>
/// Fetches an AyaNova name based on the current
/// object type
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
private string FetchAyaNovaName(Guid id)
{
switch(_Type)
{
case RootObjectTypes.Client:
if(Util.AyaClientList.Contains(id))
return Util.AyaClientList[id].Name;
else
return "??Not found / deleted";
case RootObjectTypes.Vendor:
if(Util.AyaVendorList.Contains(id))
return Util.AyaVendorList[id].Name;
else
return "??Not found / deleted";
case RootObjectTypes.Rate:
if(Util.AyaRateList.Contains(id))
return Util.AyaRateList[id].Name;
else
return "??Not found / deleted";
case RootObjectTypes.Part:
if(Util.AyaPartList.Contains(id))
return Util.AyaPartList[id].DisplayName(Util.GlobalSettings.DefaultPartDisplayFormat);//Changed: 21-June-2006 to use display formatted name
else
return "??Not found / deleted";
default:
throw new System.NotSupportedException("FetchAyaNovaName: NOT SUPPORTED TYPE (STUB):" + _Type.ToString());
}
}
#endregion
#region AutoLink
/// <summary>
/// Attempt to match up unlinked items
/// from PT to AyaNova for the currently selected
/// list
/// </summary>
private void AutoLink()
{
//Loop through the current AyaNova list
//foreach unlinked item
// loop through the qb current list and if any names match then
// Link the two
Waiting w=new Waiting();
w.Show();
w.Ops="Autolinking matching items...";
try
{
switch(_Type)
{
case RootObjectTypes.Client:
#region client
foreach(ClientPickList.ClientPickListInfo i in Util.AyaClientList)
{
if(i.Active)
{
bool bLinked=Util.PTI.Maps.Contains(i.ID);
if(!bLinked)
{
foreach(DataRow dr in Util.PTClients.Rows)
{
if(dr["FullName"].ToString()==i.Name)
{
w.Step=i.Name;
DoLink(i.ID,_Type,dr["ID"].ToString(),i.Name);
}
}
}
}
}
#endregion client
break;
case RootObjectTypes.Vendor:
#region Vendor
foreach(VendorPickList.VendorPickListInfo i in Util.AyaVendorList)
{
if(i.Active && i.VendorType==_currentVendorType)
{
bool bLinked=Util.PTI.Maps.Contains(i.ID);
if(!bLinked)
{
foreach(DataRow dr in Util.PTVendors.Rows)
{
if(dr["FullName"].ToString()==i.Name)
{
w.Step=i.Name;
DoLink(i.ID,_Type,dr["ID"].ToString(),i.Name);
}
}
}
}
}
#endregion Vendor
break;
case RootObjectTypes.Rate:
#region Service rates
foreach(RatePickList.RatePickListInfo i in Util.AyaRateList)
{
if(i.Active && i.RateType==_currentRateType )
{
bool bLinked=Util.PTI.Maps.Contains(i.ID);
if(!bLinked)
{
foreach(DataRow dr in Util.PTItems.Rows)
{
if(dr["FullName"].ToString()==i.Name)
{
w.Step=i.Name;
DoLink(i.ID,_Type,dr["ID"].ToString(),i.Name);
}
}
}
}
}
#endregion Rate
break;
case RootObjectTypes.Part:
#region Service parts
foreach(PartPickList.PartPickListInfo i in Util.AyaPartList)
{
if(i.Active )
{
bool bLinked=Util.PTI.Maps.Contains(i.ID);
if(!bLinked)
{
foreach(DataRow dr in Util.PTItems.Rows)
{
if(dr["SalesDesc"].ToString()==i.Name
|| dr["ID"].ToString()==i.PartNumber
)
{
w.Step=i.Name;
DoLink(i.ID,_Type,dr["ID"].ToString(),i.Name);
}
}
}
}
}
#endregion Part
break;
}
w.Visible=false;
Initialize();
}
catch(Exception ex)
{
w.Visible=false;
CopyableMessageBox cb=new CopyableMessageBox("ImportToAyaNova error: " + ex.Message);
cb.ShowDialog();
}
finally
{
w.Close();
}
}
#region Link PT Item to AyaNova item
private void DoLink(Guid AyaID, RootObjectTypes objectType, string PTListID, string QBName)
{
IntegrationMap m=Util.PTI.Maps.Add(Util.PTI);
m.RootObjectID=AyaID;
m.RootObjectType=objectType;
m.ForeignID=PTListID;
m.Name=QBName;
m.LastSync=System.DateTime.Now;
Util.PTI=(Integration)Util.PTI.Save();
}
#endregion
#endregion autolink
}
}