//--------------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// For this one Sesam returns an XML that is transfomed to the REST accesspoint object
 /// </summary>
 /// <param name="accesspointdata"></param>
 /// <returns></returns>
 //--------------------------------------------------------------------------------------------------------------------------------
 public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList> > AccessPoints(AccessPointData accesspointdata)
 {
     BossIDWS.Vendor.REST.ReturnObjects.RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList> ror = new ReturnObjects.RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList>();
     try
     {
         VendorEngine       engine = new VendorEngine();
         List <VendorPoint> points = engine.AccessPoints(accesspointdata.InstallationID, accesspointdata.Type.ToString(), accesspointdata.AccessPoint);
         ror.ReturnCode  = 0;
         ror.ReturnValue = TransformToAccessPointList(accesspointdata.InstallationID, points);
         ror.Message     = string.Empty;
         ror.Message     = "OOPS -" + points.Count.ToString();
     }
     catch (VendorException se)
     {
         VendorRO ro = se.ReturObjekt;
         ror.ReturnCode = ro.ReturnCode;
         ror.Message    = ro.Message;
     }
     catch (Exception e)
     {
         ror.ReturnCode = 1024;
         ror.Message    = "AccessPoints failure - " + e.ToString();
     }
     return(await Task.FromResult(ror));
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="cards"></param>
 /// <returns></returns>
 public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <string> > CardDelete(CardData cards)
 {
     BossIDWS.Vendor.REST.ReturnObjects.RO <string> roc = new ReturnObjects.RO <string>();
     try
     {
         VendorEngine engine   = new VendorEngine();
         VendorRO     vendorro = engine.CardDelete(cards.InstallationID, cards.CustomerKey, cards.RFID);
         roc.ReturnCode  = vendorro.ReturnCode;
         roc.ReturnValue = vendorro.ReturnValue;
         roc.Message     = vendorro.Message;
     }
     catch (Exception e)
     {
         roc.ReturnCode = 1024;
         roc.Message    = "CardDelete failure - " + e.ToString();
     }
     return(await Task.FromResult(roc));
 }
 /// <summary>
 /// No current supported functionality in Sesam
 /// </summary>
 /// <param name="client"></param>
 /// <returns></returns>
 public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <string> > CustomerActivate(CurrentClientData client)
 {
     BossIDWS.Vendor.REST.ReturnObjects.RO <string> roc = new ReturnObjects.RO <string>();
     try
     {
         VendorEngine engine   = new VendorEngine();
         VendorRO     vendorro = engine.CustomerDeactivate(client.InstallationID, client.CustomerKey);
         roc.ReturnCode  = vendorro.ReturnCode;
         roc.ReturnValue = vendorro.ReturnValue;
         roc.Message     = vendorro.Message;
     }
     catch (Exception e)
     {
         roc.ReturnCode = 1024;
         roc.Message    = "CustomerActivate failure - " + e.ToString();
     }
     return(await Task.FromResult(roc));
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="clientdata"></param>
 /// <returns></returns>
 public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <string> > CustomerChangeProperties(ClientChangePropertiesData clientdata)
 {
     BossIDWS.Vendor.REST.ReturnObjects.RO <string> roc = new ReturnObjects.RO <string>();
     try
     {
         VendorEngine engine   = new VendorEngine();
         VendorRO     vendorro = engine.CustomerChangeProperties(clientdata.InstallationID, clientdata.Customerkey, clientdata.Customername, clientdata.Streetaddress, clientdata.Description);
         roc.ReturnCode  = vendorro.ReturnCode;
         roc.ReturnValue = vendorro.ReturnValue;
         roc.Message     = vendorro.Message;
     }
     catch (Exception e)
     {
         roc.ReturnCode = 1024;
         roc.Message    = "CustomerChangeProperties failure - " + e.ToString();
     }
     return(await Task.FromResult(roc));
 }
Beispiel #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ro1"></param>
 /// <param name="ro2"></param>
 public void Clone(VendorRO ro1, VendorRO ro2)
 {
     if (ro1.ReturnCode == 0 && ro2.ReturnCode == 0)
     {
         this.Clone(ro1);
         ReturnValue += ro2.ReturnValue;
     }
     else
     {
         if (ro1.ReturnCode > 0)
         {
             this.Clone(ro1);
         }
         else
         {
             this.Clone(ro2);
         }
     }
 }
        //--------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Add a new customer
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        //--------------------------------------------------------------------------------------------------------------------------------
        public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <string> > AddClientNew(ClientNewData client)
        {
            BossIDWS.Vendor.REST.ReturnObjects.RO <string> roc = new ReturnObjects.RO <string>();
            try
            {
                VendorEngine engine = new VendorEngine();
                if (client.AccessPoints == null || client.AccessPoints.AccessPoint == null)
                {
                    roc.ReturnCode = 1024;
                    roc.Message    = "AddClientNew failure - NULL accesspoints in parameter";
                    return(await Task.FromResult(roc));
                }
                // Keep Vendor separate from the REST api
                VendorAccessPointList    saplist = new VendorAccessPointList();
                List <VendorAccessPoint> saps    = new List <VendorAccessPoint>();

                foreach (AccessPointCustomer ap in client.AccessPoints.AccessPoint)
                {
                    VendorAccessPoint sap = new VendorAccessPoint();
                    sap.accesspointid = ap.accesspointid;
                    sap.role          = ap.role;
                    sap.size          = ap.size;
                    saps.Add(sap);
                }
                saplist.AccessPoints = saps.ToArray();
                VendorRO vendorro = engine.CustomerNew(client.InstallationID, client.CustomerType, client.CustomerID, client.CustomerGUID, client.CustomerName,
                                                       client.StreetAddress, client.Description, client.RFID, saplist);
                roc.ReturnCode  = vendorro.ReturnCode;
                roc.ReturnValue = vendorro.ReturnValue;
                roc.Message     = vendorro.Message;
            }
            catch (Exception e)
            {
                roc.ReturnCode = 1024;
                roc.Message    = "AddClientNew failure - " + e.ToString();
            }
            return(await Task.FromResult(roc));
        }
 //--------------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Poll Sesam for specific events and transform the Sesam events to the REST equivalent
 /// </summary>
 /// <param name="polldata"></param>
 /// <returns></returns>
 //--------------------------------------------------------------------------------------------------------------------------------
 public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <ExtendedEventList> > GetExtendedEventPoll(ExtendedEventPollData polldata)
 {
     BossIDWS.Vendor.REST.ReturnObjects.RO <ExtendedEventList> ror = new ReturnObjects.RO <ExtendedEventList>();
     try
     {
         VendorEngine engine = new VendorEngine();
         List <VendorExtendedEvent> exevents = engine.ExtendedEventPoll(polldata.InstallationID, polldata.FromDateTime, polldata.EventType);
         ror.ReturnCode  = 0;
         ror.ReturnValue = TransformToExtendedEventList(polldata.InstallationID, exevents);
         ror.Message     = string.Empty;
     }
     catch (VendorException se)
     {
         VendorRO ro = se.ReturObjekt;
         ror.ReturnCode = ro.ReturnCode;
         ror.Message    = ro.Message;
     }
     catch (Exception e)
     {
         ror.ReturnCode = 1024;
         ror.Message    = "GetExtendedEventPoll failure - " + e.ToString();
     }
     return(await Task.FromResult(ror));
 }
 //--------------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Return customer events from Sesam. Her we return "any" object to be able to support two kinds of access point list, either the normal list
 /// or the compressed one for "ALL".
 /// </summary>
 /// <param name="events"></param>
 /// <returns></returns>
 //--------------------------------------------------------------------------------------------------------------------------------
 public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <object> > CustomerEvents(CustomerEventsData events)
 {
     BossIDWS.Vendor.REST.ReturnObjects.RO <object> roc = new ReturnObjects.RO <object>();
     try
     {
         VendorEngine engine  = new VendorEngine();
         var          anylist = engine.CustomerEvents(events.InstallationID, events.CustomerKey, events.FromDate, events.ToDate);
         roc.ReturnCode  = 0;
         roc.ReturnValue = anylist;
         roc.Message     = string.Empty;
     }
     catch (VendorException se)
     {
         VendorRO ro = se.ReturObjekt;
         roc.ReturnCode = ro.ReturnCode;
         roc.Message    = ro.Message;
     }
     catch (Exception e)
     {
         roc.ReturnCode = 1024;
         roc.Message    = "CustomerEvents failure - " + e.ToString();
     }
     return(await Task.FromResult(roc));
 }
 //--------------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Return extended event units form Sesam and transform result to to the REST eqivalent
 /// </summary>
 /// <param name="installation"></param>
 /// <returns></returns>
 //--------------------------------------------------------------------------------------------------------------------------------
 public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <ExtendedEventUnitList> > GetExtendedEventUnits(ClientData installation)
 {
     BossIDWS.Vendor.REST.ReturnObjects.RO <ExtendedEventUnitList> ror = new ReturnObjects.RO <ExtendedEventUnitList>();
     try
     {
         VendorEngine engine             = new VendorEngine();
         List <VendorExtendedUnit> units = engine.ExtendedEventUnits(installation.InstallationID);
         ror.ReturnCode  = 0;
         ror.ReturnValue = TransformToExtendedEventUnitList(installation.InstallationID, units);
         ror.Message     = string.Empty;
     }
     catch (VendorException se)
     {
         VendorRO ro = se.ReturObjekt;
         ror.ReturnCode = ro.ReturnCode;
         ror.Message    = ro.Message;
     }
     catch (Exception e)
     {
         ror.ReturnCode = 1024;
         ror.Message    = "GetExtendedEventUnits failure - " + e.ToString();
     }
     return(await Task.FromResult(ror));
 }
 //--------------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Get status of all Sesam access points (all root inlets) and tranform the status list to the REST equivalent
 /// </summary>
 /// <param name="installation"></param>
 /// <returns></returns>
 //--------------------------------------------------------------------------------------------------------------------------------
 public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <AccessPointStatusList> > AccessPointStatus(ClientData installation)
 {
     BossIDWS.Vendor.REST.ReturnObjects.RO <AccessPointStatusList> ror = new ReturnObjects.RO <AccessPointStatusList>();
     try
     {
         VendorEngine engine = new VendorEngine();
         List <VendorAccessPointStatus> status = engine.AccessPointStatus(installation.InstallationID);
         ror.ReturnCode  = 0;
         ror.ReturnValue = TransformToStatusList(installation.InstallationID, status);
         ror.Message     = string.Empty;
     }
     catch (VendorException se)
     {
         VendorRO ro = se.ReturObjekt;
         ror.ReturnCode = ro.ReturnCode;
         ror.Message    = ro.Message;
     }
     catch (Exception e)
     {
         ror.ReturnCode = 1024;
         ror.Message    = "AccessPointStatus failure - " + e.ToString();
     }
     return(await Task.FromResult(ror));
 }
 //--------------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 ///
 /// </summary>
 /// <param name="client"></param>
 /// <returns></returns>
 //--------------------------------------------------------------------------------------------------------------------------------
 public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList> > CustomerAccessPoints(CurrentClientData client)
 {
     BossIDWS.Vendor.REST.ReturnObjects.RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList> ror = new ReturnObjects.RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList>();
     try
     {
         VendorEngine engine = new VendorEngine();
         List <VendorCustomerPoint> points = engine.CustomerAccessPoints(client.InstallationID, client.CustomerKey);
         ror.ReturnCode  = 0;
         ror.ReturnValue = TransformToCustomerPointList(client.InstallationID, points);
         ror.Message     = string.Empty;
     }
     catch (VendorException se)
     {
         VendorRO ro = se.ReturObjekt;
         ror.ReturnCode = ro.ReturnCode;
         ror.Message    = ro.Message;
     }
     catch (Exception e)
     {
         ror.ReturnCode = 1024;
         ror.Message    = "CustomerAccessPoints failure - " + e.ToString();
     }
     return(await Task.FromResult(ror));
 }
Beispiel #12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ro"></param>
 public void Clone(VendorRO ro)
 {
     ReturnCode  = ro.ReturnCode;
     ReturnValue = ro.ReturnValue;
     Message     = ro.Message;
 }
Beispiel #13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ro1"></param>
 /// <param name="ro2"></param>
 public VendorRO(VendorRO ro1, VendorRO ro2)
 {
     this.Clone(ro1, ro2);
 }