コード例 #1
0
 internal void MarkFileImported(ImportFile importFile)
 {
     int id = importFile.FileId;
     IFAttachInc2 attach = null;
     if (null != _Incident && null != _Incident.FAttach2)
     {
         foreach (var f in _Incident.FAttach2)
         {
             if (f.ID == id)
             {
                 attach = f;
                 break;
             }
         }
     }
     if (null == attach) return;
     // update the description of an incident's attachment
     Incident incident = new Incident();
     incident.ID = new ID();
     incident.ID.id = _Incident.ID;
     incident.ID.idSpecified = true;
     FileAttachmentIncident file = new FileAttachmentIncident();
     file.ID = new ID();
     file.ID.id = id;
     file.ID.idSpecified = true;
     file.action = ActionEnum.update;
     file.actionSpecified = true;
     file.Private = attach.Private;
     file.PrivateSpecified = true;
     bool updated;
     switch (importFile.StatusCode)
     {
         case 70:
         case 75:
             file.Description = importFile.Description +  string.Format("{{{0:00}}}", importFile.StatusCode);
             updated = true;
             break;
         default:
             updated = false;
             break;
     }
     if (updated)
     {
         incident.FileAttachments = new FileAttachmentIncident[1] { file };
         try
         {
             _rnSrv.updateObject(new RNObject[1] { incident });
         }
         catch (Exception ex)
         {
             _Model._Proxy.NoticeLog(String.Format("EBS Bulk Import failed to update the description of file {0}, id {1}",
                 importFile.Name, id), ex.Message);
         }
     }
 }
コード例 #2
0
        internal void MarkFileImported(ImportFile importFile)
        {
            int          id     = importFile.FileId;
            IFAttachInc2 attach = null;

            if (null != _Incident && null != _Incident.FAttach2)
            {
                foreach (var f in _Incident.FAttach2)
                {
                    if (f.ID == id)
                    {
                        attach = f;
                        break;
                    }
                }
            }
            if (null == attach)
            {
                return;
            }
            // update the description of an incident's attachment
            Incident incident = new Incident();

            incident.ID             = new ID();
            incident.ID.id          = _Incident.ID;
            incident.ID.idSpecified = true;
            FileAttachmentIncident file = new FileAttachmentIncident();

            file.ID               = new ID();
            file.ID.id            = id;
            file.ID.idSpecified   = true;
            file.action           = ActionEnum.update;
            file.actionSpecified  = true;
            file.Private          = attach.Private;
            file.PrivateSpecified = true;
            bool updated;

            switch (importFile.StatusCode)
            {
            case 70:
            case 75:
                file.Description = importFile.Description + string.Format("{{{0:00}}}", importFile.StatusCode);
                updated          = true;
                break;

            default:
                updated = false;
                break;
            }
            if (updated)
            {
                incident.FileAttachments = new FileAttachmentIncident[1] {
                    file
                };
                try
                {
                    _rnSrv.updateObject(new RNObject[1] {
                        incident
                    });
                }
                catch (Exception ex)
                {
                    _Model._Proxy.NoticeLog(String.Format("EBS Bulk Import failed to update the description of file {0}, id {1}",
                                                          importFile.Name, id), ex.Message);
                }
            }
        }