コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                logDataBase = DataContextConfiguration.ContextCollection["Baase"];
            }
            catch (Exception)
            {
            }
            string        ua = Request.QueryString["ua"];
            TerminalModel tm = new TerminalModel();

            if (ua != null && ua.Length > 0)
            {
                UserAgentParser uap = new UserAgentParser();
                uap.OnProcessUnknowUa += new ProcessUnknowUaEventHandler(uap_OnProcessUnknowUa);
                tm = uap.ParseUserAgent(ua);
                //Response.Write("tm.Browser=" + tm.Browser);
                //Response.Write("tm.Brand=" + tm.Brand);
                //Response.Write("tm.Model=" + tm.Model);
                //Response.Write("tm.Platform=" + tm.Platform);
            }
            else
            {
            }
            JavaScriptSerializer ser = new JavaScriptSerializer();
            String jsonStr           = ser.Serialize(tm);

            Response.Write(jsonStr);
        }
コード例 #2
0
ファイル: OutputTerminal.cs プロジェクト: dixonjoel/Diiagramr
 public OutputTerminal(TerminalModel outputTerminal) : base(outputTerminal)
 {
     if (outputTerminal.Kind != TerminalKind.Output)
     {
         throw new ArgumentException("Terminal must be output kind for OutputTerminalViewModel");
     }
 }
コード例 #3
0
        public async Task <TerminalModel> RepreTerminal(TerminalModel s)
        {
            if (!string.IsNullOrEmpty(s.DoorwayPhoto))
            {
                s.DoorwayPhoto = s.DoorwayPhoto.StartsWith("http") ? s.DoorwayPhoto : "profile_placeholder.png";
            }
            else
            {
                s.DoorwayPhoto = "profile_placeholder.png";
            }
            s.IsNewAdd = DateTime.Now.Subtract(s.CreatedOnUtc).Days < 3;

            s.RankName = string.IsNullOrEmpty(s.RankName) ? "A级" : s.RankName;
            if (s.RankName == "A级")
            {
                s.RankColor = "#4a89dc";
            }
            else if (s.RankName == "B级")
            {
                s.RankColor = "#626262";
            }
            else if (s.RankName == "C级")
            {
                s.RankColor = "#53a245";
            }
            else if (s.RankName == "D级")
            {
                s.RankColor = "#8942dc";
            }
            s.Distance     = MapHelper.CalculateDistance(GlobalSettings.Latitude ?? 0, GlobalSettings.Longitude ?? 0, s.Location_Lat ?? 0, s.Location_Lng ?? 0);
            s.TodayIsVisit = await CheckVisitStore(s);

            return(s);
        }
コード例 #4
0
        public HttpResponseMessage LanboerBusinessPosition(TerminalModel model)
        {
            string Result = string.Empty;

            try
            {
                //请求中包含的固定参数
                model.SOURCE      = ParametersFilter.FilterSqlHtml(model.SOURCE, 24);
                model.CREDENTIALS = ParametersFilter.FilterSqlHtml(model.CREDENTIALS, 24);
                model.ADDRESS     = HttpHelper.IPAddress();
                model.TERMINAL    = ParametersFilter.FilterSqlHtml(model.TERMINAL, 1);
                model.INDEX       = ParametersFilter.FilterSqlHtml(model.INDEX, 24);
                model.METHOD      = ParametersFilter.FilterSqlHtml(model.METHOD, 24);

                //去除用户参数中包含的特殊字符
                model.DATA = ParametersFilter.StripSQLInjection(model.DATA);

                //返回结果
                Result = ApiHelper.HttpRequest(username, password, Url, model);

                ///写日志
                string RequestAction = "api/" + username + "/" + HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString() + ":";
                LogHelper.LogResopnse(RequestAction + Result);
            }
            catch (Exception ex)
            {
                LogHelper.LogError(ex.ToString());
            }

            HttpResponseMessage Respend = new HttpResponseMessage {
                Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json")
            };

            return(Respend);
        }
コード例 #5
0
        public override TerminalModel getTM(string userAgent)
        {
            TerminalModel tm = new TerminalModel();

            tm.Platform = "WindowsPhone";
            return(tm);
        }
コード例 #6
0
 public SessionW(TerminalModel tm, Socket s, string remoteName, byte[] remotelGuid)
 {
     _TerminalModel = tm;
     _SessionModel  = new SessionModel(this, s, remoteName, remotelGuid);
     InitializeComponent();
     DataContext = _SessionModel;
 }
コード例 #7
0
        /// <summary>
        /// 添加终端位置图标
        /// </summary>
        /// <param name="coord">坐标</param>
        /// <param name="image">图像</param>
        private void AddOverlay(Coordinate coord, string image, TerminalModel terminal)
        {
            try
            {
                if (map != null)
                {
                    var macker = new Pin
                    {
                        Title      = terminal.Name,
                        Coordinate = coord,
                        Animate    = true,
                        Draggable  = true,
                        Enabled3D  = true,
                        Image      = XImage.FromResource(image),
                        Terminal   = terminal
                    };

                    macker.Clicked += async(o, e) =>
                    {
                        if (e != null && e.Terminal != null)
                        {
                            await ViewModel?.NavigateAsync("VisitStorePage", ("Terminaler", e?.Terminal));
                        }
                    };
                    map.Pins.Add(macker);
                }
            }
            catch (Exception ex)
            { }
        }
コード例 #8
0
        public virtual ActionResult Details(int id)
        {
            var dbTerminal = _selectionRepository.GetObjectById(id);

            if (dbTerminal.IsDeleted)
            {
                this.WriteInformation("Данный видеотерминал не используется.");
            }

            var terminal = new TerminalModel
            {
                Id                     = dbTerminal.Id,
                PhoneNumber            = dbTerminal.PhoneNumber,
                IsPublic               = dbTerminal.IsPublic,
                RegionId               = dbTerminal.RegionId,
                RegionName             = dbTerminal.Region.Name,
                CorrectionFacilityId   = dbTerminal.CorrectionFacility.Id,
                CorrectionFacilityName = dbTerminal.CorrectionFacility.Name,
                IsActive               = dbTerminal.IsActive
            };

            ViewBag.RouteDictionaryForList = Request.QueryString.ToRouteDictionary();

            return(View(terminal));
        }
コード例 #9
0
        public virtual ActionResult Create(TerminalModel terminal)
        {
            try
            {
                using (UnitOfWork unitOfWork = new UnitOfWork())
                {
                    TerminalRepository insertionRepository = new TerminalRepository(unitOfWork.DataContext);
                    DBTerminal         dbTerminal          = new DBTerminal
                    {
                        Id                   = terminal.Id,
                        PhoneNumber          = terminal.PhoneNumber,
                        IsPublic             = terminal.IsPublic,
                        RegionId             = terminal.RegionId,
                        CorrectionFacilityId = terminal.CorrectionFacilityId,
                        Description          = terminal.Description,
                        IsActive             = terminal.IsActive
                    };
                    insertionRepository.InsertObject(dbTerminal);
                    unitOfWork.Commit();

                    // обновляем идентификатор
                    terminal.Id = dbTerminal.Id;
                }

                // сохраняем идентификатор видеотерминала
                this.WriteInformation("Видеотерминал с идентификатором \"{0}\" добавлен.", terminal.Id);

                return(RedirectToAction("Create"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #10
0
        public override TerminalModel getTM(string userAgent)
        {
            TerminalModel tm = new TerminalModel();

            tm.Platform = "Android";
            return(tm);
        }
コード例 #11
0
 public void SetupTests()
 {
     _terminalOut = new TerminalModel("", typeof(int), Direction.East, TerminalKind.Output, 0);
     _terminalIn  = new TerminalModel("", typeof(int), Direction.East, TerminalKind.Input, 0);
     _wireMoq     = new Mock <WireModel>(_terminalIn, _terminalOut);
     _terminalOut.ConnectWire(_wireMoq.Object);
 }
コード例 #12
0
 public ClientView(int id, TerminalClient tc__t, TerminalModel tm)
 {
     Con__Menu       = new ObservableCollection <MyContextItem>();
     Id              = id;
     TerminalClie__t = tc__t;
     TM              = tm;
 }
コード例 #13
0
 public BuyTicketViewModel(TerminalModel model, IWindowManager windowManager)
 {
     _model          = model;
     _windowManager  = windowManager;
     _timer          = new Timer(TimerPeriod);
     _timer.Elapsed += _timer_AutoCloseWindow;
 }
コード例 #14
0
 public InputTerminal(TerminalModel inputTerminal) : base(inputTerminal)
 {
     if (inputTerminal.Kind != TerminalKind.Input)
     {
         throw new ArgumentException("Terminal must be input kind for InputTerminalViewModel");
     }
 }
コード例 #15
0
        public override TerminalModel getTM(string userAgent)
        {
            TerminalModel tm = new TerminalModel();

            tm.Platform = "Android";
            var result = lastReg.Match(userAgent).Groups;

            if (result.Count >= 2)
            {
                switch (lastInt)
                {
                case 1:
                    tm.Model = result[1].Value.Trim();
                    break;

                case 2:
                    tm.Brand = result[1].Value.Trim();
                    tm.Model = result[2].Value.Trim();
                    break;

                case 3:
                    tm.Model = result[1].Value.Trim() + " " + result[2].Value.Trim();
                    break;
                }
            }
            return(tm);
        }
コード例 #16
0
        public AppViewModel(IWindowManager windowManager)
        {
            _windowManager = windowManager;

            _model = new TerminalModel();
            _model.PropertyChanged   += _model_PropertyChanged;
            _model.ConfirmationAdded += _model_ConfirmationAdded;

            _model.LoadSetting();
            if (_model.MasterTcpIp != null)
            {
                _model.MasterTcpIp.PropertyChanged += _model_MasterTcpIp_PropertyChanged;
                _mainTask = _model.Start();
            }

            //обновелние времени раз в 10сек
            DateTimeNowStr = DateTime.Now.ToString("f");
            _timerDateTime = new Timer(10000)
            {
                AutoReset = true
            };
            _timerDateTime.Start();
            _timerDateTime.Elapsed += (sender, args) =>
            {
                DateTimeNowStr = DateTime.Now.ToString("f");
            };
        }
コード例 #17
0
        public TerminalModel GetAllTerminal()
        {
            List <Proc_GetAllLTerminal_Result> GetAllTerminal;
            List <tbl_Terminal> Terminal;
            TerminalModel       TerminalModel;
            List <tbl_Location> location;

            try
            {
                TerminalModel = new TerminalModel();

                GetAllTerminal = Context.GetAllTerminal().ToList();
                Terminal       = this.GetAll();
                location       = this.GetAllLocation();

                TerminalModel.GetAllTerminal = GetAllTerminal;
                TerminalModel.Terminal       = Terminal;
                TerminalModel.GetAllLocation = location;
                return(TerminalModel);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                //GetAllTerminal = null;
                //Terminal = null;
                //TerminalModel = null;
            }
        }
コード例 #18
0
        public virtual ActionResult Edit(int id)
        {
            DBTerminal dbTerminal = _selectionRepository.GetObjectById(id);


            if (dbTerminal.IsDeleted)
            {
                return(RedirectToAction("Details", new { id = id }));
            }

            TerminalModel terminal = new TerminalModel()
            {
                Id                   = dbTerminal.Id,
                PhoneNumber          = dbTerminal.PhoneNumber,
                IsPublic             = dbTerminal.IsPublic,
                RegionId             = dbTerminal.RegionId,
                CorrectionFacilityId = dbTerminal.CorrectionFacilityId,
                Description          = dbTerminal.Description,
                IsActive             = dbTerminal.IsActive
            };

            ViewBag.Regions = RegionController.GetRegionList(null);
            ViewBag.CorrectionFacilities = CorrectionFacilityController.GetCorrectionFacilitiesByRegion(dbTerminal.RegionId, null);

            return(View(terminal));
        }
コード例 #19
0
        public virtual ActionResult Create(TerminalModel terminal)
        {
            try
            {
                using (UnitOfWork unitOfWork = new UnitOfWork())
                {
                    TerminalRepository insertionRepository = new TerminalRepository(unitOfWork.DataContext);
                    DBTerminal dbTerminal = new DBTerminal
                                                {
                                                    Id = terminal.Id,
                                                    PhoneNumber = terminal.PhoneNumber,
                                                    IsPublic = terminal.IsPublic,
                                                    RegionId = terminal.RegionId,
                                                    CorrectionFacilityId = terminal.CorrectionFacilityId,
                                                    Description = terminal.Description,
                                                    IsActive = terminal.IsActive
                                                };
                    insertionRepository.InsertObject(dbTerminal);
                    unitOfWork.Commit();

                    // обновляем идентификатор
                    terminal.Id = dbTerminal.Id;
                }

                // сохраняем идентификатор видеотерминала
                this.WriteInformation("Видеотерминал с идентификатором \"{0}\" добавлен.", terminal.Id);

                return RedirectToAction("Create");
            }
            catch
            {
                return View();
            }
        }
コード例 #20
0
        public override TerminalModel getTM(string userAgent)
        {
            TerminalModel tm = new TerminalModel();

            tm.Platform = "MacOX";
            tm.Brand    = "Apple";
            return(tm);
        }
コード例 #21
0
        public void TestChangingRealTerminalDirection_DirectionSetToWest_TerminalRotationSetTo270()
        {
            var realTerminal      = new TerminalModel("", typeof(int), Direction.North, TerminalKind.Input, 0);
            var terminalViewModel = new Terminal(realTerminal);

            realTerminal.Direction = Direction.West;
            Assert.AreEqual(270, terminalViewModel.TerminalRotation);
        }
コード例 #22
0
        /// <summary>
        /// Highlights all terminals that can be wired to the given terminal.
        /// </summary>
        /// <param name="terminal">The terminal to try wiring to.</param>
        public void HighlightWirableTerminals(TerminalModel terminal)
        {
            var highlightAction = terminal is OutputTerminalModel
                ? (Action <Node>)(node => node.HighlightWirableTerminals <InputTerminal>(terminal.Type))
                : (Action <Node>)(node => node.HighlightWirableTerminals <OutputTerminal>(terminal.Type));

            Nodes.ForEach(highlightAction);
        }
コード例 #23
0
        public string InsertOrUpdateTerminal(TerminalModel TM)
        {
            tbl_Terminal TBLT = new tbl_Terminal();

            TBLT.LocationID = TM.LocationID;
            TBLT.TerminalID = TM.TerminalID;
            return(TerminalBL.InsertOrUpdate(TBLT));
        }
コード例 #24
0
ファイル: Terminal.cs プロジェクト: dixonjoel/Diiagramr
 public Terminal(TerminalModel terminal)
 {
     Model = terminal ?? throw new ArgumentNullException(nameof(terminal));
     Model.PropertyChanged += TerminalOnPropertyChanged;
     Data = Model.Data;
     Name = Model.Name;
     SetTerminalRotationBasedOnDirection();
     SetTerminalColor();
 }
コード例 #25
0
        public void TestOnTerminalPropertyChanged_OffsetYChanged_TerminalXSetToOffsetXPlusNodeX()
        {
            var terminalModel = new TerminalModel("", typeof(int), Direction.North, TerminalKind.Input, 0)
            {
                NodeY   = 6,
                OffsetY = 4
            };

            Assert.AreEqual(terminalModel.NodeY + terminalModel.OffsetY, terminalModel.Y);
        }
コード例 #26
0
        public void TestDisconnectWire_DisconnectWireOnConnectedWireInvoked()
        {
            var terminalModelInput  = new TerminalModel("", typeof(int), Direction.North, TerminalKind.Input, 0);
            var terminalModelOutput = new TerminalModel("", typeof(int), Direction.North, TerminalKind.Output, 0);
            var wireMoq             = new Mock <WireModel>(terminalModelInput, terminalModelOutput);

            terminalModelInput.ConnectWire(wireMoq.Object);
            terminalModelInput.DisconnectWire(wireMoq.Object);
            Assert.AreEqual(0, terminalModelInput.ConnectedWires.Count);
        }
コード例 #27
0
        public void TestOnTerminalPropertyChanged_NodeXChanged_TerminalXSetToOffsetXPlusNodeX()
        {
            var terminalModel = new TerminalModel("", typeof(int), Direction.North, TerminalKind.Input, 0)
            {
                OffsetX = 2,
                NodeX   = 1
            };

            Assert.AreEqual(terminalModel.NodeX + terminalModel.OffsetX, terminalModel.X);
        }
コード例 #28
0
 void SetCache(string userAgent, TerminalModel tm)
 {
     //_locker.AcquireWriterLock(1000);
     //_uaDict[userAgent] = tm;
     //_locker.ReleaseWriterLock();
     if (string.IsNullOrEmpty(userAgent))
     {
         return;
     }
     _uaDict.TryAdd(userAgent, tm);
 }
コード例 #29
0
        public virtual ActionResult Create()
        {
            ViewBag.Regions = RegionController.GetRegionList(null);

            TerminalModel terminal = new TerminalModel()
            {
                IsActive = true //по умолчанию терминал активен
            };

            return(View(terminal));
        }
コード例 #30
0
 public async Task <bool> AddTerminal(TerminalModel terminal)
 {
     if (await GetTerminalByIdAsync(terminal.Id) == null)
     {
         return(await _tliteDb.InsertAsync(terminal) > 0);
     }
     else
     {
         return(await UpdateTerminal(terminal));
     }
 }
コード例 #31
0
        public virtual ActionResult Create()
        {
            ViewBag.Regions = RegionController.GetRegionList(null);

            TerminalModel terminal = new TerminalModel()
            {
                IsActive = true //по умолчанию терминал активен
            };

            return View(terminal);
        }
コード例 #32
0
        public void TestOnTerminalPropertyChanged_ConnectedWireChanged_SemanticsChangedInvoked()
        {
            var terminalModelInput  = new TerminalModel("", typeof(int), Direction.North, TerminalKind.Input, 0);
            var terminalModelOutput = new TerminalModel("", typeof(int), Direction.North, TerminalKind.Output, 0);
            var wireMoq             = new Mock <WireModel>(terminalModelInput, terminalModelOutput);
            var semanticsChanged    = false;

            terminalModelInput.SemanticsChanged += () => semanticsChanged = true;
            terminalModelInput.ConnectWire(wireMoq.Object);

            Assert.IsTrue(semanticsChanged);
        }
コード例 #33
0
        public virtual ActionResult Edit(TerminalModel terminal)
        {
            try
            {
                using (UnitOfWork unitOfWork = new UnitOfWork())
                {
                    TerminalRepository updateRepository = new TerminalRepository(unitOfWork.DataContext);
                    DBTerminal dbTerminal = updateRepository.GetObjectById(terminal.Id);

                    if (dbTerminal == null)
                    {
                        this.WriteErrorMessage("Видеотерминал с идентификатором {0} не найден.", terminal.Id);
                    }
                    else
                    {
                        dbTerminal.PhoneNumber = terminal.PhoneNumber;
                        dbTerminal.IsPublic = terminal.IsPublic;
                        dbTerminal.RegionId = terminal.RegionId;
                        dbTerminal.CorrectionFacilityId = terminal.CorrectionFacilityId;
                        dbTerminal.Description = terminal.Description;
                        dbTerminal.IsActive = terminal.IsActive;

                        updateRepository.UpdateObject(dbTerminal);
                        unitOfWork.Commit();

                        // сохраняем номер телефона
                        this.WriteInformation("Видеотерминал с идентификатором \"{0}\" сохранен.", terminal.Id);
                    }

                }

                return RedirectToAction("Details", new { id = terminal.Id });
            }
            catch
            {
                return View();
            }
        }
コード例 #34
0
        public virtual ActionResult Edit(int id)
        {
            DBTerminal dbTerminal = _selectionRepository.GetObjectById(id);

            if (dbTerminal.IsDeleted)
                return RedirectToAction("Details", new { id = id });

            TerminalModel terminal = new TerminalModel()
                                                 {
                                                     Id = dbTerminal.Id,
                                                     PhoneNumber = dbTerminal.PhoneNumber,
                                                     IsPublic = dbTerminal.IsPublic,
                                                     RegionId = dbTerminal.RegionId,
                                                     CorrectionFacilityId = dbTerminal.CorrectionFacilityId,
                                                     Description = dbTerminal.Description,
                                                     IsActive = dbTerminal.IsActive
                                                 };

            ViewBag.Regions = RegionController.GetRegionList(null);
            ViewBag.CorrectionFacilities = CorrectionFacilityController.GetCorrectionFacilitiesByRegion(dbTerminal.RegionId, null);

            return View(terminal);
        }
コード例 #35
0
        public virtual ActionResult Details(int id)
        {
            var dbTerminal = _selectionRepository.GetObjectById(id);

            if (dbTerminal.IsDeleted)
                this.WriteInformation("Данный видеотерминал не используется.");

            var terminal = new TerminalModel
                                         {
                                             Id = dbTerminal.Id,
                                             PhoneNumber = dbTerminal.PhoneNumber,
                                             IsPublic = dbTerminal.IsPublic,
                                             RegionId = dbTerminal.RegionId,
                                             RegionName = dbTerminal.Region.Name,
                                             CorrectionFacilityId = dbTerminal.CorrectionFacility.Id,
                                             CorrectionFacilityName = dbTerminal.CorrectionFacility.Name,
                                             IsActive = dbTerminal.IsActive
                                         };

            ViewBag.RouteDictionaryForList = Request.QueryString.ToRouteDictionary();

            return View(terminal);
        }