예제 #1
0
        public async Task <RO <string> > CustomerChangePoints([FromBody] ClientChangePointsData clientdata)
        {
            var ro = new RO <string>();

            if (ModelState.IsValid)
            {
                                #if SESAM
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.CustomerChangePoints(clientdata);
                                #else
                var result = await VendorDL.CustomerChangePoints(clientdata);

                if (result != null)
                {
                    ro.ReturnCode  = 0;
                    ro.ReturnValue = result;
                }
                else
                {
                    ro.ReturnCode = 100;
                }
                                #endif
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                ro.ReturnCode = 100;
                ro.Message    = $"Bad request - CustomerChangePoints - Incorrect parameters: {message}";
            }
            return(ro);
        }
예제 #2
0
        //--------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Changes customer access points
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        //--------------------------------------------------------------------------------------------------------------------------------
        public async Task <BossIDWS.Vendor.REST.ReturnObjects.RO <string> > CustomerChangePoints(ClientChangePointsData 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    = "CustomerChangePoints failure - NULL accesspoints in parameter";
                    return(await Task.FromResult(roc));
                }
                // Keep Sesam 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.CustomerChangePoints(client.InstallationID, client.CustomerKey, saplist);
                roc.ReturnCode  = vendorro.ReturnCode;
                roc.ReturnValue = vendorro.ReturnValue;
                roc.Message     = vendorro.Message;
            }
            catch (Exception e)
            {
                roc.ReturnCode = 1024;
                roc.Message    = "CustomerChangePoints failure - " + e.ToString();
            }
            return(await Task.FromResult(roc));
        }