using System; using System.Collections.Generic; using System.Linq; using System.Text; using AyaNova.PlugIn; using GZTW.AyaNova.BLL; using System.ComponentModel; using System.Windows.Forms; using System.Reflection; using System.Data; namespace AyaNova.Plugin.RepairTekCPC { class RepairTek : IAyaNovaPlugin { //Keep all the object types we want to deal with in a collection //so that we can quickly check it when asked private static List ObjectsWeCanDealWith = null; //Holds the image resources from AyaNova //so we can display the correct icons in our plugin System.Resources.ResourceManager resman = null; //Holds the current logged in user's localized text //lookup object LocalizedTextTable LocaleText = null; #region IAyaNovaPlugin Members #region interface properties public string PluginName { get { return "RepairTek - Pulse/Assign Output"; } } public string PluginVersion { get { return "7.2"; } } public string About { get { return "AyaNova RepairTek - Pulse/Assign Output plugin\r\n" + "Copyright 2009-2014 Ground Zero Tech-Works Inc."; } } public Guid PluginID { get { return new Guid("{2724874F-0C4B-4421-9FE3-0B6B00DADEED}"); } } public System.Drawing.Image PluginSmallIcon { get { return null; } } public System.Drawing.Image PluginLargeIcon { get { return null; } } public System.Resources.ResourceManager AyaNovaResourceManager { set { resman = value; } get { return resman; } } #endregion interface properties #region Initialization and Close public bool Initialize(Version AyaNovaVersion, LocalizedTextTable localizedText) { LocaleText = localizedText; ObjectsWeCanDealWith = new List(); ObjectsWeCanDealWith.Add(RootObjectTypes.Workorder); ObjectsWeCanDealWith.Add(RootObjectTypes.WorkorderService); return true; } public void Close() { ; } #endregion Initialization and close #region ShowMenu? public bool SingleObjectMenuShow(RootObjectTypes objectType) { return (ObjectsWeCanDealWith.Contains(objectType)); } public bool MultipleObjectsMenuShow(RootObjectTypes objectType) { return false; } #endregion show menu? #region Menu options public List SingleObjectMenuOptions(RootObjectTypes objectType, object ayaNovaObject) { if (!ObjectsWeCanDealWith.Contains(objectType)) return null; List list = new List(); list.Add(new AyaNovaPluginMenuItem("REPAIRTEK5", "RepairTek - Pulse/Assign Output", null, null)); return list; } public List MultipleObjectsMenuOptions(RootObjectTypes objectType) { return null; } #endregion #region Menu Commands #region LIST OBJECT COMMAND /// /// LIST OBJECT /// /// /// /// /// /// public bool CommandSelectedForList(string commandKey, RootObjectTypes objectType, List objectIDList, object listObject) { return false; } #endregion list object command #region SINGLE OBJECT COMMAND /// /// SINGLE OBJECT /// /// /// /// public void CommandSelectedForSingleObject(string commandKey, RootObjectTypes objectType, object ayaNovaObject) { switch (commandKey) { case "REPAIRTEK5": { GoPulseForm(ayaNovaObject as Workorder); } break; } } #endregion single object command #endregion menu commands #endregion /* THIS IS THE "REPAIRTEK Pulse/Assign Output" PLUGIN - REPAIRTEK5 */ #region REPAIRTEK Pulse/Assign Output - Show copyable form based on current workorder #region specifications /* * *Please create 3rd plugin with name "Pulse/Assign Output": Plugin to be accessible from the service workorder entry screen Plugin menu Plugin when selected to do the following: Plugin confirms that workorder is not dirty (if is dirty, requests user to save workorder - so that user can edit if needed before continuing) Form displays. Form has two COPY buttons with corresponding displayed text (so end user can see what is being copied) First COPY button is next to (and would copy to computer's clipboard) the displayed preset text and data 2014-10-29 (displays current date in yyyy-mm-dd format) Assigned RMA # 123456 ('Assigned RMA #' is fixed preset text, and '123456' is the number of the workorder currently opened) (note that yes, each is to be on its own line, no extra row of space between) Second COPY button is next to (and would copy to computer's clipboard) the displayed preset text and data 2014-10-29 (displays current date in yyyy-mm-dd format) Received PDT S/N 12345678910 ('Received PDT S/N' is fixed preset text, and '1234567891' is the Unit serial number from workorder currently opened) Replacement PDT S/N 98765432101 ('Replacement PDT S/N' is fixed preset text, and '98765432101' is the WorkorderItem.Label.Technotes field from workorder currently opened) Tracking # 1234567891234567 ('Tracking #' is fixed preset text, and '1234567891234567' is the Workorder.Label.InternalReferenceNumber field from workorder currently opened) (note that yes, each is to be on its own line, no extra rows of space between) Exit button on form (returns to service workorder entry screen). User could select plugin as many times as needed for a workorder or any workorder. * * */ /* * Implementation notes: Number of space characters between static text and numbers from workorder in examples provided is inconsistent. Some are one space, others are 2 or three spaces. * Assuming this is just a typo we opted for a single space character instead. If this is not a typo let us know and we will adjust it accordingly. */ #endregion specifications /// /// Show copy form /// private void GoPulseForm(Workorder w) { if (w.IsDirty) { MessageBox.Show("This workorder has changes that have not been saved!\r\nPlease save before proceeding."); return; } if (w.WorkorderItems.Count < 1 || w.WorkorderItems[0].UnitID == Guid.Empty) { MessageBox.Show("This workorder has no unit!"); return; } else { CopyDataForm d = new CopyDataForm(w); d.ShowDialog(); } } #endregion Pulse/assign } }