コード例 #1
0
 /// <summary>
 /// Write a message to a station's window.
 /// </summary>
 /// <param name="oCSM">ITisClientServicesModule object.</param>
 /// <param name="sMessage">The message to send.</param>
 /// <example><code>WriteToStationWindow(oCSM,"YourMessage");</code> </example>
 public static void WriteToStationWindow(ITisClientServicesModule oCSM, String sMessage)
 {
     if (oCSM != null)
     {
         oCSM.ModuleAccess.DoAction(CCEnums.CCNames.ReportMessage.ToString(), DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " - " + sMessage);
     }
 }
コード例 #2
0
        /// <summary>
        /// Stamp the specified collection with the CustomDll version..
        /// </summary>
        ///<param name="csm"></param>
        /// <param name="collection">The collection to stamp.</param>
        /// <param name="staticData">Data that is stored statically.</param>
        /// <returns>A string with the DLL version.</returns>
        public static string StampStationDll(ITisClientServicesModule csm, ITisCollectionData oColl, string staticData)
        {
            StringBuilder result = new StringBuilder();

            try
            {
                if (!Disabled && oColl != null)
                {
                    //-- Get previous data --\\
                    string appName = csm != null ? csm.Session.StationName : Path.GetFileNameWithoutExtension(Application.ExecutablePath);

                    result.Append(oColl.get_NamedUserTags("DLL_VERSION_" + appName));
                    if (result.Length > 0)
                    {
                        result.Append("\r\n");
                    }

                    //-- Add environment data --\\
                    result.Append(staticData ?? string.Empty);

                    result.Append(", Time=" + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));

                    //-- Set DLL name and version --\\s
                    oColl.set_NamedUserTags("DLL_VERSION_" + appName, result.ToString());
                }
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }

            return(result.ToString());
        }
コード例 #3
0
        /// <summary>
        /// Get all (collection level) attachments.
        /// </summary>
        /// <param name="csm"></param>
        /// <param name="fm"></param>
        /// <returns></returns>
        public static String[] GetAttachments(ITisClientServicesModule csm, ITisAttachedFileManager fm)
        {
            List <String> result = new List <String>();

            try
            {
                IStringVectorReadOnly rvc = fm.QueryAllAttachments();
                if (rvc != null && rvc.Count > 0)
                {
                    foreach (String s in rvc)
                    {
                        String fullPath = csm == null ? s : Path.Combine(csm.PathLocator.get_Path(CCEnums.CCFilesExt.TIF.ToString()), s);
                        if (csm == null || File.Exists(fullPath))
                        {
                            result.Add(fullPath);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }
            return(result.ToArray());
        }
コード例 #4
0
 /// <summary>
 /// Write a message to a station's window.
 /// </summary>
 /// <param name="oCSM">ITisClientServicesModule object.</param>
 /// <param name="sMessage">The message to send.</param>
 /// <param name="simpleString">A dummy variable to differentiate this function (write a simple string message)</param>
 /// <example><code>WriteToStationWindow(oCSM,"YourMessage",true);</code></example>
 public static void WriteToStationWindow(ITisClientServicesModule oCSM, String sMessage, bool simpleString)
 {
     if (oCSM != null)
     {
         oCSM.ModuleAccess.DoAction(CCEnums.CCNames.ReportMessage.ToString(), sMessage);
     }
 }
コード例 #5
0
        /// <summary>
        /// This mehtod put active collection on hold (in Custom or SimpleAuto stations)
        /// If collection is given in parmeter then given collection is put on hold.
        /// </summary>
        /// <param name="csm">eFlows Client Service Module</param>
        /// <param name="collection">Collection to hold.</param>
        public static void HoldCollection(ITisClientServicesModule csm, ITisCollectionData collection)
        {
            if (collection != null && csm != null)
            {
                try
                {
                    WriteToStationWindow(csm, String.Format("Collection [{0}] will be put on   -> HOLD <-", collection.Name));

                    List <String> collections = new List <String>(csm.Dynamic.AvailableCollectionNames);

                    if (collections.Contains(collection.Name))
                    {
                        csm.Dynamic.FreeSpecificCollection(collection, false);
                        csm.DynamicManage.SetCollectionHoldStateByName(collection.Name, true);
                    }
                    else
                    {
                        ILog.LogInfo("Collection {0} is not available in the [{1}] station collections", collection.Name, csm.Session.StationName);
                    }
                }
                catch (Exception ex)
                {
                    ILog.LogError(ex);
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// [Static] Batch.CorePut() --> Core / heart of Put, Reject or Free collection.
        /// </summary>
        private static void CorePut(ref ITisClientServicesModule csm, string CollectionName, string method, bool put)
        {
            ITisCollectionData Collection = csm.Dynamic.GetSpecificCollection(CollectionName, false);

            if (csm != null)
            {
                if (method == Constants.cStrPutMethod)
                {
                    csm.Dynamic.set_StampAsFinalByObject(Collection, put);
                }
                else
                {
                    if (method == Constants.cStrDeleteMethod)
                    {
                        csm.Dynamic.RemoveSpecificCollection(Collection);
                    }

                    else if (method == Constants.cStrRejectMethod)
                    {
                        csm.Dynamic.set_StampAsRejectByObject(Collection, true);
                    }
                }

                try
                {
                    if (method != Constants.cStrDeleteMethod)
                    {
                        csm.Dynamic.FreeSpecificCollection(Collection, put);
                    }
                }
                catch { }
            }
        }
コード例 #7
0
        // Define here your Private/Protected methods

        #region "MyClassInternals->Logout()"
        /// <summary>
        /// MyClassInternals->Logout() --> Logs out from the CSM.
        /// </summary>
        /// <returns>Returns true is successful, otherwise false.</returns>
        /// <example><code>bool result = b.Logout();</code></example>
        public virtual bool Logout()
        {
            bool result = false;

            if (oCSM != null)
            {
                try
                {
                    if (oCSM.SetupTransaction.InTransaction)
                    {
                        oCSM.SetupTransaction.RollbackTransaction();
                    }

                    oCSM.Dispose();
                    oCSM = null;
                }
                catch (Exception e)
                {
                    oCSM = null;

                    throw new Exception(Constants.cStrLiteSdkBatch + Constants.cStrLoginMethod + Constants.cStrFailedWithException +
                                        ((e.InnerException != null) ? e.InnerException.ToString() : e.ToString()));
                }
                finally
                {
                    result = true;
                }
            }

            return(result);
        }
コード例 #8
0
        public CCCollection(CCreator parent, ITisClientServicesModule csm, ITisCollectionData collection)
#endif
            : base(parent, collection != null? collection.Name:String.Empty,
                   parent == null || !parent.CurrentProfile.IgnoreExceptions ? CCUtils.GetSpecialTags(collection) : null,
                   parent == null || !parent.CurrentProfile.IgnoreNamedUserTags ? CCUtils.GetNamedUserTags(collection, false) : null,
                   parent == null || !parent.CurrentProfile.IgnoreUserTags ? CCUtils.GetUserTags(collection, true) : null)
        {
            try
            {
                Priority         = WorkflowPriorityLevel.Normal;
                FlowType         = String.Empty;
                TargetQueue      = String.Empty;
                LoginApplication = String.Empty;
                LoginStation     = String.Empty;
                ImagePath        = String.Empty;

                if (forms == null)
                {
                    forms = new List <CCForm>();
                }
                else
                {
                    forms.Clear();
                }

                this.LoginStation     = csm.Session.StationName;
                this.LoginApplication = csm.Application.AppName;
                this.ParentCollection = collection;
                this.FlowType         = collection.FlowType;
                this.EflowOwner       = collection;
                this.ImagePath        = collection.GetAttachmentFileName(CCEnums.CCFilesExt.TIF.ToString());

                #region remove the collection image path from the attachments.
                List <String> att = new List <string>();
                att.AddRange(CCUtils.GetAttachments(csm, collection.AttachedFileManager));

                for (int ia = att.Count - 1; ia >= 0; ia--)
                {
                    if (String.Compare(Path.GetFileName(att[ia]), this.ImagePath, true) == 0)
                    {
                        att.RemoveAt(ia);
                    }
                }
                #endregion

                this.Attachments = att.ToArray();

                this.Priority = collection.PriorityLevel;

                //-- Create forms --\\
                foreach (ITisFormData frm in collection.Forms)
                {
                    forms.Add(new CCForm(this.ParentCreator, frm));
                }
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }
        }
コード例 #9
0
 /// <summary>
 /// Write a message to a station's window.
 /// </summary>
 /// <param name="oCSM">ITisClientServicesModule object.</param>
 /// <param name="sFormat">The format of the message.</param>
 /// <param name="Params">The message to send.</param>
 /// <example><code>WriteToStationWindow(oCSM,"G","YourMessage");</code></example>
 public static void WriteToStationWindow(ITisClientServicesModule oCSM, String sFormat, params object[] Params)
 {
     if (oCSM != null)
     {
         String sMessage = String.Format(sFormat, Params);
         oCSM.ModuleAccess.DoAction(CCEnums.CCNames.ReportMessage.ToString(), DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " - " + sMessage);
     }
 }
コード例 #10
0
 public CCCollection(ITisClientServicesModule csm, ITisCollectionData collection)
     : this(null, csm, collection)
 {
     Priority         = WorkflowPriorityLevel.Normal;
     FlowType         = String.Empty;
     TargetQueue      = String.Empty;
     LoginApplication = String.Empty;
     LoginStation     = String.Empty;
     ImagePath        = String.Empty;
 }
コード例 #11
0
        public CCTimerSearch(ITisClientServicesModule oCSM, String configPath, String profileName)
        {
            try
            {
                CSM = oCSM;
                CollectionsCreator = new CCreator();
                if (CSM != null)
                {
                    CSM.Session.OnMessage += StationMessage;
                    workDir = CSM.PathLocator.get_Path(CCEnums.CCFilesExt.TIF.ToString());
                }

                //-- Initialize profile --\\
                if (File.Exists(configPath ?? String.Empty))
                {
                    config = CCConfiguration.FromXml(configPath);
                }
                else
                {
                    config = CCConfiguration.FromCSM(CSM);
                }

                //-- Initialize profile --\\
                if (String.IsNullOrEmpty(profileName))
                {
                    profileName = CSM.Application.AppName;
                }
                currentProfile = config != null?config.GetConfiguration(profileName) : null;

                if (currentProfile == null)
                {
                    currentProfile = new CCConfiguration.CCConfigurationData();                        //-- create a default profile --\\
                }
                //-- Define collections creator settings --\\
                CollectionsCreator.CurrentProfile = currentProfile;

                //collectionsCreator.OnPostFileLock += PostFileLock;
                CollectionsCreator.OnCollectionCreated += CollectionCreated;

                if (SearchHandler == null)
                {
                    SearchHandler = new CCSearchFiles(currentProfile);
                }
                SearchHandler.OnPostFileLock += PostFileLock;
                SearchHandler.OnPreFileLock  += PreFileLock;

                PollingTimer.Enabled = currentProfile.SearchPaths != null && currentProfile.SearchPaths.Length > 0 && currentProfile.SearchExtensions != null && currentProfile.SearchExtensions.Length > 0;
                CreateEvent();//-- fire OnCreate  event --\
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }
        }
コード例 #12
0
 /// <summary>
 /// Get the String that will represent this CSM key.
 /// </summary>
 /// <param name="csm">ITisClientServicesModule</param>
 /// <returns>The key being used to index this CSM instance.</returns>
 protected virtual String GetCsmKey(ITisClientServicesModule csm)
 {
     try
     {
         return(String.Format("{0}_{1}", csm.Application.AppName.ToUpper(), csm.Session.StationName.ToUpper()));
     }
     catch (Exception ex)
     {
         ILog.LogError(ex);
     }
     return(String.Empty);
 }
コード例 #13
0
 public override void OnPrePutCollections(ITisClientServicesModule oCSM, ref bool bCanPut)
 {
     try
     {
         foreach (ITisCollectionData cd in oCSM.Dynamic.AvailableCollections)
         {
             bCanPut           = false;
             currentCollection = cd.Name;
         }
     }
     catch { }
 }
コード例 #14
0
 public override void OnPostGetCollections(ITisClientServicesModule oCSM)
 {
     foreach (ITisCollectionData cd in oCSM.Dynamic.AvailableCollections)
     {
         using (SpLite p = new SpLite())
         {
             ITisCollectionData collec = cd;
             p.SendDataToPortal(ref collec, oCSM.Application.AppName,
                                p._getSetting(CommonConst.supplierPortalStationName), cd.Name, true);
         }
     }
 }
コード例 #15
0
 /// <summary>
 /// Write a message to a station's window.
 /// </summary>
 /// <param name="oCSM">ITisClientServicesModule object.</param>
 /// <param name="scMessages">The messages to send.</param>
 /// <example><code>
 /// StringCollection messages = new StringCollection();
 /// messages.Add("YourMessage_1");
 /// messages.Add("YourMessage_2");
 /// messages.Add("YourMessage_3");
 /// WriteToStationWindow(oCSM, messages);
 /// </code> </example>
 public static void WriteToStationWindow(ITisClientServicesModule oCSM, params String[] scMessages)
 {
     if (oCSM != null && scMessages != null)
     {
         foreach (String msg in scMessages)
         {
             if (msg != null)
             {
                 oCSM.ModuleAccess.DoAction(CCEnums.CCNames.ReportMessage.ToString(), msg);
             }
         }
     }
 }
コード例 #16
0
        /// <summary>
        /// [Static] Batch.InternalPrioritizeHoldMany() --> Places collections on Hold.
        /// </summary>
        /// <param name="CollectionNames">Indicates the collection names.</param>
        /// <param name="applicationName">Indicates the eFLOW application name.</param>
        /// <param name="stationName">Indicates the station name.</param>
        /// <param name="toStationName">Indicates the station name where to move the collection.</param>
        /// <param name="priority">Is a Priority value, which indicates the collection's priority.</param>
        /// <param name="operation">Type of operation to execute: Hold / Prioritize.</param>
        /// <param name="hold">True indicates on Hold.</param>
        /// <returns>Returns true is successful, otherwise false.</returns>
        /// <example><code>Batch.InternalPrioritizeHoldMany("SimpleDemo", "Completion", "", new string[] { "000002349_0001", "000002349_0002" }, Batch.Priority.High, Constants.cStrHoldMethod, true);</code></example>
        protected static bool InternalPrioritizeHoldMany(string applicationName, string stationName, string toStationName, string[] CollectionNames,
                                                         Priority priority, string operation, bool hold)
        {
            bool result = false;

            ITisClientServicesModule csm = null;

            if (applicationName != String.Empty && stationName != String.Empty)
            {
                if (CollectionNames != null && CollectionNames.Length > 0)
                {
                    try
                    {
                        csm = TisClientServicesModule.GetNewInstance(applicationName, stationName);

                        if (csm != null)
                        {
                            foreach (string CollectionName in CollectionNames)
                            {
                                if (CollectionName != String.Empty)
                                {
                                    CoreInternalPrioritizeHold(ref csm, stationName, toStationName, CollectionName, priority, operation, hold);
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        if (csm != null)
                        {
                            csm.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + operation + Constants.cStrFailedWithException + e,
                                                         Constants.cStrLiteSdk, TIS_SEVERITY.TIS_ERROR, 0, 0);
                        }
                        else
                        {
                            throw new Exception(Constants.cStrLiteSdkBatch + operation + Constants.cStrFailedWithException + e);
                        }
                    }
                    finally
                    {
                        if (csm != null)
                        {
                            csm.Dispose();
                        }
                        result = true;
                    }
                }
            }

            return(result);
        }
コード例 #17
0
        /// <summary>
        /// [Static] Batch.InternalHistoryMany() --> Returns a list of the stations, the collections have gone through (when processed normally through the workflow).
        /// </summary>
        /// <param name="applicationName">Indicates the eFLOW application name.</param>
        /// <param name="stationName">Indicates the station name to log on to the CSM.</param>
        /// <param name="CollectionNames">Indicates the collection names to be checked.</param>
        /// <returns>Returns a multidimensional string array if the collections have any history, otherwise returns an empty sub array per collection.</returns>
        /// <example><code>string[][] history = Batch.HistoryMany("SimpleDemo", "Completion", new string[] { "000002349_0001", "000002349_0002" });</code></example>
        protected static string[][] InternalHistoryMany(string applicationName, string stationName, string[] CollectionNames)
        {
            List <string[]> result = new List <string[]>();

            ITisClientServicesModule csm = null;

            if (applicationName != String.Empty && stationName != String.Empty)
            {
                if (CollectionNames != null && CollectionNames.Length > 0)
                {
                    try
                    {
                        csm = TisClientServicesModule.GetNewInstance(applicationName, stationName);

                        foreach (string CollectionName in CollectionNames)
                        {
                            if (CollectionName != String.Empty)
                            {
                                List <string> subresult = new List <string>();

                                CoreHistory(ref subresult, ref csm, CollectionName);

                                result.Add(subresult.ToArray());
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        if (csm != null)
                        {
                            csm.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrFailedWithException + e,
                                                         Constants.cStrLiteSdk, TIS_SEVERITY.TIS_ERROR, 0, 0);
                        }
                        else
                        {
                            throw new Exception(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrFailedWithException + e);
                        }
                    }
                    finally
                    {
                        if (csm != null)
                        {
                            csm.Dispose();
                        }
                    }
                }
            }

            return(result.ToArray());
        }
コード例 #18
0
        /// <summary>
        /// Batch->CoreFromDynamic() --> Core: Imports collection(s) given by a file name.
        /// </summary>
        protected static void CoreFromDynamic(ref List <ITisCollectionData> result, ref ITisClientServicesModule csm, string filename)
        {
            List <ITisCollectionData> temp = new List <ITisCollectionData>();

            try
            {
                UnitId[] CollectionInfo = csm.DynamicImportExport.ImportCollectionsArchive(filename);

                if (CollectionInfo != null && CollectionInfo.Length > 0)
                {
                    foreach (UnitId cInfo in CollectionInfo)
                    {
                        WFUnitInfo wf = new WFUnitInfo();                 // 5
                        wf.UnitId = cInfo.Id;                             // 5
                        //temp.Add(csm.DynamicDirectRead.AccessByWFID(cInfo.Id)); // 4.5
                        temp.Add(csm.DynamicDirectRead.AccessByWFID(wf)); // 5
                    }
                }
            }
            catch (Exception e)
            {
                csm.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrFromDynamicMethod + Constants.cStrFailedWithException +
                                             ((e.InnerException != null) ? e.InnerException.ToString() : e.ToString()), Constants.cStrLiteSdk,
                                             Log.Severity.ERROR, 0, 0);
            }
            finally
            {
                result = temp ?? null;

                if (result != null)
                {
                    if (collections == null || collections.Count == 0)
                    {
                        if (collections == null)
                        {
                            collections = new List <string>();
                        }

                        foreach (ITisCollectionData d in result)
                        {
                            if (collections.IndexOf(d.Name) < 0)
                            {
                                collections.Add(d.Name);
                            }
                        }
                    }
                }
            }
        }
コード例 #19
0
        public override void OnTimer(ITisClientServicesModule oCSM)
        {
            if (!iterating)
            {
                try
                {
                    iterating = true;
                    using (SpLite p = new SpLite())
                    {
                        string[] collections = p.GetCollectionsFromStation(oCSM.Application.AppName, oCSM.Session.StationName);

                        for (int i = 0; i <= collections.Length - 1; i++)
                        {
                            p.ForceUnlock(oCSM.Application.AppName, oCSM.Session.StationName, collections[i]);

                            using (Batch b = new Batch(oCSM.Application.AppName, oCSM.Session.StationName))
                            {
                                ITisCollectionData cd = b.Get(collections[i]);

                                bool changed = false;

                                changed = p.GetDataFromPortal(ref cd, oCSM.Application.AppName, oCSM.Session.StationName, cd.Name, String.Empty);

                                if (changed)
                                {
                                    cd.NextStation = "Validate";

                                    p.SendDataToPortal(cd, oCSM.Application.AppName, cd.NextStation, cd.Name, false, 1);
                                    b.Put(cd);
                                }
                                else
                                {
                                    p.SendDataToPortal(cd, oCSM.Application.AppName, oCSM.Session.StationName, cd.Name, false, 1);
                                    b.Free(cd);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    iterating = false;
                }
            }
        }
コード例 #20
0
 /// <summary>
 /// [Constructor] BatchInternals() --> Initializes a Batch object instance with the eFLOW application and station names.
 /// </summary>
 /// <param name="applicationName">Indicates the name of the eFLOW application to login to.</param>
 /// <param name="stationName">Indicates the name of the eFLOW station to login to.</param>
 /// <example><code>BatchInternals b = new BatchInternals("SimpleDemo", "Completion");</code></example>
 protected BatchInternals(string applicationName, string stationName)
 {
     try
     {
         oCSM = TisClientServicesModule.GetNewInstance(applicationName, stationName);
     }
     catch (Exception e)
     {
         throw new Exception(Constants.cStrLiteSdkBatch + " -> " + Constants.cStrFailedWithException, e);
     }
     finally
     {
         this.applicationName = applicationName;
         this.stationName     = stationName;
     }
 }
コード例 #21
0
 /// <summary>
 /// [Constructor] BatchInternals() --> Initializes a Batch object instance with the eFLOW application and station names.
 /// </summary>
 /// <param name="applicationName">Indicates the name of the eFLOW application to login to.</param>
 /// <param name="stationName">Indicates the name of the eFLOW station to login to.</param>
 /// <example><code>BatchInternals b = new BatchInternals("SimpleDemo", "Completion");</code></example>
 protected BatchInternals(string applicationName, string stationName)
 {
     try
     {
         oCSM = TisClientServicesModule.GetNewInstance(applicationName, stationName);
     }
     catch (Exception e)
     {
         throw new Exception(Constants.cStrLiteSdkBatch + " -> " + Constants.cStrFailedWithException, e);
     }
     finally
     {
         this.applicationName = applicationName;
         this.stationName = stationName;
     }
 }
コード例 #22
0
        /// <summary>
        /// [Static] Batch.InternalPutMany() --> Used by Put, Reject or Free collection.
        /// </summary>
        /// <param name="CollectionNames">Indicates the collection names to process.</param>
        /// <param name="applicationName">Indicates the eFLOW application name.</param>
        /// <param name="stationName">Indicates the station name to log on to the CSM.</param>
        /// <param name="put">A boolean - if true, indicates a Put collection operation, if false indicates a free collection operation.</param>
        /// <param name="method">The name of the method, either a Put, Reject or Free collection.</param>
        /// <returns>Returns true is successful (no exceptions occur), otherwise false.</returns>
        protected static bool InternalPutMany(string applicationName, string stationName, string[] CollectionNames, bool put, string method)
        {
            bool result = false;

            ITisClientServicesModule csm = null;

            if (applicationName != String.Empty && stationName != String.Empty)
            {
                if (CollectionNames != null && CollectionNames.Length > 0)
                {
                    try
                    {
                        csm = TisClientServicesModule.GetNewInstance(applicationName, stationName);

                        foreach (string CollectionName in CollectionNames)
                        {
                            if (CollectionName != String.Empty)
                            {
                                CorePut(ref csm, CollectionName, method, put);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        if (csm != null)
                        {
                            csm.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + method + Constants.cStrFailedWithException + e,
                                                         Constants.cStrLiteSdk, Log.Severity.ERROR, 0, 0);
                        }
                        else
                        {
                            throw new Exception(Constants.cStrLiteSdkBatch + method + Constants.cStrFailedWithException + e);
                        }
                    }
                    finally
                    {
                        if (csm != null)
                        {
                            csm.Dispose();
                        }
                        result = true;
                    }
                }
            }

            return(result);
        }
コード例 #23
0
        /// <summary>
        /// [Static] Batch.CoreHistory() --> Used by the InternalHistory functions.
        /// </summary>
        private static void CoreHistory(ref List <string> result, ref ITisClientServicesModule csm, string CollectionName)
        {
            ITisCollectionData Collection = csm.Dynamic.GetSpecificCollection(CollectionName, false);

            if (csm != null)
            {
                if (Collection.NumberOfHistoryTags > 0)
                {
                    for (short j = 0; j < Collection.NumberOfHistoryTags; j++)
                    {
                        result.Add(Collection.get_HistoryDataTag(j).Name);
                    }
                }
            }

            csm.Dynamic.FreeSpecificCollection(Collection, true);
        }
コード例 #24
0
        // Many
        #region "Batch.FromDynamic"
        /// <summary>
        /// [Static] Batch.FromDynamic() --> Imports collection(s) given by a file name.
        /// </summary>
        /// <param name="applicationName">Indicates the eFLOW application name.</param>
        /// <param name="stationName">Indicates the station name to logon to the CSM.</param>
        /// <param name="filename">Represents the file name from where the collection(s) will be imported.</param>
        /// <returns>Returns a string array if successful with the names of the imported collections, otherwise an empty array.</returns>
        /// <example><code>string[] collDatas = Batch.FromDynamic("SimpleDemo", "efInternal", @"c:\temp\test.dynamic");</code></example>
        public static string[] FromDynamic(string applicationName, string stationName, string filename)
        {
            List <ITisCollectionData> result       = new List <ITisCollectionData>();
            List <string>             returnResult = new List <string>();

            ITisClientServicesModule csm = null;

            if (filename != String.Empty && File.Exists(filename))
            {
                if (applicationName != String.Empty && stationName != String.Empty)
                {
                    try
                    {
                        csm = TisClientServicesModule.GetNewInstance(applicationName, stationName);

                        CoreFromDynamic(ref result, ref csm, filename);
                    }
                    catch (Exception e)
                    {
                        if (csm != null)
                        {
                            csm.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrFromDynamicMethod + Constants.cStrFailedWithException + e,
                                                         Constants.cStrLiteSdk, Log.Severity.ERROR, 0, 0);
                        }
                        else
                        {
                            throw new Exception(Constants.cStrLiteSdkBatch + Constants.cStrFromDynamicMethod + Constants.cStrFailedWithException + e);
                        }
                    }
                    finally
                    {
                        foreach (ITisCollectionData res in result)
                        {
                            returnResult.Add(res.Name);
                        }

                        if (csm != null)
                        {
                            csm.Dispose();
                        }
                    }
                }
            }

            return(returnResult.ToArray());
        }
コード例 #25
0
        // Many
        #region "Batch.ToDynamic"
        /// <summary>
        /// [Static] Batch.ToDynamic() --> Exports the collections given by CollectionNames to a .dynamic file.
        /// </summary>
        /// <param name="applicationName">Indicates the eFLOW application name.</param>
        /// <param name="stationName">Indicates the station name to logon to the CSM.</param>
        /// <param name="filename">Represents the file name where the .dynamic will be exported to.</param>
        /// <param name="CollectionNames">Represents the names of the collections to export as a .dynamic file.</param>
        /// <returns>Returns true is successful, otherwise false.</returns>
        /// <example><code>bool result = Batch.ToDynamic("SimpleDemo", "efInternal", @"c:\temp\test.dynamic", new string[] { "000002349_0001", "000002349_0002" });</code></example>
        public static bool ToDynamic(string applicationName, string stationName, string filename, string[] CollectionNames)
        {
            bool result = false;

            ITisClientServicesModule csm = null;

            if (CollectionNames != null && CollectionNames.Length > 0)
            {
                if (filename != String.Empty && Directory.Exists(Path.GetDirectoryName(filename)))
                {
                    if (applicationName != String.Empty && stationName != String.Empty)
                    {
                        try
                        {
                            csm = TisClientServicesModule.GetNewInstance(applicationName, stationName);

                            csm.DynamicImportExport.ExportCollectionsByName(filename, CollectionNames);
                        }
                        catch (Exception e)
                        {
                            if (csm != null)
                            {
                                csm.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrToDynamicMethod + Constants.cStrFailedWithException + e,
                                                             Constants.cStrLiteSdk, Log.Severity.ERROR, 0, 0);
                            }
                            else
                            {
                                throw new Exception(Constants.cStrLiteSdkBatch + Constants.cStrToDynamicMethod + Constants.cStrFailedWithException + e);
                            }
                        }
                        finally
                        {
                            if (csm != null)
                            {
                                csm.Dispose();
                            }

                            result = true;
                        }
                    }
                }
            }

            return(result);
        }
コード例 #26
0
 public override void OnTimer(ITisClientServicesModule oCSM)
 {
     if (!iterating)
     {
         try
         {
             iterating = true;
             using (SpLite p = new SpLite())
             {
                 p.CreateCollectionFromImportFolder(oCSM.Application.AppName, oCSM, "PageOCR");
             }
         }
         finally
         {
             iterating = false;
         }
     }
 }
コード例 #27
0
        /// <summary>
        /// Get all attachments as specified per station.
        /// </summary>
        /// <param name="csm"></param>
        /// <param name="stationName"></param>
        /// <param name="eflowObject"></param>
        /// <returns></returns>
        public static String[] GetAttachments(ITisClientServicesModule csm, String stationName, object eflowObject)
        {
            List <String> result = new List <String>();

            try
            {
                ITisStationParams sta = csm.Setup.get_Station(stationName);
                if (sta != null && sta.StationDeclaration != null)
                {
                    List <String> filesExt  = new List <String>();
                    List <String> filesList = new List <String>();
                    foreach (String s in sta.StationDeclaration.ReceiveAttachments)
                    {
                        if (!filesExt.Contains(s.ToLower()))
                        {
                            filesExt.Add(s.ToLower());
                        }
                    }

                    foreach (String s in sta.StationDeclaration.SaveAttachments)
                    {
                        if (!filesExt.Contains(s.ToLower()))
                        {
                            filesExt.Add(s.ToLower());
                        }
                    }


                    foreach (String s in filesExt)
                    {
                        foreach (String sf in Directory.GetFiles(csm.PathLocator.get_Path(CCEnums.CCFilesExt.TIF.ToString()), String.Format("*.{0}", s.Trim(' ', '*', '.'))))
                        {
                            filesList.Add(sf);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }
            return(result.ToArray());
        }
コード例 #28
0
        /// <summary>
        /// [Static] Batch.InternalHistory() --> Returns a list of the stations a collection has gone through (when processed normally through the workflow).
        /// </summary>
        /// <param name="applicationName">Indicates the eFLOW application name.</param>
        /// <param name="stationName">Indicates the station name.</param>
        /// <param name="CollectionName">Indicates the collection name to be checked.</param>
        /// <example><code>string[] history = Batch.InternalHistory("SimpleDemo", "Completion", "000002349_0001");</code></example>
        protected static string[] InternalHistory(string applicationName, string stationName, string CollectionName)
        {
            List <string> result = new List <string>();

            ITisClientServicesModule csm = null;

            if (applicationName != String.Empty && stationName != String.Empty)
            {
                try
                {
                    csm = TisClientServicesModule.GetNewInstance(applicationName, stationName);

                    if (CollectionName != String.Empty)
                    {
                        CoreHistory(ref result, ref csm, CollectionName);
                    }
                }
                catch (Exception e)
                {
                    if (csm != null)
                    {
                        csm.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrFailedWithException + e,
                                                     Constants.cStrLiteSdk, Log.Severity.ERROR, 0, 0);
                    }
                    else
                    {
                        throw new Exception(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrFailedWithException + e);
                    }
                }
                finally
                {
                    if (csm != null)
                    {
                        csm.Dispose();
                    }
                }
            }

            return(result.ToArray());
        }
コード例 #29
0
        /// <summary>
        /// [Static] Batch.CoreInternalPrioritizeHold() --> Core: Places a collection on Hold.
        /// </summary>
        private static void CoreInternalPrioritizeHold(ref ITisClientServicesModule csm, string stationName, string toStationName, string CollectionName,
                                                       Priority priority, string operation, bool hold)
        {
            if (operation == Constants.cStrPrioritizeMethod)
            {
                WorkflowPriorityLevel wfp = WorkflowPriorityLevel.Normal;
                double abs = 100.0;

                ReturnPriorityLevels(priority, ref wfp, ref abs);

                csm.DynamicManage.SetCollectionPriorityLevelByName(stationName, CollectionName, wfp);
            }
            else if (operation == Constants.cStrHoldMethod)
            {
                csm.DynamicManage.SetCollectionHoldStateByName(CollectionName, hold);
            }

            else if (operation == Constants.cStrMoveMethod)
            {
                csm.DynamicManage.MoveCollectionToQueueByName(CollectionName, toStationName);
            }
        }
コード例 #30
0
        /// <summary>
        /// [Constructor] MyClassInternals() --> Initializes a MyClassInternals object instance with the eFLOW application and station names.
        /// </summary>
        /// <param name="applicationName">Indicates the name of the eFLOW application to login to.</param>
        /// <param name="stationName">Indicates the name of the eFLOW station to login to.</param>
        /// <example><code>MyClassInternals b = new MyClassInternals("SimpleDemo", "Completion");</code></example>
        protected MyClassInternals(string applicationName, string stationName)
        {
            try
            {
                //oCSM = TisClientServicesModule.GetNewInstance(applicationName, stationName); 4.5

                // 5
                oCSM = SingletoneTisClientServicesModule.GetSingletoneInstance();

                oCSM.Initialize(null, null, null, 0, null, null, null, null, null, null, null);
                oCSM.LoginApplication(applicationName, stationName);
            }
            catch (Exception e)
            {
                throw new Exception(Constants.cStrLiteSdkBatch + " -> " + Constants.cStrFailedWithException, e);
            }
            finally
            {
                this.applicationName = applicationName;
                this.stationName     = stationName;
            }
        }
コード例 #31
0
        public override void OnPrePutCollections(ITisClientServicesModule oCSM, ref bool bCanPut)
        {
            for (int i = 0; i <= oCSM.Dynamic.AvailableCollections.Count - 1; i++)
            {
                ITisCollectionData cd = oCSM.Dynamic.AvailableCollections.GetByIndex(0);

                using (SpLite p = new SpLite())
                {
                    bool changed = false;

                    do
                    {
                        changed = p.GetDataFromPortal(ref cd, oCSM.Application.AppName,
                                                      p._getSetting(CommonConst.supplierPortalStationName), cd.Name, "topimagesystems.com");
                    } while (!changed);

                    if (changed)
                    {
                        bCanPut = true;
                    }
                }
            }
        }
コード例 #32
0
        /// <summary>
        /// [Static] Batch.CoreHistory() --> Used by the InternalHistory functions.
        /// </summary>
        private static void CoreHistory(ref List<string> result, ref ITisClientServicesModule csm, string CollectionName)
        {
            ITisCollectionData Collection = csm.Dynamic.GetSpecificCollection(CollectionName, false);

            if (csm != null)
            {
                if (Collection.NumberOfHistoryTags > 0)
                    for (short j = 0; j < Collection.NumberOfHistoryTags; j++)
                        result.Add(Collection.get_HistoryDataTag(j).Name);
            }

            csm.Dynamic.FreeSpecificCollection(Collection, true);
        }
コード例 #33
0
        /// <summary>
        /// Batch->Logout() --> Logs out from the CSM.
        /// </summary>
        /// <returns>Returns true is successful, otherwise false.</returns>
        /// <example><code>bool result = b.Logout();</code></example>
        public virtual bool Logout()
        {
            bool result = false;

            if (oCSM != null)
            {
                try
                {
                    if (oCSM.SetupTransaction.InTransaction) oCSM.SetupTransaction.RollbackTransaction();

                    oCSM.Dispose();
                    oCSM = null;
                }
                catch (Exception e)
                {
                    oCSM = null;

                    throw new Exception(Constants.cStrLiteSdkBatch + Constants.cStrLoginMethod + Constants.cStrFailedWithException +
                        ((e.InnerException != null) ? e.InnerException.ToString() : e.ToString()));
                }
                finally
                {
                    result = true;

                    if (collections != null) collections.Clear();
                }
            }

            return result;
        }
コード例 #34
0
        /// <summary>
        /// [Static] Batch.CoreInternalPrioritizeHold() --> Core: Places a collection on Hold.
        /// </summary>
        private static void CoreInternalPrioritizeHold(ref ITisClientServicesModule csm, string stationName, string toStationName, string CollectionName,
            Priority priority, string operation, bool hold)
        {
            if (operation == Constants.cStrPrioritizeMethod)
            {
                WorkflowPriorityLevel wfp = WorkflowPriorityLevel.Normal;
                double abs = 100.0;

                ReturnPriorityLevels(priority, ref wfp, ref abs);

                csm.DynamicManage.SetCollectionPriorityLevelByName(stationName, CollectionName, wfp);
            }
            else if (operation == Constants.cStrHoldMethod)
                csm.DynamicManage.SetCollectionHoldStateByName(CollectionName, hold);

            else if (operation == Constants.cStrMoveMethod)
                csm.DynamicManage.MoveCollectionToQueueByName(CollectionName, toStationName);
        }
コード例 #35
0
        /// <summary>
        /// Batch->CoreFromDynamic() --> Core: Imports collection(s) given by a file name.
        /// </summary>
        protected static void CoreFromDynamic(ref List<ITisCollectionData> result, ref ITisClientServicesModule csm, string filename)
        {
            List<ITisCollectionData> temp = new List<ITisCollectionData>();

            try
            {
                UnitId[] CollectionInfo = csm.DynamicImportExport.ImportCollectionsArchive(filename);

                if (CollectionInfo != null && CollectionInfo.Length > 0)
                    foreach (UnitId cInfo in CollectionInfo)
                        temp.Add(csm.DynamicDirectRead.AccessByWFID(cInfo.Id));
            }
            catch (Exception e)
            {
                csm.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrFromDynamicMethod + Constants.cStrFailedWithException +
                    ((e.InnerException != null) ? e.InnerException.ToString() : e.ToString()), Constants.cStrLiteSdk,
                    TIS_SEVERITY.TIS_ERROR, 0, 0);
            }
            finally
            {
                result = temp ?? null;

                if (result != null)
                    if (collections == null || collections.Count == 0)
                    {
                        if (collections == null) collections = new List<string>();

                        foreach (ITisCollectionData d in result)
                            if (collections.IndexOf(d.Name) < 0)
                                collections.Add(d.Name);
                    }
            }
        }
コード例 #36
0
        /// <summary>
        /// [Static] Batch.CorePut() --> Core / heart of Put, Reject or Free collection.
        /// </summary>
        private static void CorePut(ref ITisClientServicesModule csm, string CollectionName, string method, bool put)
        {
            ITisCollectionData Collection = csm.Dynamic.GetSpecificCollection(CollectionName, false);

            if (csm != null)
            {
                if (method == Constants.cStrPutMethod)
                    csm.Dynamic.set_StampAsFinalByObject(Collection, put);
                else
                {
                    if (method == Constants.cStrDeleteMethod)
                        csm.Dynamic.RemoveSpecificCollection(Collection);

                    else if (method == Constants.cStrRejectMethod)
                        csm.Dynamic.set_StampAsRejectByObject(Collection, true);
                }

                try
                {
                    if (method != Constants.cStrDeleteMethod)
                        csm.Dynamic.FreeSpecificCollection(Collection, put);
                }
                catch { }
            }
        }