예제 #1
0
        public override async Task <IEnumerable <Employee> > GetDatas(int pagesize, int pagecount)
        {
            var opt = new TransactionOptions()
            {
                IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
            };

            using (var scope = new TransactionScope(TransactionScopeOption.Required, opt, TransactionScopeAsyncFlowOption.Enabled))
                using (var db = new ESContext())
                {
                    var source = await this.GetSource(db, this.Start)
                                 .OrderBy(l => l.Id)
                                 .Skip(pagesize * pagecount)
                                 .Take(pagecount)
                                 .ToListAsync();

                    scope.Complete();

                    return(source.Select(s => new Employee()
                    {
                        FirstName = s.FirstName,
                        LastName = s.LastName,
                        Salary = s.Salary,
                        Birthday = s.Birthday,
                        IsManager = s.IsManager,
                        OfficeHours = s.OfficeHours
                    }));
                }
        }
예제 #2
0
        public override bool ToBoolean(ESContext context)
        {
            var v1 = _value1.GetValue(context).ToObject();
            var v2 = _value2.GetValue(context).ToObject();

            return(v1.Equals(v2));
        }
예제 #3
0
        public override IESObject Execute(ESContext context)
        {
            var value = new ESClass(this);

            context.UpdateValue(_name, value);
            return(value);
        }
예제 #4
0
        public override IESObject GetValue(ESContext context)
        {
            var v1 = _value1.GetValue <IESNumber>(context);
            var v2 = _value2.GetValue <IESNumber>(context);

            return(new ESNumber(v1.Value * v2.Value));
        }
예제 #5
0
 public override Task <int> GetTotalAsync()
 {
     using (var db = new ESContext())
     {
         return(this.GetSource(db, this.Start).CountAsync());
     }
 }
예제 #6
0
        public IESObject GetValue(ESContext context)
        {
            var value = _rvalue.GetValue(context);

            _lvalue.SetValue(context, value.Clone());
            return(value);
        }
예제 #7
0
        public override IESObject Execute(ESContext context)
        {
            var ret = ESDefault.Value;

            while (true)
            {
                if (_cond.ToBoolean(context))
                {
                    ret = _entry.Execute(context);
                }
                else
                {
                    return(ret);
                }
                if (context.IsBreak)
                {
                    context.IsBreak = false;
                    return(ret);
                }
                if (context.IsReturn)
                {
                    return(ret);
                }
            }
        }
예제 #8
0
        public override bool ToBoolean(ESContext context)
        {
            var v1 = _value1.GetValue <IESNumber>(context);
            var v2 = _value2.GetValue <IESNumber>(context);

            return(v1.Value >= v2.Value);
        }
예제 #9
0
        public override IESObject Execute(ESContext context)
        {
            var ret   = ESDefault.Value;
            var index = 0;

            while (true)
            {
                if (index < Count)
                {
                    ret = this[index].Execute(context);
                }
                else
                {
                    return(ret);
                }
                if (context.IsReturn)
                {
                    return(ret);
                }
                else
                {
                    index += 1;
                }
            }
        }
예제 #10
0
        public override IESObject Execute(ESContext context)
        {
            var ret   = ESDefault.Value;
            var items = _list.GetValue <IESEnumerable>(context);
            var iter  = items.GetEnumerator();

            while (true)
            {
                if (iter.MoveNext())
                {
                    context.UpdateValue(_index.Name, ToVirtual(iter.Current));
                    ret = _entry.Execute(context);
                }
                else
                {
                    return(ret);
                }
                if (context.IsBreak)
                {
                    context.IsBreak = false;
                    return(ret);
                }
                if (context.IsReturn)
                {
                    return(ret);
                }
            }
        }
예제 #11
0
        public override IESObject Execute(ESContext context)
        {
            var ret   = ESDefault.Value;
            var index = _args.begin.GetValue(context).Clone().Cast <IESNumber>();
            var end   = _args.end.GetValue <IESNumber>(context).Value;
            var step  = _args.step.GetValue <IESNumber>(context).Value;

            while (true)
            {
                if (index.Value < end)
                {
                    context.UpdateValue(_args.index.Name, index);
                    ret = _entry.Execute(context);
                }
                else
                {
                    return(ret);
                }
                if (context.IsBreak)
                {
                    context.IsBreak = false;
                    return(ret);
                }
                if (context.IsReturn)
                {
                    return(ret);
                }
                else
                {
                    index.Value += step;
                }
            }
        }
예제 #12
0
        public IESObject GetValue(ESContext context)
        {
            var func = new ESFunction(context, this);

            context.UpdateValue(_name, func);
            return(func);
        }
예제 #13
0
 public static T GetValue <T>(this IExpressionRight exp, ESContext context)
 {
     try {
         return((T)exp.GetValue(context));
     } catch (Exception e) {
         throw new InvalidOperationException(exp.ToString(), e);
     }
 }
예제 #14
0
        private IQueryable <ES.Data.Models.Employee> GetSource(ESContext db, DateTime?start)
        {
            var query = db.Employee.AsNoTracking();

            if (start.HasValue)
            {
                query = query.Where(q => q.Last_Update_Date >= start || q.Creation_Date >= start);
            }
            return(query);
        }
예제 #15
0
 public IESObject New(ESContext context, IESObject[] args)
 {
     try {
         var objects = ESUtility.ToObjects(args, args.Length);
         var ctor    = _value.GetConstructor(ESUtility.ConvertTo(objects, t => t.GetType()));
         return(ToVirtual(ctor.Invoke(objects)));
     } catch (Exception e) {
         throw new InvalidOperationException(string.Format(ToString() + " Arguments: {0}", args.Format()), e);
     }
 }
예제 #16
0
 public IESObject GetValue(ESContext context)
 {
     if (Count == 1)
     {
         return(this[0].Execute(context));
     }
     else
     {
         throw new InvalidOperationException("Count != 1");
     }
 }
예제 #17
0
        public IESObject New(ESContext context, IESObject[] args)
        {
            context = new ESContext(context);
            var obj = new ESInstance();

            context.UpdateValue("this", obj);
            _entry.Execute(context);
            context.ForEach(obj.Add);
            var ctor = context.GetValue <IESFunction>(_name);

            ctor.Invoke(args);
            return(obj);
        }
예제 #18
0
        public static void Main(string[] args)
        {
            var esCtx = new ESContext();

            esCtx.Computers.Add(new Computer()
            {
                Description = "test", CoolingType = "none", Price = 333, Weight = 2
            });
            esCtx.SaveChanges();

            var tsCtx = new TSContext();

            tsCtx.Computers.Add(new TSComputer()
            {
                Description = "test", CoolingType = "none", Price = 333, Weight = 2,
                Server      = new Server()
                {
                    BandWidth = 100
                }
            });
            tsCtx.SaveChanges();
        }
예제 #19
0
 public static IESObject[] ToArray(ESContext context, List <IExpressionRight> _args)
 {
     return(_args.Count == 0 ? _0Vtrs : _args.Select(t => t.Execute(context)).ToArray());
 }
예제 #20
0
 public IESObject New(ESContext context, IESObject[] args)
 {
     return(_value.New(context, args));
 }
예제 #21
0
 public IESObject New(ESContext context, params object[] args)
 {
     return(New(context, ToVirtuals(args, args.Length)));
 }
예제 #22
0
 public IESObject New(ESContext context)
 {
     return(New(context, ToVirtuals(null, 0)));
 }
예제 #23
0
 public IESObject GetValue(ESContext context)
 {
     return(_target.GetValue(context).GetProperty(_property.Name));
 }
예제 #24
0
 public override IESObject Execute(ESContext context)
 {
     return(GetValue(context));
 }
예제 #25
0
 public bool ToBoolean(ESContext context)
 {
     return(GetProperty(context).GetValue().ToBoolean());
 }
예제 #26
0
 public void SetValue(ESContext context, IESObject value)
 {
     GetProperty(context).SetValue(value);
 }
예제 #27
0
 private IESProperty GetProperty(ESContext context)
 {
     return(Execute(context).Cast <IESProperty>());
 }
예제 #28
0
 public override IESObject Execute(ESContext context)
 {
     throw new InvalidOperationException(ToString());
 }
예제 #29
0
 public IESObject GetValue(ESContext context)
 {
     return(_args.Count == 0 ? new ESTable() : new ESTable(_args.ToDictionary(t => t.Key, t => t.Value.GetValue(context))));
 }
예제 #30
0
 public override bool ToBoolean(ESContext context)
 {
     return(!_target.ToBoolean(context));
 }