Beispiel #1
0
        public bool UpDateJCRule(string Name, string JCRule)
        {
            List <JCRule> rList     = JCRule.ToObj <List <JCRule> >();
            var           New_Rlist = rList.Select(r =>
            {
                JCRule New_JCRule = DataList.Current[Name].JCRules.Where(p => p.Id == r.Id).FirstOrDefault();
                if (New_JCRule == null)
                {
                    New_JCRule = new JCRule()
                    {
                        Name = Name
                    }
                }
                ;
                New_JCRule.Tilte      = r.Tilte;
                New_JCRule.ExDataStr  = r.ExDataStr;
                New_JCRule.MissionMsg = r.MissionMsg;
                New_JCRule.IsMission  = r.IsMission;
                New_JCRule.JCRuleType = r.JCRuleType;
                return(New_JCRule);
            }).ToList();

            lock (DataList.Current[Name].JCRules)
            {
                DataList.Current[Name].AddJCRule(New_Rlist.Where(p => !DataList.Current[Name].JCRules.Contains(p)).ToArray());
            }
            ClientList.AddNewMsg(Name, nameof(Data.JCRules));
            ClientList.AddNewMsg(Name, nameof(Data.Rules));
            ClientList.AddNewMsg(Name, nameof(Data.StudentMsgs));
            return(true);
        }
Beispiel #2
0
        private void Button_Add_Click(object sender, RoutedEventArgs e)
        {
            JCRule jCRule = Data.Current.LocalAddJCRule();

            SelectJCRule = jCRule;
            EditJCRules.Add(SelectJCRule);
        }
Beispiel #3
0
        public void UserActionByJCRule(string StudentMsgId, string JCRuleId, string CommandName, string Name)
        {
            JCRule   jCRule  = DataList.Current[Name].JCRules.Find(p => p.Id.ToString() == JCRuleId);
            ICommand command = (ICommand)jCRule.ExJCRule.GetType().GetProperty(CommandName).GetValue(jCRule.ExJCRule);

            command.Execute(DataList.Current[Name].StudentMsgs.Find(p => p.Id.ToString() == StudentMsgId));
        }
Beispiel #4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }
            JCRule jCRule = (JCRule)value;

            return(JCRuleType.JCRuleTypeList.First(p => p.Key == jCRule.ExJCRule.GetType()));
        }