Esempio n. 1
0
        public Node <Person> AddPotentialFriend(Person main, Person friend, EnterType type)
        {
            Logger.Out("Adding potential friend to DB: {0}", MessageType.Debug, friend.Url);

            var friendNode = db.Cypher
                             .Merge("(person:Person { Id: {id} })")
                             .OnCreate()
                             .Set("person = {friend}")
                             .WithParams(new
            {
                id = friend.Id,
                friend
            }).Return(person => person.Node <Person>())
                             .Results
                             .Single();

            //create
            db.Cypher
            .Match("(mainPerson:Person)", "(friendPerson:Person)")
            .Where((Person mainPerson) => mainPerson.Id == main.Id)
            .AndWhere((Person friendPerson) => friendPerson.Id == friend.Id)
            .CreateUnique("mainPerson-[:" + RelationString.ToString(type) + "]->friendPerson")
            .ExecuteWithoutResults();

            return(friendNode);
        }
Esempio n. 2
0
        private async Task <bool> CheckRoomAnswer(string value, EnterType type)
        {
            if (context.State.StateType != StateType.WaitingForAnswer)
            {
                return(false);
            }

            var room = (ShowRoom)context.State.CurrentRoom;

            if (room.EnterPlace.Type != type)
            {
                return(false);
            }

            var key = room.EnterPlace.Key;

            context.State.Values.AddOrUpdate(key, k => value, (k, v) => value);

            await room.Visit(context.Visitor);

            if (room.EnterPlace == null)
            {
                context.State.StateType = StateType.None;
            }

            if (context.State.StateType != StateType.WaitingForAnswer && room.AutoGo.IsNotNullOrEmpty())
            {
                Command(room.AutoGo);

                return(true);
            }

            return(false);
        }
Esempio n. 3
0
 private async Task AddPotentialFriendsRecursive(Person user, EnterType type, List <Person> potentialFriends, DumpingDepth depth, Dictionary <int, Person> trace)
 {
     foreach (var pFriend in potentialFriends)
     {
         _dbWorker.AddPotentialFriend(user, pFriend, type);
         await CollectPotentialFriendsRecursive(pFriend, depth, trace);
     }
 }
        public MainForm(EnterType enterType)
        {
            InitializeComponent();
            this.MaximumSize = this.Size;
            this.MinimumSize = this.Size;
            this.Text        = Global.ReportName;
            _enterType       = enterType;

            _config          = new Config(Global.ReportName);
            _error           = new EnhancedErrorProvider();
            _error.BlinkRate = 0;

            InitializeSemester();
            InitializeDate();

            _worker         = new BackgroundWorker();
            _worker.DoWork += delegate
            {
                #region 取得試別
                _exams = JHExam.SelectAll();
                //List<string> examIDs = new List<string>();
                //foreach (JHExamRecord exam in _exams)
                //{
                //    examIDs.Add(exam.ID);
                //    _ecMapping.Add(exam.ID, new List<string>());
                //}
                #endregion
            };
            _worker.RunWorkerCompleted += delegate
            {
                //Campus.Configuration.Config.App.Sync("新竹個人評量成績單試別");
                //Campus.Configuration.ConfigData cd = Campus.Configuration.Config.App["新竹個人評量成績單試別"];
                //string str = cd["新竹個人評量成績單試別"];

                K12.Data.Configuration.ConfigData cd = K12.Data.School.Configuration["新竹個人評量成績單試別"];
                string str = cd["新竹個人評量成績單試別"];

                cbExam.DisplayMember = "Name";
                foreach (var exam in _exams)
                {
                    cbExam.Items.Add(exam);
                }
                int idx = cbExam.FindString(str);
                if (idx < 0)
                {
                    cbExam.SelectedIndex = 0;
                }
                else
                {
                    cbExam.SelectedIndex = idx;
                }

                cbExam.Enabled  = true;
                btnNext.Enabled = true;
                LoadSubjectName();
            };
            _worker.RunWorkerAsync();
        }
Esempio n. 5
0
 public Virus(VirusType type, VirusShape shape, EnterType enterType, ExitType exitType, Vector3 pos, World world)
 {
     this.type      = type;
     this.shape     = shape;
     this.enterType = enterType;
     this.exitType  = exitType;
     this.position  = pos;
     this.model     = (shape == VirusShape.Complex ? Main.main.comVirusModel : Main.main.icoVirusModel);
     world.viruses.Add(this);
 }
Esempio n. 6
0
 public void AddRelation(Person main, Person friend, EnterType type)
 {
     Logger.Out("Adding relation(Ids): {0} --> {1}", MessageType.Debug, main.Id, friend.Id);
     //create
     _db.Cypher
     .Match("(mainPerson:Person)", "(friendPerson:Person)")
     .Where((Person mainPerson) => mainPerson.Id == main.Id)
     .AndWhere((Person friendPerson) => friendPerson.Id == friend.Id)
     .CreateUnique("mainPerson-[:" + RelationString.ToString(type) + "]->friendPerson")
     .ExecuteWithoutResults();
 }
Esempio n. 7
0
 public bool Enter(EnterType type)
 {
     if (!CheckBottom(type))
     {
         LevelDown();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 8
0
 private async Task AddPotentialFriendsRecursive(Person user, EnterType type, List <Person> potentialFriends, DumpingDepth depth, Dictionary <int, Person> trace)
 {
     foreach (var pFriend in potentialFriends)
     {
         if (!_dbcache.CheckAddPersonId(pFriend.Id))
         {
             _neo4JWorker.AddPerson(pFriend);
         }
         _neo4JWorker.AddRelation(user, pFriend, type);
         await CollectPotentialFriendsRecursive(pFriend, depth, trace);
     }
 }
Esempio n. 9
0
        public MainForm(EnterType enterType)
        {
            InitializeComponent();
            this.MaximumSize = this.Size;
            this.MinimumSize = this.Size;
            this.Text        = Global.ReportName;
            _EnterType       = enterType;
            Options          = new Options();

            // 學生
            if (_EnterType == EnterType.Student)
            {
                Options.Students = JHSchool.Data.JHStudent.SelectByIDs(K12.Presentation.NLDPanels.Student.SelectedSource);
            }
            else
            {
                // 班級
                List <JHStudentRecord> list      = new List <JHStudentRecord>();
                List <JHStudentRecord> studList  = new List <JHStudentRecord>();
                List <JHStudentRecord> studListN = new List <JHStudentRecord>();
                foreach (JHClassRecord cla in JHClass.SelectByIDs(K12.Presentation.NLDPanels.Class.SelectedSource))
                {
                    studList.Clear();
                    studListN.Clear();
                    // 過濾一般生
                    foreach (JHStudentRecord studRec in cla.Students.Where(x => x.Status == K12.Data.StudentRecord.StudentStatus.一般))
                    {
                        // 將是否有座號分開
                        if (studRec.SeatNo.HasValue)
                        {
                            studList.Add(studRec);
                        }
                        else
                        {
                            studListN.Add(studRec);
                        }
                    }
                    // 有座號依座號排序
                    if (studList.Count > 0)
                    {
                        list.AddRange(studList.OrderBy(x => x.SeatNo.Value));
                    }
                    // 沒有座號依學號排序
                    if (studListN.Count > 0)
                    {
                        list.AddRange(studListN.OrderBy(x => x.StudentNumber));
                    }
                }
                Options.Students = list;
            }
        }
Esempio n. 10
0
        public double GetGeneratedPi(EnterType enterType)
        {
            _pi = 0;
            var step = 1 / (double)StepsAmount;
            int stepsAmountPerThread = StepsAmount / ThreadsAmount;
            var threads = CreateThreads(enterType, step, stepsAmountPerThread);

            foreach (var thread in threads)
            {
                thread.Join();
            }

            return(_pi);
        }
        public MainForm(EnterType enterType)
        {
            InitializeComponent();
            this.Text = Global.ReportName;
            this.MinimumSize = this.Size;
            this.MaximumSize = this.Size;
            _EnterType = enterType;

            // 讀取畫面上承辦人員與註冊組長預設值
            K12.Data.Configuration.ConfigData cd = K12.Data.School.Configuration["學籍表_相關資料"];
            // 承辦人員
            txtTransName.Text = cd["TransName"];
            // 註冊組長
            txtRegName.Text = cd["RegName"];
        }
Esempio n. 12
0
        public MainForm(EnterType enterType)
        {
            InitializeComponent();
            this.Text        = Global.ReportName;
            this.MinimumSize = this.Size;
            this.MaximumSize = this.Size;
            _EnterType       = enterType;

            // 讀取畫面上承辦人員與註冊組長預設值
            K12.Data.Configuration.ConfigData cd = K12.Data.School.Configuration["學籍表_相關資料"];
            // 承辦人員
            txtTransName.Text = cd["TransName"];
            // 註冊組長
            txtRegName.Text = cd["RegName"];
        }
        private void Awake()
        {
            if (_instance != null && _instance != this)
            {
                Destroy(this.gameObject);
                return;
            }
            _instance     = this;
            activeUILevel = ProgressManager.GetProgress().storyProgress.lastPlayedLevelID;

            if (enterType != EnterType.none)
            {
                enterType = EnterType.none;
            }
        }
Esempio n. 14
0
        private IEnumerable <Thread> CreateThreads(EnterType enterType, double step, int stepsAmountPerThread)
        {
            var threads = new List <Thread>();

            for (var i = 0; i < ThreadsAmount; ++i)
            {
                var thread = new Thread(CalculatePi);
                thread.Start(new ArgsThread
                {
                    Left      = i * stepsAmountPerThread,
                    Right     = (i + 1) * stepsAmountPerThread,
                    Step      = step,
                    EnterType = enterType
                });

                threads.Add(thread);
            }

            return(threads);
        }
Esempio n. 15
0
        public int GetRemainingShareForSymbol(EnterType e, string symbol, int initialShareSize)
        {
            var openPos = api.GetOpenPositionForSymbol(symbol);

            if (e == EnterType.Buy)
            {
                if (openPos != null && openPos.Side != "B")
                {
                    api.FlattenSymbol(symbol);
                }
            }
            else if (e == EnterType.Sell)
            {
                if (openPos != null && openPos.Side == "B")
                {
                    api.FlattenSymbol(symbol);
                }
            }

            return(GetRemainingShareFromOpenPos(openPos, initialShareSize));
        }
Esempio n. 16
0
 public Person[] GetUsersRelated(int userId, EnterType type)
 {
     //match (m:Person{Id:169033204})--(f) return f
     try
     {
         var query = _db
                     .Cypher
                     .Match("(m:Person { Id: {id},Deleted:false})-[:" + RelationString.ToString(type) + "]-(f)")
                     .WithParams(new
         {
             id = userId
         }
                                 )
                     .Return(f => f.As <Person>());
         var res = query.Results.ToArray();
         return(res);
     }
     catch (Exception ex)
     {
         Logger.Out("Query error: {0}", MessageType.Error, ex.Message);
         return(null);
     }
 }
Esempio n. 17
0
 static extern void virtualkeyboard_change_options(LayoutType layout, EnterType enter);
Esempio n. 18
0
 private bool CheckBottom(EnterType type)
 {
     return(depths[type].depth <= 0);
 }
Esempio n. 19
0
 public VirtualKeyboard(LayoutType layout=LayoutType.VIRTUALKEYBOARD_LAYOUT_DEFAULT, 
     EnterType enter=EnterType.VIRTUALKEYBOARD_ENTER_DEFAULT)
 {
     _layout = layout;
     _enter = enter;
 }
Esempio n. 20
0
 public NotExistEnterException(EnterType type, ushort id) : base(string.Empty)
 {
     Type = type;
     Id   = id;
 }
Esempio n. 21
0
 public Depth(EnterType type, int depth)
 {
     this.type  = type;
     this.depth = depth;
 }
Esempio n. 22
0
        public EnterType Create(string description, int userId)
        {
            var type = new EnterType(description, userId);

            return(_typeRepository.Create(type));
        }
Esempio n. 23
0
 public EnterType Create(EnterType item)
 {
     item.TypeId = _mock.Max(c => c.TypeId) + 1;
     _mock.Add(item);
     return(item);
 }
Esempio n. 24
0
 public void Update(EnterType item)
 {
     throw new NotImplementedException();
 }
Esempio n. 25
0
 public void Delete(EnterType item)
 {
     _mock.Remove(item);
 }
 internal static void Run(EnterType enterType)
 {
     new MainForm(enterType).ShowDialog();
 }
Esempio n. 27
0
 internal static void Run(EnterType enterType)
 {
     new MainForm(enterType).ShowDialog();
 }
Esempio n. 28
0
 public static String ToString(EnterType type)
 {
     return(relationsDictionary[type]);
 }