Exemplo n.º 1
0
        public override void ExecuteCommand(AppSession session, StringRequestInfo requestInfo)
        {
            LensProtectionRepository repository = new LensProtectionRepository();
            List <LensProtection>    lensProtectionList;
            LensProtection           lensProtection;

            string[] str = requestInfo.Body.Split('/');
            switch (str[0])
            {
            case "Get":
                lensProtectionList = repository.GetList();
                string message = JsonConvert.SerializeObject(lensProtectionList);
                session.Send(message);
                break;

            case "Set":
                lensProtection = JsonConvert.DeserializeObject <LensProtection>(str[1]);
                try
                {
                    repository.Update(lensProtection);
                    session.Send(true.ToString());
                }
                catch { session.Send(false.ToString()); }
                break;
            }
        }
Exemplo n.º 2
0
        public string seviceInfo()
        {
            string StartUpType = "0";

            _ListLensProtection = _LensProtectionRepository.GetList();
            if (_ListLensProtection.Count > 0)
            {
                t           = new Thread(Protect);
                StartUpType = "1";
            }
            else
            {
                StartUpType = "-1";
            }
            return(StartUpType);
        }