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

297 lines
10 KiB
C#

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace AyaNova.PlugIn.QBOI
{
/// <summary>
/// Summary description for LinkOrImportAyaObject.
/// </summary>
public class LinkOrImportAyaObject : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnImport;
private Infragistics.Win.Misc.UltraLabel lblItems;
private Infragistics.Win.UltraWinEditors.UltraComboEditor cbQBItems;
private Infragistics.Win.Misc.UltraLabel lblAyaObject;
private Infragistics.Win.Misc.UltraLabel lblOR;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public LinkOrImportAyaObject()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.btnCancel.Image = Util.AyaImage("Cancel24");
this.btnOK.Image = Util.AyaImage("OK24");
}
/// <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()
{
Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnImport = new System.Windows.Forms.Button();
this.lblAyaObject = new Infragistics.Win.Misc.UltraLabel();
this.lblItems = new Infragistics.Win.Misc.UltraLabel();
this.cbQBItems = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
this.lblOR = new Infragistics.Win.Misc.UltraLabel();
((System.ComponentModel.ISupportInitialize)(this.cbQBItems)).BeginInit();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOK.BackColor = System.Drawing.SystemColors.Control;
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(392, 221);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(102, 41);
this.btnOK.TabIndex = 32;
this.btnOK.UseVisualStyleBackColor = false;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCancel.BackColor = System.Drawing.SystemColors.Control;
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(10, 225);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(102, 40);
this.btnCancel.TabIndex = 31;
this.btnCancel.UseVisualStyleBackColor = false;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnImport
//
this.btnImport.BackColor = System.Drawing.SystemColors.Control;
this.btnImport.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnImport.Dock = System.Windows.Forms.DockStyle.Top;
this.btnImport.Location = new System.Drawing.Point(0, 135);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(504, 41);
this.btnImport.TabIndex = 33;
this.btnImport.Text = "Import to QuickBooks";
this.btnImport.UseVisualStyleBackColor = false;
this.btnImport.Visible = false;
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
//
// lblAyaObject
//
appearance1.TextVAlignAsString = "Middle";
this.lblAyaObject.Appearance = appearance1;
this.lblAyaObject.BackColorInternal = System.Drawing.SystemColors.Window;
this.lblAyaObject.Dock = System.Windows.Forms.DockStyle.Top;
this.lblAyaObject.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblAyaObject.Location = new System.Drawing.Point(0, 0);
this.lblAyaObject.Name = "lblAyaObject";
this.lblAyaObject.Size = new System.Drawing.Size(504, 36);
this.lblAyaObject.TabIndex = 34;
this.lblAyaObject.Text = "ultraLabel1";
//
// lblItems
//
appearance2.TextVAlignAsString = "Bottom";
this.lblItems.Appearance = appearance2;
this.lblItems.Dock = System.Windows.Forms.DockStyle.Top;
this.lblItems.Location = new System.Drawing.Point(0, 36);
this.lblItems.Name = "lblItems";
this.lblItems.Size = new System.Drawing.Size(504, 37);
this.lblItems.TabIndex = 36;
this.lblItems.Text = "Link to QuickBooks item:";
//
// cbQBItems
//
this.cbQBItems.Dock = System.Windows.Forms.DockStyle.Top;
this.cbQBItems.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList;
this.cbQBItems.LimitToList = true;
this.cbQBItems.Location = new System.Drawing.Point(0, 73);
this.cbQBItems.MaxDropDownItems = 16;
this.cbQBItems.Name = "cbQBItems";
this.cbQBItems.Nullable = false;
this.cbQBItems.Size = new System.Drawing.Size(504, 24);
this.cbQBItems.TabIndex = 35;
//
// lblOR
//
appearance3.TextVAlignAsString = "Bottom";
this.lblOR.Appearance = appearance3;
this.lblOR.Dock = System.Windows.Forms.DockStyle.Top;
this.lblOR.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblOR.Location = new System.Drawing.Point(0, 97);
this.lblOR.Name = "lblOR";
this.lblOR.Size = new System.Drawing.Size(504, 38);
this.lblOR.TabIndex = 37;
this.lblOR.Text = "Or import AyaNova item to QuickBooks:";
//
// LinkOrImportAyaObject
//
this.AcceptButton = this.btnOK;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(504, 287);
this.ControlBox = false;
this.Controls.Add(this.btnImport);
this.Controls.Add(this.lblOR);
this.Controls.Add(this.cbQBItems);
this.Controls.Add(this.lblItems);
this.Controls.Add(this.lblAyaObject);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.btnCancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.MinimumSize = new System.Drawing.Size(516, 306);
this.Name = "LinkOrImportAyaObject";
this.Text = "Resolve AyaNova object";
this.Load += new System.EventHandler(this.LinkOrImportAyaObject_Load);
((System.ComponentModel.ISupportInitialize)(this.cbQBItems)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private DataTable _QBItems;
private string _AyaItem;
private bool _CanImport;
private string _Choice="CANCEL";
private void LinkOrImportAyaObject_Load(object sender, System.EventArgs e)
{
Util.SetControlBackQBOIColor(this);
cbQBItems.ValueMember="ID";
cbQBItems.DisplayMember="FullName";
this.cbQBItems.DataSource=_QBItems;
//Case 237
//cbQBItems.SortStyle=Infragistics.Win.ValueListSortStyle.Ascending;
if(cbQBItems.SelectedIndex==-1)
cbQBItems.SelectedIndex=0;
this.lblAyaObject.Text=_AyaItem;
this.lblOR.Visible = this.btnImport.Visible=_CanImport;
}
private void btnImport_Click(object sender, System.EventArgs e)
{
_Choice="IMPORT";
this.DialogResult=DialogResult.OK;
this.Close();
}
private void btnOK_Click(object sender, System.EventArgs e)
{
_Choice="LINK";
}
private void btnCancel_Click(object sender, System.EventArgs e)
{
_Choice="CANCEL";
}
public DataTable QBItems
{
set
{
_QBItems=value;
}
}
public string AyaItem
{
set
{
_AyaItem=value;
}
}
public bool CanImport
{
set
{
_CanImport=value;
}
}
public string SelectedQBItem
{
get
{
return cbQBItems.SelectedItem.DataValue.ToString();
}
}
public string SelectedQBItemName
{
get
{
return cbQBItems.SelectedItem.DisplayText;
}
}
public string Choice
{
get
{
return this._Choice;
}
}
}
}