Inheritance: AbstractArrayTO
Exemplo n.º 1
0
 public SiteTO(Site mdoSite)
 {
     if (mdoSite == null)
     {
         return;
     }
     this.sitecode = mdoSite.Id;
     this.name = mdoSite.Name;
     this.displayName = mdoSite.DisplayName;
     this.moniker = mdoSite.Moniker;
     this.regionID = mdoSite.RegionId;
     this.lastEventTimestamp = mdoSite.LastEventTimestamp;
     this.lastEventReason = mdoSite.LastEventReason;
     if (mdoSite.Sources != null && mdoSite.Sources.Length != 0)
     {
         this.dataSources = new DataSourceArray(mdoSite.Sources);
     }
     this.parentSiteId = mdoSite.ParentSiteId;
     this.address = mdoSite.Address;
     this.city = mdoSite.City;
     this.state = mdoSite.State;
     this.systemName = mdoSite.SystemName;
     this.siteType = mdoSite.SiteType;
     if (mdoSite.ChildSites != null && mdoSite.ChildSites.Length != 0)
     {
         this.childSites = new SiteArray(mdoSite.ChildSites);
     }
 }
Exemplo n.º 2
0
 public SiteTO(Site mdoSite)
 {
     if (mdoSite == null)
     {
         return;
     }
     this.sitecode           = mdoSite.Id;
     this.name               = mdoSite.Name;
     this.displayName        = mdoSite.DisplayName;
     this.moniker            = mdoSite.Moniker;
     this.regionID           = mdoSite.RegionId;
     this.lastEventTimestamp = mdoSite.LastEventTimestamp;
     this.lastEventReason    = mdoSite.LastEventReason;
     if (mdoSite.Sources != null && mdoSite.Sources.Length != 0)
     {
         this.dataSources = new DataSourceArray(mdoSite.Sources);
     }
     this.parentSiteId = mdoSite.ParentSiteId;
     this.address      = mdoSite.Address;
     this.city         = mdoSite.City;
     this.state        = mdoSite.State;
     this.systemName   = mdoSite.SystemName;
     this.siteType     = mdoSite.SiteType;
     if (mdoSite.ChildSites != null && mdoSite.ChildSites.Length != 0)
     {
         this.childSites = new SiteArray(mdoSite.ChildSites);
     }
 }
Exemplo n.º 3
0
        public DataSourceArray connectToLoginSite(string sitecode)
        {
            DataSourceArray result = new DataSourceArray();
            if (String.IsNullOrEmpty(sitecode))
            {
                result.fault = new FaultTO(NO_SITECODE);
            }
            else if (mySession.SiteTable == null)
            {
                result.fault = new FaultTO(NO_SITE_TABLE);
            }
            else if (mySession.SiteTable.getSite(sitecode) == null)
            {
                result.fault = new FaultTO(SITE_NOT_IN_SITE_TABLE);
            }
            else if (mySession.ConnectionSet != null && mySession.ConnectionSet.Count > 0 && mySession.ConnectionSet.HasConnection(sitecode))
            {
                result.fault = new FaultTO(ALREADY_CONNECTED_TO_SITE);
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                Site site = mySession.SiteTable.getSite(sitecode);
                DataSource src = site.getDataSourceByModality("HIS");
                AbstractDaoFactory factory = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol));
                AbstractConnection c = factory.getConnection(src);
                c.connect();
                result = new DataSourceArray(src);
                result.items[0].welcomeMessage = c.getWelcomeMessage();
                mySession.ConnectionSet.Add(c);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }