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);
        }
Example #2
0
        public static NRestClient CreateDCClient()
        {
            if (null == ConfigManager.Instance.Plaza)
            {
                return(null);
            }
            if (null == ConfigManager.Instance.Plaza.SCW)
            {
                return(null);
            }
            if (null == ConfigManager.Instance.Plaza.SCW.Http)
            {
                return(null);
            }

            NRestClient.WebProtocol protocol =
                (ConfigManager.Instance.Plaza.SCW.Http.Protocol == "http") ?
                NRestClient.WebProtocol.http : NRestClient.WebProtocol.https;
            string hostName = ConfigManager.Instance.Plaza.SCW.Http.HostName;
            int    portNo   = ConfigManager.Instance.Plaza.SCW.Http.PortNumber;

            return(new NRestClient(protocol, hostName, portNo));
        }