protected virtual void OnEventAction(ATMEventArgs e) { if (attachmentHandler != null) { attachmentHandler(this, e); } }
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); } }
public void EventAction(Dictionary <string, string> attachmentData, string oldParentUnid, string newParentUnid, string proceAction) { ATMEventArgs e = new ATMEventArgs(attachmentData, oldParentUnid, newParentUnid, proceAction); OnEventAction(e); }