Exemplo n.º 1
0
        public NDbResult ChangeShift([FromBody] TSBShift value)
        {
            NDbResult result;

            if (null == value)
            {
                result = new NDbResult <Shift>();
                result.ParameterIsNull();
            }
            else
            {
                result = TSBShift.ChangeShift(value);
                if (!result.errors.hasError)
                {
                    var plaza = ConfigManager.Instance.Plaza;
                    if (null != plaza)
                    {
                        var taApp  = plaza.TAApp;
                        var todApp = plaza.TODApp;
                        if (null != taApp && null != taApp.Http)
                        {
                            var http = taApp.Http;
                            NRestClient.WebProtocol protocol = (http.Protocol == "http") ?
                                                               NRestClient.WebProtocol.http : NRestClient.WebProtocol.https;
                            string hostName = http.HostName;
                            int    portNo   = http.PortNumber;
                            var    client   = new NRestClient(protocol, hostName, portNo);
                            if (null != client)
                            {
                                client.Execute2 <NRestResult>(RouteConsts.Notify.ShiftChanged.Url, new { });
                            }
                        }
                        if (null != todApp && null != todApp.Http)
                        {
                            var http = todApp.Http;
                            NRestClient.WebProtocol protocol = (http.Protocol == "http") ?
                                                               NRestClient.WebProtocol.http : NRestClient.WebProtocol.https;
                            string hostName = http.HostName;
                            int    portNo   = http.PortNumber;
                            var    client   = new NRestClient(protocol, hostName, portNo);
                            if (null != client)
                            {
                                client.Execute2 <NRestResult>(RouteConsts.Notify.ShiftChanged.Url, new { });
                            }
                        }
                    }
                }
            }
            return(result);
        }
            public SCWCouponList GetCouponList(
                int nwId)
            {
                SCWCouponList ret;
                NRestClient   client = NRestClient.CreateDCClient();

                if (null == client)
                {
                    ret = new SCWCouponList();
                    return(ret);
                }

                var url   = "dmt-scw/api/tod/couponList";
                var value = new
                {
                    networkId = nwId
                };

                string usr = SCWServiceOperations.Instance.UserName;
                string pwd = SCWServiceOperations.Instance.Password;

                ret = client.Execute2 <SCWCouponList>(url, value, username: usr, password: pwd);
                return(ret);
            }