Пример #1
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());
        }
Пример #2
0
            /// <summary>
            /// "GetFieldBatchInfo" --> Returns the Field Data of particular eFlow Field as a single piped string, which is the format required by the Supplier Portal and Flexible Cloud DB.
            /// </summary>
            /// <param name="tmpUpFolder">Indicates the name of the temporary upload folder</param>
            /// <param name="appName">Indicates the eFlow App Name</param>
            /// <param name="stName">Indicates the eFlow station from where to get the field data from</param>
            /// <param name="bName">Indicates the eFlow Collection Name from where to get the field data from</param>
            /// <param name="fToCheck">Indicates which fields name to get data from</param>
            /// <param name="fn">Indicates the name of the TIFF file associated with the collection</param>
            /// <param name="origin">Indicates the location from where the collection originated from</param>
            /// <example><code>s.GetFieldBatchInfo("CLS", "FreeMatch", "00000323", "Invoice_Number|PO_Number|Total_Amount|Supplier_Name|Net_Amount1|VAT_Amount1|VAT1|Invoice_Date", out fn, out origin);</code></example>
            public static string[] GetFieldBatchInfo(string tmpUpFolder, string appName, string stName, string bName, string fToCheck, out string fn, out string origin)
            {
                List <string> result = new List <string>();

                fn     = String.Empty;
                origin = String.Empty;

                try
                {
                    using (Batch b = new Batch(appName, stName))
                    {
                        ITisCollectionData cd = b.Get(bName);

                        fn = GetFieldBatchInfoCore(tmpUpFolder, appName, fToCheck, fn, result, cd, out origin);

                        b.Free(cd);
                    }
                }
                catch (Exception ex)
                {
                    Logging.WriteLog(ex.ToString());
                }

                return(result.ToArray());
            }
Пример #3
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 { }
            }
        }
Пример #4
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);
                }
            }
        }
Пример #5
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);
            }
        }
Пример #6
0
        private void btnInstanceDelete_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Manually export collection 00000001 first through the controller, before proceeding");

            // Create a new Batch instance
            // Logs onto the CSM with "AdvancedDemo" application
            // and "FormId" station

            Batch b = new Batch("AdvancedDemo", "FormId");

            // Gets the collection "00000001"

            ITisCollectionData collData = b.Get("00000001");

            // Deletes the collection
            // even if it is locked
            b.Delete(collData);

            MessageBox.Show("collection 00000001 is gone");

            // Dispose the batch instance
            // and disconnect from the CSM

            b.Dispose();
        }
Пример #7
0
        private void btnInstancePut_Click(object sender, EventArgs e)
        {
            // Create a new Batch instance
            // Logs onto the CSM with "AdvancedDemo" application
            // and "FormId" station

            Batch b = new Batch("AdvancedDemo", "FormId");

            // Gets the collection "00000001"

            ITisCollectionData collData = b.Get("00000001");

            // Put the collection (writes it back)
            // to the CSM and moves it to the next
            // queue
            b.Put(collData);

            MessageBox.Show("Collection: " + collData.Name + " is now in the next queue (ManualId), please refresh the controller and drag it back");


            // Dispose the batch instance
            // and disconnect from the CSM

            b.Dispose();
        }
Пример #8
0
        public static CollectionOcrData FromCollection(ITisCollectionData collection)
#endif
        {
            try
            {
                if (collection != null)
                {
                    CollectionOcrData res = new CollectionOcrData();
                    res.CollectionID = collection.Name;
                    res.FlowType     = collection.FlowType;
                    List <PageOcrData> pgs = new List <PageOcrData>();

                    //-- Iterate collection pages and add them to the class Pages property. --\\
                    foreach (ITisPageData page in collection.Pages)
                    {
                        pgs.Add(PageOcrData.FromPRD(page));
                    }

                    if (pgs != null && pgs.Count > 0)
                    {
                        res.pages = pgs.ToArray();
                        return(res);
                    }
                }
                else
                {
                    throw new Exception(String.Format("ITisCollectionData specified in: [{0}] is not valid", MethodBase.GetCurrentMethod().Name));
                }
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }
            return(null);
        }
Пример #9
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;
 }
Пример #10
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);
         }
     }
 }
Пример #11
0
        /// <summary>
        /// Batch.Get() --> Retrieves a ITisCollectionData object given the collection name (if it exists), otherwise returns null.
        /// </summary>
        /// <param name="CollectionName">Is a string which indicates the name of the collection to retrieve.</param>
        /// <returns>Returns an ITisCollectionData object if the collection name exists, otherwise returns null.</returns>
        /// <example><code>ITisCollectionData collData = b.Get("000002349_0001");</code></example>
        public ITisCollectionData Get(string CollectionName)
        {
            ITisCollectionData result = null;

            if (CollectionName != String.Empty)
            {
                if (CheckLogon())
                {
                    try
                    {
                        result = oCSM.Dynamic.GetSpecificCollection(CollectionName, false);
                    }
                    catch (Exception e)
                    {
                        oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrGetMethod + Constants.cStrFailedWithException +
                                                      ((e.InnerException != null) ? e.InnerException.ToString() : e.ToString()), Constants.cStrLiteSdk,
                                                      Log.Severity.ERROR, 0, 0);
                    }
                    finally
                    {
                        if (result != null)
                        {
                            if (collections == null || collections.IndexOf(CollectionName) < 0)
                            {
                                if (collections == null)
                                {
                                    collections = new List <string>();
                                }
                                collections.Add(CollectionName);
                            }
                        }
                    }
                }
                else
                if (oCSM != null)
                {
                    oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrGetMethod + Constants.cStrCouldNotLogin, Constants.cStrLiteSdk,
                                                  Log.Severity.ERROR, 0, 0);
                }
                else
                {
                    throw new Exception(Constants.cStrLiteSdkBatch + Constants.cStrGetMethod + Constants.cStrCouldNotLogin);
                }
            }
            else
            if (oCSM != null)
            {
                oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrGetMethod + Constants.cStrCollectionNameCannotBeEmpty, Constants.cStrLiteSdk,
                                              Log.Severity.ERROR, 0, 0);
            }

            return(result);
        }
Пример #12
0
        /// <summary>
        /// GetCollectionData() --> Gets the collection data available within a ITisCollectionData object.
        /// </summary>
        /// <param name="collData">The ITisCollectionData object from where the data will be retrieved</param>
        /// <param name="filterForms">Filter by forms, i.e. just data from form 1, 2 and 3. If null, all forms will be taken into account</param>
        /// <param name="filterFields">Just use the field names indicated here for each form. All fields are not allowed, due to string length on HTPP requests, exceeding limits</param>
        /// <param name="useFormName">Use the form name for each field (if true), otherwise use 'f1', 'f2', etc...</param>
        /// <example><code>s.GetCollectionData(collData);</code></example>
        public string GetCollectionData(ITisCollectionData collData, string[] filterForms, string[] filterFields, bool useFormName)
        {
            string result = String.Empty;

            try
            {
                if (collData != null)
                {
                    int  frm_idx  = 1;
                    bool allForms = (filterForms == null) ? true : false;

                    foreach (ITisFormData fd in collData.Forms)
                    {
                        string frmName = fd.Name;
                        int    fld_idx = 1;

                        bool formOk = (allForms ||
                                       Array.IndexOf(filterForms, frm_idx.ToString()) >= 0) ? true : false;

                        if (formOk)
                        {
                            foreach (ITisFieldData fldData in fd.Fields)
                            {
                                if (fldData.Contents != String.Empty)
                                {
                                    if (Array.IndexOf(filterFields, fldData.Name) >= 0)
                                    {
                                        string fldStr = (useFormName) ?
                                                        frmName + "." + fldData.Name + "=" + fldData.Contents :
                                                        "f" + frm_idx.ToString() + "." + fldData.Name + "=" + fldData.Contents;

                                        result += (fd.Fields.Count == fld_idx) ? fldStr : fldStr + "|";
                                    }
                                }

                                fld_idx++;
                            }
                        }

                        frm_idx++;
                    }
                }
            }
            catch { }

            if (result[result.Length - 1] == '|')
            {
                result = result.Substring(0, result.Length - 1);
            }

            return(result);
        }
Пример #13
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;
                }
            }
        }
Пример #14
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);
        }
Пример #15
0
        /// <summary>
        /// Batch->InternalHistory() --> Returns a list of the stations a collection has gone through (when processed normally through the workflow).
        /// </summary>
        /// <param name="Collection">Is a ITisCollectionData object.</param>
        /// <returns>Returns a string array if the collection has any history, otherwise returns an empty array.</returns>
        /// <example><code>string[] history = b.InternalHistory(collData);</code></example>
        protected string[] InternalHistory(ITisCollectionData Collection)
        {
            List <string> result = new List <string>();

            if (Collection != null)
            {
                if (CheckLogon())
                {
                    try
                    {
                        if (Collection.NumberOfHistoryTags > 0)
                        {
                            for (short j = 0; j < Collection.NumberOfHistoryTags; j++)
                            {
                                result.Add(Collection.get_HistoryDataTag(j).Name);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrFailedWithException +
                                                      ((e.InnerException != null) ? e.InnerException.ToString() : e.ToString()), Constants.cStrLiteSdk,
                                                      TIS_SEVERITY.TIS_ERROR, 0, 0);
                    }
                }
                else
                if (oCSM != null)
                {
                    oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrCouldNotLogin,
                                                  Constants.cStrLiteSdk, TIS_SEVERITY.TIS_ERROR, 0, 0);
                }
                else
                {
                    throw new Exception(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrCouldNotLogin);
                }
            }
            else
            if (oCSM != null)
            {
                oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrCollectionIsNull, Constants.cStrLiteSdk,
                                              TIS_SEVERITY.TIS_ERROR, 0, 0);
            }

            return(result.ToArray());
        }
Пример #16
0
        private void btnInstanceReject_Click(object sender, EventArgs e)
        {
            // Create a new Batch instance
            // Logs onto the CSM with "AdvancedDemo" application
            // and "FormId" station

            Batch b = new Batch("AdvancedDemo", "FormId");

            // Gets the collection "00000001"

            ITisCollectionData collData = b.Get("00000001");

            // Reject the collection
            b.Reject(collData);

            MessageBox.Show("collection 00000001 is in Reject, please refresh the controller and drag it back");

            // Dispose the batch instance
            // and disconnect from the CSM

            b.Dispose();
        }
Пример #17
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;
                    }
                }
            }
        }
Пример #18
0
        private void btnInstanceHistory_Click(object sender, EventArgs e)
        {
            // Create a new Batch instance
            // Logs onto the CSM with "AdvancedDemo" application
            // and "FormId" station

            Batch b = new Batch("AdvancedDemo", "FormId");

            // Gets the collection "00000001"

            ITisCollectionData collData = b.Get("00000001");

            // Gets the history for collData

            string[] h = b.History(collData);

            MessageBox.Show("History for " + collData.Name + " is: " + String.Join("->", h));

            // Dispose the batch instance
            // and disconnect from the CSM

            b.Dispose();
        }
Пример #19
0
        private void btnGetCollectionDataAndPost_Click(object sender, EventArgs e)
        {
            // Uses the Collection Management SDK to 'grab' a collection in order to retrieve it's data
            // and then Post this data to the Supplier Portal

            // More info about the Collection Management SDK can be found here:
            // http://doksend.com/eFlowSdk/


            // Create a new Batch instance
            // Logs onto the CSM with "CLS" application
            // and "FreeProcess" station

            // This sample assumes you have an eFlow application called 'AdvancedDemo' and a sample collection
            // called '00000323' sitting at the 'FreeProcess' station

            string collectionName = "00000323";

            using (Batch b = new Batch("CLS", "FreeProcess"))
            {
                // Gets the collection "00000323"

                ITisCollectionData collData = b.Get(collectionName);

                // Get the collection data and post the data to the Supplier Portal
                using (Sp s = new Sp())
                {
                    s.HttpPostSimple("topimagesystems.com", "CLS", "00000323",
                                     "TEST1|SYSTEM|CLS|00000323|FreeProcess|1|Invoice_Date=|Invoice_Number=|Net_Amount1=|PO_Number=963645|Supplier_Name=|Total_Amount=0.00|VAT_Amount1=|VAT1=|dc=2/7/2013 12:34:58 PM|rc=0|http://www.doksend.com/supplierportal/images/speedyservices.com_CLS-00000323.tif",
                                     80, false);
                }

                // Liberates the collection (writes it back)
                // to the CSM without moving it to the next queue
                b.Free(collData);
            }
        }
Пример #20
0
        private void btnInstanceGet_Click(object sender, EventArgs e)
        {
            // Create a new Batch instance
            // Logs onto the CSM with "AdvancedDemo" application
            // and "FormId" station

            Batch b = new Batch("AdvancedDemo", "FormId");

            // Gets the collection "00000001"

            ITisCollectionData collData = b.Get("00000001");

            // Put the collection (writes it back)
            // to the CSM and keeps it in the same
            // queue
            b.Free(collData);

            MessageBox.Show("Collection: " + collData.Name + " is still in the same queue");

            // Dispose the batch instance
            // and disconnect from the CSM

            b.Dispose();
        }
Пример #21
0
        /// <summary>
        /// Get CollectionOcrData from ITisCollectionData object.
        /// </summary>
        /// <param name="collection">The collection to get it's page OCR data.</param>
        /// <returns>The CollectionOcrData as deserialized from ITisCollectionData.</returns>
#if INTERNAL
        internal static CollectionOcrData FromCollection(ITisCollectionData collection)
Пример #22
0
 /// <summary>
 /// Batch->Free() --> Releases a ITisCollectionData object (saves it and keeps it in the same queue).
 /// </summary>
 /// <param name="Collection">Is a ITisCollectionData object.</param>
 /// <returns>Returns true is successful, otherwise false.</returns>
 /// <example><code>bool result = b.Free(collData);</code></example>
 public bool Free(ITisCollectionData Collection)
 {
     return InternalPut(Collection, false, Constants.cStrFreeMethod);
 }
Пример #23
0
 /// <summary>
 /// Batch->History() --> Returns a list of the stations a collection has gone through (when processed normally through the workflow).
 /// </summary>
 /// <param name="Collection">Is a ITisCollectionData object.</param>
 /// <returns>Returns a string array if the collection has any history, otherwise returns an empty array.</returns>
 /// <example><code>string[] history = b.History(collData);</code></example>
 public string[] History(ITisCollectionData Collection)
 {
     return InternalHistory(Collection);
 }
Пример #24
0
 /// <summary>
 /// Batch->Reject() --> Rejects a ITisCollectionData object.
 /// </summary>
 /// <param name="Collection">Is a ITisCollectionData object.</param>
 /// <returns>Returns true is successful, otherwise false.</returns>
 /// <example><code>bool result = b.Reject(collData);</code></example>
 public bool Reject(ITisCollectionData Collection)
 {
     return InternalPut(Collection, true, Constants.cStrRejectMethod);
 }
Пример #25
0
 internal CCCollection(CCreator parent, ITisClientServicesModule csm, ITisCollectionData collection)
Пример #26
0
        /// <summary>
        /// Batch->InternalPut() --> Used by Put, Reject or Free collection.
        /// </summary>
        /// <param name="Collection">Is a ITisCollectionData object.</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, otherwise false.</returns>
        protected bool InternalPut(ITisCollectionData Collection, bool put, string method)
        {
            bool result = false;

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

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

                        oCSM.Dynamic.FreeSpecificCollection(Collection, put);
                    }
                    catch (Exception e)
                    {
                        oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + method + Constants.cStrFailedWithException +
                                                      ((e.InnerException != null) ? e.InnerException.ToString() : e.ToString()), Constants.cStrLiteSdk,
                                                      TIS_SEVERITY.TIS_ERROR, 0, 0);
                    }
                    finally
                    {
                        result = true;

                        if (collections != null)
                        {
                            if (collections.IndexOf(Collection.Name) >= 0)
                            {
                                collections.Remove(Collection.Name);
                            }
                        }
                    }
                }
                else
                if (oCSM != null)
                {
                    oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + method + Constants.cStrCouldNotLogin,
                                                  Constants.cStrLiteSdk, TIS_SEVERITY.TIS_ERROR, 0, 0);
                }
                else
                {
                    throw new Exception(Constants.cStrLiteSdkBatch + method + Constants.cStrCouldNotLogin);
                }
            }
            else
            if (oCSM != null)
            {
                oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + method + Constants.cStrCollectionIsNull, Constants.cStrLiteSdk,
                                              TIS_SEVERITY.TIS_ERROR, 0, 0);
            }

            return(result);
        }
Пример #27
0
 /// <summary>
 /// The method that fires the 'OnCollectionCreated' event
 /// </summary>
 /// <param name="cApi"></param>
 /// <param name="creator"></param>
 /// <param name="csm"></param>
 /// <param name="collection"></param>
 /// <param name="canPut"></param>
 protected virtual void CollectionCreated(CCTimerSearch cApi, CCreator creator, ITisClientServicesModule csm, ITisCollectionData collection, ref bool canPut)
 {
     try
     {
         if (OnCollectionCreated != null)
         {
             OnCollectionCreated(this, creator, csm, collection, ref canPut);
         }
     }
     catch (Exception ex)
     {
         ILog.LogError(ex);
     }
 }
Пример #28
0
            private static string GetFieldBatchInfoCore(string tmpUpFolder, string appName, string fToCheck, string fn, List <string> result,
                                                        ITisCollectionData cd, out string origin)
            {
                string res = String.Empty;

                origin = String.Empty;

                try
                {
                    try
                    {
                        origin = cd.GetNamedUserTags(Constants.SupplierPortalDomainTag);
                    }
                    catch { }

                    if (origin == String.Empty)
                    {
                        origin = Constants.eFlowOrigin;
                    }

                    foreach (ITisFormData fd in cd.Forms)
                    {
                        foreach (ITisFieldData fld in fd.Fields)
                        {
                            if (ExistsInPipeStr(true, fld.Name, fToCheck))
                            {
                                result.Add(fd.Name + "_" + fld.Name + "=" + fld.Contents.ToString());
                            }
                        }

                        foreach (ITisPageData pd in fd.LinkedPages)
                        {
                            string tfn = pd.GetAttachmentFileName(".tif");

                            fn = tfn.Substring(0, tfn.IndexOf("_")) + ".tif";

                            if (!Directory.Exists(tmpUpFolder))
                            {
                                Directory.CreateDirectory(tmpUpFolder);
                            }

                            string tmpFn = String.Empty;

                            if (File.Exists(fn))
                            {
                                tmpFn = Path.Combine(tmpUpFolder, Path.GetFileName(fn));
                            }
                            else
                            {
                                string origFn = Path.GetFileName(fn);
                                fn    = Path.Combine(tmpUpFolder, getFileInDynamic(appName, origFn));
                                tmpFn = Path.Combine(tmpUpFolder, Path.GetFileName(origFn));
                            }

                            if (!File.Exists(tmpFn))
                            {
                                try
                                {
                                    string         fld = Path.GetDirectoryName(tmpFn);
                                    DirectoryInfo  di  = new DirectoryInfo(fld);
                                    FileAttributes f   = di.Attributes;

                                    DecipherAttributes(fld, f);

                                    FileInfo fileInfo = new System.IO.FileInfo(fn);
                                    fileInfo.Attributes = FileAttributes.Normal;

                                    File.Copy(fn, tmpFn);
                                }
                                catch (Exception ex)
                                {
                                    Logging.WriteLog(ex.ToString());
                                }
                            }

                            fn = tmpFn;

                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logging.WriteLog(ex.ToString());
                }

                res = fn;

                return(res);
            }
Пример #29
0
 /// <summary>
 /// Batch->Delete() --> Deletes a ITisCollectionData object from the system (even if the collection is locked).
 /// </summary>
 /// <remarks>
 /// Attention: Even if the collection is locked, it will be deleted!
 /// </remarks>
 /// <param name="Collection">Is a ITisCollectionData object.</param>
 /// <returns>Returns true is successful, otherwise false.</returns>
 /// <example><code>bool result = b.Delete(collData);</code></example>
 public bool Delete(ITisCollectionData Collection)
 {
     return(InternalPut(Collection, false, Constants.cStrDeleteMethod));
 }
        /// <summary>
        /// Batch->InternalPut() --> Used by Put, Reject or Free collection.
        /// </summary>
        /// <param name="Collection">Is a ITisCollectionData object.</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, otherwise false.</returns>
        protected bool InternalPut(ITisCollectionData Collection, bool put, string method)
        {
            bool result = false;

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

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

                        oCSM.Dynamic.FreeSpecificCollection(Collection, put);
                    }
                    catch (Exception e)
                    {
                        oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + method + Constants.cStrFailedWithException +
                            ((e.InnerException != null) ? e.InnerException.ToString() : e.ToString()), Constants.cStrLiteSdk,
                            TIS_SEVERITY.TIS_ERROR, 0, 0);
                    }
                    finally
                    {
                        result = true;

                        if (collections != null)
                            if (collections.IndexOf(Collection.Name) >= 0)
                                collections.Remove(Collection.Name);
                    }
                }
                else
                    if (oCSM != null)
                        oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + method + Constants.cStrCouldNotLogin,
                            Constants.cStrLiteSdk, TIS_SEVERITY.TIS_ERROR, 0, 0);
                    else
                        throw new Exception(Constants.cStrLiteSdkBatch + method + Constants.cStrCouldNotLogin);
            }
            else
                if (oCSM != null)
                    oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + method + Constants.cStrCollectionIsNull, Constants.cStrLiteSdk,
                        TIS_SEVERITY.TIS_ERROR, 0, 0);

            return result;
        }
        /// <summary>
        /// Batch->InternalHistory() --> Returns a list of the stations a collection has gone through (when processed normally through the workflow).
        /// </summary>
        /// <param name="Collection">Is a ITisCollectionData object.</param>
        /// <returns>Returns a string array if the collection has any history, otherwise returns an empty array.</returns>
        /// <example><code>string[] history = b.InternalHistory(collData);</code></example>
        protected string[] InternalHistory(ITisCollectionData Collection)
        {
            List<string> result = new List<string>();

            if (Collection != null)
            {
                if (CheckLogon())
                {
                    try
                    {
                        if (Collection.NumberOfHistoryTags > 0)
                            for (short j = 0; j < Collection.NumberOfHistoryTags; j++)
                                result.Add(Collection.get_HistoryDataTag(j).Name);
                    }
                    catch (Exception e)
                    {
                        oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrFailedWithException +
                            ((e.InnerException != null) ? e.InnerException.ToString() : e.ToString()), Constants.cStrLiteSdk,
                            TIS_SEVERITY.TIS_ERROR, 0, 0);
                    }
                }
                else
                    if (oCSM != null)
                        oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrCouldNotLogin,
                            Constants.cStrLiteSdk, TIS_SEVERITY.TIS_ERROR, 0, 0);
                    else
                        throw new Exception(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrCouldNotLogin);
            }
            else
                if (oCSM != null)
                    oCSM.Logger.RequestMessageLog(Constants.cStrLiteSdkBatch + Constants.cStrHistoryMethod + Constants.cStrCollectionIsNull, Constants.cStrLiteSdk,
                        TIS_SEVERITY.TIS_ERROR, 0, 0);

            return result.ToArray();
        }
Пример #32
0
 /// <summary>
 /// Batch->Reject() --> Rejects a ITisCollectionData object.
 /// </summary>
 /// <param name="Collection">Is a ITisCollectionData object.</param>
 /// <returns>Returns true is successful, otherwise false.</returns>
 /// <example><code>bool result = b.Reject(collData);</code></example>
 public bool Reject(ITisCollectionData Collection)
 {
     return(InternalPut(Collection, true, Constants.cStrRejectMethod));
 }
Пример #33
0
 /// <summary>
 /// Batch->History() --> Returns a list of the stations a collection has gone through (when processed normally through the workflow).
 /// </summary>
 /// <param name="Collection">Is a ITisCollectionData object.</param>
 /// <returns>Returns a string array if the collection has any history, otherwise returns an empty array.</returns>
 /// <example><code>string[] history = b.History(collData);</code></example>
 public string[] History(ITisCollectionData Collection)
 {
     return(InternalHistory(Collection));
 }
Пример #34
0
 /// <summary>
 /// Stamp the specified collection with the Custom Dll version..
 /// </summary>
 /// <param name="csm"></param>
 /// <param name="collection">The collection to stamp.</param>
 /// <param name="getCallingDllversionData">A flag to get the dll version data of the dll that called this function when true.</param>
 /// <returns>A string with the DLL version.</returns>
 public static string StampStationDll(ITisClientServicesModule csm, ITisCollectionData collection)
 {
     return(StampStationDll(csm, collection, GetCallingDll(2) + ", " + PartDllStampData));
 }