示例#1
0
        public void SaveLsnActs(IList <EnLsnAct> Values)
        {
            foreach (EnLsnAct act in Values)
            {
                IList <EnLsnAct> Acts = ClsLsns[act.ClsLesson.Id].Acts;
                if (Acts.Contains(act))
                {
                    ThisModule.OleDB.ExecuteNonQuery("update TLsnAct set"
                                                     + " FLocked = " + (act.Locked ? "True" : "false")
                                                     + ", FTime = " + VcTimeLogic.TimeToInt32(act.Time)
                                                     + " where Id = " + act.Id);
                }
                else
                {
                    Debug.Assert(act.Id == 0, "act.Id != 0");

                    EnLsnAct nAct = new EnLsnAct();
                    nAct.Locked    = act.Locked;
                    nAct.ClsLesson = act.ClsLesson;
                    act.Time.CopyFieldTo(nAct.Time);
                    nAct.Id = Convert.ToInt64(ThisModule.OleDB.InsertAndReturnId_MS("Insert into TLsnAct"
                                                                                    + "(FClsLesson, FLocked, FTime) values ("
                                                                                    + nAct.ClsLesson.Id
                                                                                    + ", " + (act.Locked ? "True" : "false")
                                                                                    + ", " + VcTimeLogic.TimeToInt32(nAct.Time)
                                                                                    + ")"));

                    Acts.Add(nAct);
                }
            }
        }
示例#2
0
        public void SetRules(BaseEntity Ety, IList <VcRuleCell> Value)
        {
            List <KindIdent> KindIdents;
            Int32            RulesIdx;

            if (Find(Ety, out KindIdents, out RulesIdx))
            {
                KindIdents[RulesIdx].Rules.Clear();
                ExIList.Append <VcRuleCell>(Value, KindIdents[RulesIdx].Rules);
            }
            else
            {
                KindIdent ki = new KindIdent(Ety.GetType().Name);
                ExIList.Append <VcRuleCell>(Value, ki.Rules);
                if (KindIdents == null)
                {
                    KindIdents = new List <KindIdent>();
                    KindIdents.Add(ki);
                    RulesIdx = KindIdents.Count - 1;
                    RuleBuf.Add(Ety.Id, KindIdents);
                }
            }

            ThisModule.OleDB.ExecuteNonQuery("Delete from TRule "
                                             + " where FKind = '" + Ety.GetType().Name + "'"
                                             + " and FId = " + Ety.Id);

            foreach (VcRuleCell rt in KindIdents[RulesIdx].Rules)
            {
                ThisModule.OleDB.ExecuteNonQuery("insert into TRule"
                                                 + " (FKind, FId, FRule, FTime) values ("
                                                 + "'" + Ety.GetType().Name + "'"
                                                 + ", " + Ety.Id
                                                 + ", " + (Int32)rt.Rule
                                                 + ", " + VcTimeLogic.TimeToInt32(rt.Time)
                                                 + ")");
            }
        }