示例#1
0
 protected virtual void OnEventAction(ATMEventArgs e)
 {
     if (attachmentHandler != null)
     {
         attachmentHandler(this, e);
     }
 }
示例#2
0
        public void ActionAttachmentFile(object sender, ATMEventArgs e)
        {
            try
            {
                Dictionary <string, string> attachmentData = e.ATMData;
                parentUnid    = e.NewParentUnid;
                proceAction   = e.ProceAction;
                oldParentUnid = e.OldParentUnid;

                if (attachmentData == null || attachmentData.Count == 0)
                {
                    return;
                }
                Dictionary <string, string> .ValueCollection            fileNameCollection = attachmentData.Values;
                Dictionary <string, string> .ValueCollection.Enumerator fileNameEnumerator = fileNameCollection.GetEnumerator();

                while (fileNameEnumerator.MoveNext())
                {
                    string strParentUnid = oldParentUnid;
                    string strFileName   = fileNameEnumerator.Current.ToString();

                    string oldAbsoluteFile = this.GetabsolutePath(strParentUnid, strFileName);
                    string newAbsolutePath = this.GetabsolutePath(parentUnid, strFileName);
                    logger.Fatal("oldAbsoluteFile = " + oldAbsoluteFile);
                    logger.Fatal("newAbsolutePath = " + newAbsolutePath);
                    if (!System.IO.File.Exists(oldAbsoluteFile))
                    {
                        throw new Exception();
                    }
                    if (proceAction.Equals("Copy"))
                    {
                        Copy(parentUnid, oldAbsoluteFile, newAbsolutePath);
                    }
                    else if (proceAction.Equals("Move"))
                    {
                        Move(parentUnid, oldAbsoluteFile, newAbsolutePath);
                    }
                    else if (proceAction.Equals("Delete"))
                    {
                        Delete(oldAbsoluteFile);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Fatal(ex.Message);
            }
        }
示例#3
0
        public void EventAction(Dictionary <string, string> attachmentData, string oldParentUnid, string newParentUnid, string proceAction)
        {
            ATMEventArgs e = new ATMEventArgs(attachmentData, oldParentUnid, newParentUnid, proceAction);

            OnEventAction(e);
        }