Exemplo n.º 1
0
 public string GetName(object pid, object id)
 {
     try
     {
         ScoreEventType model    = new ScoreEventType();
         int            parentid = Convert.ToInt32(pid.ToString());
         int            seid     = Convert.ToInt32(id.ToString());
         if (parentid == 0)
         {
             model = db.ScoreEventType.FirstOrDefault(t => t.IsDel != true && t.ID == seid);
             return(model.Name);
         }
         else
         {
             string str = "";
             model = db.ScoreEventType.FirstOrDefault(t => t.IsDel != true && t.ID == parentid);
             str   = "(" + model.Name + ")";
             model = db.ScoreEventType.FirstOrDefault(t => t.IsDel != true && t.ID == seid);
             str  += model.Name;
             return(str);
         }
     }
     catch
     {
         return("");
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Score Event Message
 /// </summary>
 /// <param name="pt">performance thread sending this message</param>
 /// <param name="absp2mode">If true, start times measured from the beginning of performance; if false, current time</param>
 /// <param name="opcode">valid score opcode</param>
 /// <param name="p">zero mode array of parameter fields for event where p1 is p[0], p2 is p[1] etc</param>
 public ScoreEventMessage(Csound6PerformanceThread pt, bool absp2mode, ScoreEventType opcode, double[] p)
     : base(pt)
 {
     IsAbsoluteP2 = absp2mode;
     Opcode       = opcode;
     Parameters   = p;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 删除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Delete_Click(object sender, EventArgs e)
        {
            string ids = hf_CheckIDS.Value.ToString();

            try
            {
                ids = ids.TrimEnd(',').TrimStart(',');
                foreach (string id in ids.Split(','))
                {
                    int            iddata = Convert.ToInt32(id);
                    ScoreEventType model  = db.ScoreEventType.FirstOrDefault(t => t.ID == iddata);
                    if (model != null)
                    {
                        model.IsDel = true;
                    }
                    else
                    {
                        ShowMessage("删除失败");
                        return;
                    }
                }
                db.SaveChanges();
                new SysLogDAO().AddLog(LogType.操作日志_删除, "成功删除日常事件类型");
                ShowMessage("删除成功");
                DataBindList();
                this.hf_CheckIDS.Value = "";
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message.ToString());
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message);
            }
        }
Exemplo n.º 4
0
        public void TestScoreEventType()
        {
            ScoreEventType score = new ScoreEventType();

            Utils.CheckSerialization(score);

            Assert.AreNotEqual(score.ID, Constants.ScoreID);
            Assert.AreNotEqual(score, new ScoreEventType());
        }
Exemplo n.º 5
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        protected void InfoBind()
        {
            ScoreEventType model = db.ScoreEventType.FirstOrDefault(t => t.ID == SEID && t.IsDel != true);

            if (model != null)
            {
                this.ddl_Type.SelectedValue = model.ParentID.ToString();
                this.txt_DataName.Text      = model.Name.Trim();
            }
        }
Exemplo n.º 6
0
        public void TestQueryEventsByEventType()
        {
            AnalysisEventType evtType1 = new AnalysisEventType {
                Name = "Ball lost"
            };
            AnalysisEventType evtType2 = new AnalysisEventType {
                Name = "PC"
            };
            AnalysisEventType evtType3 = new AnalysisEventType {
                Name = "Recovery"
            };
            AnalysisEventType evtType4 = new AnalysisEventType {
                Name = "Throw-in"
            };
            AnalysisEventType evtType5 = new AnalysisEventType {
                Name = "Unused"
            };
            ScoreEventType score = new ScoreEventType {
                Name = "Goal"
            };

            var eventTypes = new List <EventType> {
                evtType1, evtType2, evtType3, evtType4, score
            };

            foreach (EventType evtType in eventTypes)
            {
                LMTimelineEvent evt = new LMTimelineEvent();
                evt.EventType = evtType;
                storage.Store(evt);
            }

            QueryFilter filter = new QueryFilter();

            filter.Add("EventType", evtType1);
            Assert.AreEqual(1, storage.Retrieve <LMTimelineEvent> (filter).Count());

            filter.Add("EventType", evtType4);
            Assert.AreEqual(1, storage.Retrieve <LMTimelineEvent> (filter).Count());

            filter.Add("EventType", evtType2, evtType3);
            Assert.AreEqual(2, storage.Retrieve <LMTimelineEvent> (filter).Count());

            filter.Add("EventType", eventTypes);
            Assert.AreEqual(5, storage.Retrieve <LMTimelineEvent> (filter).Count());

            filter.Add("EventType", evtType5);
            Assert.AreEqual(0, storage.Retrieve <LMTimelineEvent> (filter).Count());

            filter.Add("EventType", score);
            Assert.AreEqual(1, storage.Retrieve <LMTimelineEvent> (filter).Count());
        }
        public void Update()
        {
            events = filter.VisiblePlays.Where(e => ((LMTimelineEvent)e).Players.Contains(player) &&
                                               e.EventType.Equals(EventType)).Cast <LMTimelineEvent> ().ToList();

            SubcategoriesStats = new List <SubCategoryStat> ();

            if (EventType is ScoreEventType)
            {
                ScoreEventType scoreEventType = EventType as ScoreEventType;
                // Total number of points
                TotalCount = events.Count * scoreEventType.Score.Points;
                int eventsCount = events.Count();
            }
            else if (EventType is PenaltyCardEventType)
            {
                TotalCount = events.Count;
            }
            else
            {
                AnalysisEventType evType = EventType as AnalysisEventType;
                TotalCount = events.Count;

                SubcategoriesStats = new List <SubCategoryStat> ();
                var tagsByGroup = evType.TagsByGroup;
                foreach (string grp in tagsByGroup.Keys)
                {
                    SubCategoryStat substat = new SubCategoryStat(grp);
                    foreach (Tag t in tagsByGroup[grp])
                    {
                        int count;
                        count = events.Count(e => e.Tags.Contains(t));
                        PercentualStat pStat = new PercentualStat(t.Value, count, 0, 0, events.Count);
                        substat.OptionStats.Add(pStat);
                    }
                    SubcategoriesStats.Add(substat);
                }
            }
        }
Exemplo n.º 8
0
 protected void btn_Sumbit_Click(object sender, EventArgs e)
 {
     try
     {
         ScoreEventType model = db.ScoreEventType.FirstOrDefault(t => t.ID == SEID);
         if (model == null)
         {
             model            = new ScoreEventType();
             model.Name       = this.txt_DataName.Text.ToString().Trim();
             model.ParentID   = int.Parse(this.ddl_Type.SelectedValue) == -2 ? 0 : int.Parse(this.ddl_Type.SelectedValue);
             model.CreateDate = DateTime.Now;
             model.IsDel      = false;
             if (db.ScoreEventType.FirstOrDefault(t => t.Name == model.Name && t.IsDel == model.IsDel && t.ParentID == model.ParentID) != null)
             {
                 ShowMessage("数据名称不能重复");
                 return;
             }
             db.ScoreEventType.Add(model);
         }
         else
         {
             model.Name = this.txt_DataName.Text.ToString().Trim();
             if (db.ScoreEventType.FirstOrDefault(t => t.Name == model.Name && t.IsDel == model.IsDel && t.ParentID == model.ParentID && t.ID != model.ID) != null)
             {
                 ShowMessage("数据名称不能重复");
                 return;
             }
         }
         db.SaveChanges();
         ShowMessage();
         LogType log = (SEID == -1 ? LogType.操作日志_添加 : LogType.操作日志_修改);
         new SysLogDAO().AddLog(log, (SEID == -1 ? "增加" : "修改") + "日常事件类型");
     }
     catch (Exception error)
     {
         ShowMessage(error.Message);
         new SysLogDAO().AddLog(LogType.系统日志, error.Message, UserID);
     }
 }
 public Score_GameEvent(ScoreEventType t, Team w, float s)
 {
     ScoreEventType = t;
     Team           = w;
     Score          = s;
 }
Exemplo n.º 10
0
        private void Init(T context)
        {
            User user = context.Set <User>().FirstOrDefault(t => t.UserName == "admin");

            if (user == null)
            {
                context.Set <User>().AddOrUpdate(t => t.UserName, new User()
                {
                    UserName      = "******",
                    UserNumber    = "000000",
                    Password      = new BaseUtils().BuildPW("admin", "1"),
                    RealName      = "系统管理员",
                    Cellphone     = "18895353426",
                    CreateDate    = DateTime.Now,
                    IsDel         = false,
                    UserState     = UserState.其他,
                    UserLeaveType = UserLeaveType.后勤人员
                });
                context.SaveChanges();
                user = context.Set <User>().FirstOrDefault(t => t.UserName == "admin");


                context.Set <UserDetails>().AddOrUpdate(t => t.UserID, new UserDetails()
                {
                    UserID        = user.ID,
                    Sex           = Sex.男,
                    Nationality   = Nationality.汉族,
                    Polity        = Polity.群众,
                    BirthDate     = DateTime.Now,
                    Address       = "",
                    Job           = "",
                    HireDate      = DateTime.Now,
                    ProbationDays = 0,
                    QualifiedDate = DateTime.Now,
                    UserType      = UserType.合同制,
                    HeaderUrl     = "",
                    CreateDate    = DateTime.Now,
                    IsDel         = false,
                });

                context.SaveChanges();
            }

            List <Department> DepartmentList = context.Set <Department>().ToList();

            if (DepartmentList == null || DepartmentList.Count == 0)
            {
                Department Department = new Department();
                Department.Name         = "综合办公室";
                Department.CreateDate   = DateTime.Now;
                Department.CreateUserID = user.ID;
                Department.IsDel        = false;
                Department.MasterUserID = user.ID;
                Department.Order        = 0;
                Department.ParentID     = -1;
                Department.IsAdmin      = true;
                DepartmentList.Add(Department);


                Department              = new Department();
                Department.Name         = "全公司组";
                Department.CreateDate   = DateTime.Now;
                Department.CreateUserID = user.ID;
                Department.IsDel        = false;
                Department.MasterUserID = user.ID;
                Department.Order        = 0;
                Department.ParentID     = -1;
                Department.IsAdmin      = false;
                DepartmentList.Add(Department);


                Department              = new Department();
                Department.Name         = "男子组";
                Department.CreateDate   = DateTime.Now;
                Department.CreateUserID = user.ID;
                Department.IsDel        = false;
                Department.MasterUserID = user.ID;
                Department.Order        = 0;
                Department.ParentID     = -1;
                Department.IsAdmin      = false;
                DepartmentList.Add(Department);

                Department              = new Department();
                Department.Name         = "女子组";
                Department.CreateDate   = DateTime.Now;
                Department.CreateUserID = user.ID;
                Department.IsDel        = false;
                Department.MasterUserID = user.ID;
                Department.Order        = 0;
                Department.ParentID     = -1;
                Department.IsAdmin      = false;
                DepartmentList.Add(Department);


                context.Set <Department>().AddOrUpdate(t => t.Name, DepartmentList.ToArray());
                context.SaveChanges();

                DepartmentUser DepartmentUser = new DepartmentUser();
                DepartmentUser.DepartmentID = context.Set <Department>().FirstOrDefault(t => t.Name == "综合办公室").ID;
                DepartmentUser.UserID       = user.ID;
                context.Set <DepartmentUser>().Add(DepartmentUser);
                context.SaveChanges();
            }


            List <Dictionary> dictionaryList = context.Set <Dictionary>().ToList();

            if (dictionaryList == null || dictionaryList.Count == 0)
            {
                Dictionary dictionary = new Dictionary();
                dictionary.Name         = "身份证号码";
                dictionary.CreateDate   = DateTime.Now;
                dictionary.CreateUserID = user.ID;
                dictionary.IsDel        = false;
                dictionary.DisplayType  = DictionaryTypeEnums.填写;
                dictionary.RegexData    = "";
                dictionary.RegexType    = RegexType.身份证号码;
                dictionaryList.Add(dictionary);

                dictionary              = new Dictionary();
                dictionary.Name         = "手机号";
                dictionary.CreateDate   = DateTime.Now;
                dictionary.CreateUserID = user.ID;
                dictionary.IsDel        = false;
                dictionary.DisplayType  = DictionaryTypeEnums.填写;
                dictionary.RegexData    = "";
                dictionary.RegexType    = RegexType.手机号;
                dictionaryList.Add(dictionary);

                dictionary              = new Dictionary();
                dictionary.Name         = "邮箱";
                dictionary.CreateDate   = DateTime.Now;
                dictionary.CreateUserID = user.ID;
                dictionary.IsDel        = false;
                dictionary.DisplayType  = DictionaryTypeEnums.填写;
                dictionary.RegexData    = "";
                dictionary.RegexType    = RegexType.邮箱;
                dictionaryList.Add(dictionary);

                dictionary              = new Dictionary();
                dictionary.Name         = "邮政编码";
                dictionary.CreateDate   = DateTime.Now;
                dictionary.CreateUserID = user.ID;
                dictionary.IsDel        = false;
                dictionary.DisplayType  = DictionaryTypeEnums.填写;
                dictionary.RegexData    = "";
                dictionary.RegexType    = RegexType.邮政编码;
                dictionaryList.Add(dictionary);

                dictionary              = new Dictionary();
                dictionary.Name         = "整数";
                dictionary.CreateDate   = DateTime.Now;
                dictionary.CreateUserID = user.ID;
                dictionary.IsDel        = false;
                dictionary.DisplayType  = DictionaryTypeEnums.填写;
                dictionary.RegexData    = "";
                dictionary.RegexType    = RegexType.整数;
                dictionaryList.Add(dictionary);

                dictionary              = new Dictionary();
                dictionary.Name         = "英文字母";
                dictionary.CreateDate   = DateTime.Now;
                dictionary.CreateUserID = user.ID;
                dictionary.IsDel        = false;
                dictionary.DisplayType  = DictionaryTypeEnums.填写;
                dictionary.RegexData    = "";
                dictionary.RegexType    = RegexType.英文字母;
                dictionaryList.Add(dictionary);

                context.Set <Dictionary>().AddOrUpdate(t => t.Name, dictionaryList.ToArray());
                context.SaveChanges();
            }



            List <Post> PostList = context.Set <Post>().ToList();

            if (PostList == null || PostList.Count == 0)
            {
                Post Post = new Post();
                Post.Name         = "公司总经理";
                Post.CreateDate   = DateTime.Now;
                Post.CreateUserID = user.ID;
                Post.IsDel        = false;
                Post.Order        = 0;
                PostList.Add(Post);

                Post              = new Post();
                Post.Name         = "财务副总经理";
                Post.CreateDate   = DateTime.Now;
                Post.CreateUserID = user.ID;
                Post.IsDel        = false;
                Post.Order        = 0;
                PostList.Add(Post);

                Post              = new Post();
                Post.Name         = "生产副总经理";
                Post.CreateDate   = DateTime.Now;
                Post.CreateUserID = user.ID;
                Post.IsDel        = false;
                Post.Order        = 0;
                PostList.Add(Post);

                Post              = new Post();
                Post.Name         = "系统管理员";
                Post.CreateDate   = DateTime.Now;
                Post.CreateUserID = user.ID;
                Post.IsDel        = false;
                Post.Order        = 0;
                PostList.Add(Post);

                context.Set <Post>().AddOrUpdate(t => t.Name, PostList.ToArray());
                context.SaveChanges();

                PostUser PostUser = new PostUser();
                PostUser.PostID = context.Set <Post>().FirstOrDefault(t => t.Name == "系统管理员").ID;
                PostUser.UserID = user.ID;
                context.Set <PostUser>().Add(PostUser);
                context.SaveChanges();
            }



            List <ScoreEventType> ScoreEventTypeList = context.Set <ScoreEventType>().ToList();

            if (ScoreEventTypeList == null || ScoreEventTypeList.Count == 0)
            {
                ScoreEventType ScoreEventType = new ScoreEventType();
                ScoreEventType.Name       = "工作类事件";
                ScoreEventType.IsDel      = false;
                ScoreEventType.CreateDate = DateTime.Now;
                ScoreEventType.ParentID   = 0;
                ScoreEventTypeList.Add(ScoreEventType);

                ScoreEventType            = new ScoreEventType();
                ScoreEventType.Name       = "行为类事件";
                ScoreEventType.IsDel      = false;
                ScoreEventType.CreateDate = DateTime.Now;
                ScoreEventType.ParentID   = 0;
                ScoreEventTypeList.Add(ScoreEventType);

                ScoreEventType            = new ScoreEventType();
                ScoreEventType.Name       = "其他类事件";
                ScoreEventType.IsDel      = false;
                ScoreEventType.CreateDate = DateTime.Now;
                ScoreEventType.ParentID   = 0;
                ScoreEventTypeList.Add(ScoreEventType);

                context.Set <ScoreEventType>().AddOrUpdate(t => t.Name, ScoreEventTypeList.ToArray());
                context.SaveChanges();
            }


            List <Role> RoleList = context.Set <Role>().ToList();

            if (RoleList == null || RoleList.Count == 0)
            {
                foreach (int item in Enum.GetValues(typeof(RoleEnums)))
                {
                    Role Role = new Role();
                    Role.Name       = Enum.GetName(typeof(RoleEnums), item);
                    Role.CreateDate = DateTime.Now;
                    Role.IsBase     = true;
                    Role.IsDel      = false;
                    RoleList.Add(Role);
                }
                context.Set <Role>().AddOrUpdate(t => t.Name, RoleList.ToArray());
                context.SaveChanges();


                UserRole UserRole = new UserRole();
                UserRole.RoleID = context.Set <Role>().FirstOrDefault(t => t.Name == "系统管理员").ID;
                UserRole.UserID = user.ID;
                context.Set <UserRole>().Add(UserRole);
                //context.Set<Role>().AddOrUpdate(t => t.Name, RoleList.ToArray());
                context.SaveChanges();
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Posts an event based upon the provided type and numeric parameters to be played at an absolute time.
 /// Array position in parms is zero-based whereas csound documentation usually presumes one-based nomenclature.
 /// P2 (start time; parms[1]) is added to the provided timeOffset argument - presumably resulting in a future moment.
 /// This signature can be used when all arguments are numeric.
 /// Internally calls csoundScoreEventAbsolute.
 /// </summary>
 /// <param name="type">any member of the score event type enumeration</param>
 /// <param name="parms">zero-based array of parameters relevant to the event being posted</param>
 /// <param name="timeOffset">offset in seconds or beats to use as a base for adding P2</param>
 /// <returns></returns>
 public CsoundStatus SendScoreEvent(ScoreEventType type, double[] parms, double timeOffset)
 {
     return(Int2StatusEnum(NativeMethods.csoundScoreEventAbsolute(Engine, (char)type, ref parms, parms.Length, timeOffset)));
 }
Exemplo n.º 12
0
 /// <summary>
 /// Posts an event based upon the provided type and numeric parameters to be played in real time.
 /// Array position in parms is zero-based whereas csound documentation usually presumes one-based nomenclature.
 /// P2 (start time; parms[1]) is added to the internal time at the moment the event is received.
 /// This signature can be used when all arguments are numeric.
 /// Internally calls csoundScoreEvent.
 /// </summary>
 /// <param name="type">any member of the score event type enumeration</param>
 /// <param name="parms">zero-based array of parameters relevant to the event being posted</param>
 /// <returns>Success if no error occurred while posting the event</returns>
 public CsoundStatus SendScoreEvent(ScoreEventType type, double[] parms)
 {
     return(Int2StatusEnum(NativeMethods.csoundScoreEvent(Engine, (char)type, parms, parms.Length)));
 }
Exemplo n.º 13
0
 /// <summary>
 /// Sends a score event of type 'opcod' (e.g. 'i' for a note event), with
 ///  'pcnt' p-fields in array 'p' (p[0] is p1). If absp2mode is non-zero,
 ///  the start time of the event is measured from the beginning of
 ///  performance, instead of the default of relative to the current time.
 /// </summary>
 /// <param name="absp2mode"></param>
 /// <param name="opcode"></param>
 /// <param name="p"></param>
 public void SendScoreEvent(bool absp2mode, ScoreEventType opcode, double[] p)
 {
     QueueMessage(new ScoreEventMessage(this, absp2mode, opcode, p));
 }