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);
        }
Exemplo n.º 2
0
 public void ChangeShift([FromBody] TSBShift shift)
 {
     TSBShift.ChangeShift(shift);
 }