Exemple #1
0
 public GUTag(string title, Guid id)
 {
     Id = id;
     Alias.Add(title);
     if (Id == StaticCfg.Ins.DefaultTagID)
     {
         InitDir(null);
     }
 }
Exemple #2
0
        public void IsUserによる登録ユーザの確認(String user, bool expected)
        {
            //setUp
            var sut = new Alias(_domainList, _mailBox);

            sut.Add("dmy", "user1,user2", new Logger());
            sut.Add("user1", "user3,user4", new Logger());

            var rcptList = new List <MailAddress>();

            rcptList.Add(new MailAddress("*****@*****.**"));

            //exercise
            var actual = sut.IsUser(user);

            //verify
            Assert.That(actual, Is.EqualTo(expected));
        }
Exemple #3
0
 public GUTag(string title)
 {
     if (title == StaticCfg.Ins.DefaultTag)
     {
         Id = StaticCfg.Ins.DefaultTagID;
     }
     else
     {
         Id = Guid.NewGuid();
     }
     Alias.Add(title);
 }
Exemple #4
0
 public GUTag(string title)
 {
     if (title == StaticCfg.Ins.DefaultTagTitle)
     {
         Id = StaticCfg.Ins.DefaultTagID;
     }
     else
     {
         Id = Guid.NewGuid();
     }
     Alias.Add(title);
     if (Id == StaticCfg.Ins.DefaultTagID)
     {
         InitDir(null);
     }
 }
Exemple #5
0
        ///  <summary>
        ///         Adds a new variable or alias. An alias is bound to its scope and will
        /// be reset when the scoping <see cref="IDocumentItem"/> is closed.
        /// An Variable is global when the <see cref="idVariableScope"/> is 0
        ///  </summary>
        private void AddVariableInternal(string name, object value, int idVariableScope)
        {
            if (idVariableScope == 0)
            {
                Variables[name] = value;
            }
            else
            {
                if (!Alias.TryGetValue(name, out var stack))
                {
                    stack = new Dictionary <int, object>();
                    Alias.Add(name, stack);
                }

                stack[idVariableScope] = value;
            }
        }
Exemple #6
0
        public void Reflectionによる宛先の変換_ヒットなし()
        {
            //setUp
            var sut = new Alias(_domainList, _mailBox);

            sut.Add("user1", "user2,user3", new Logger());

            var rcptList = new List <MailAddress>();

            rcptList.Add(new MailAddress("*****@*****.**"));

            //exercise
            var actual = sut.Reflection(rcptList, new Logger());

            //verify
            Assert.That(actual.Count, Is.EqualTo(1));
            Assert.That(actual[0].ToString(), Is.EqualTo("*****@*****.**"));
        }
Exemple #7
0
        /// <summary>
        /// 开始组装查询语句
        /// </summary>
        /// <param name="Func"></param>
        protected void CodeSelect <BaseEntity>(dynamic Func)
        {
            var Lambda = (Func as LambdaExpression);
            var body   = (Lambda.Body as NewExpression);

            if (body == null)
            {
                throw new Exception("语法错误 这里用过使用 new {  } 匿名实例化语法!");
            }
            var values = body.Arguments;
            var member = body.Members;
            var column = new List <string>();

            foreach (var item in Lambda.Parameters)
            {
                dynamic dy       = Activator.CreateInstance(item.Type);
                var     TName    = dy.EH.GetTabName(item.Type);
                var     Displame = item.Name;
                Alias.Add(Displame, TName);
            }
            Builder.Append(" SELECT ");
            var list_member = member.ToList();

            foreach (MemberExpression item in values)
            {
                //检查是否有别名
                var DisplayName = list_member[values.IndexOf(item)].Name;
                if (DisplayName == item.Member.Name)
                {
                    column.Add((item.Expression as ParameterExpression).Name + "." + item.Member.Name);
                }
                else
                {
                    column.Add((item.Expression as ParameterExpression).Name + "." + item.Member.Name + " AS " + DisplayName);
                }
            }
            Builder.Append(string.Join(",", column));
            var ByName  = Lambda.Parameters[0].Name;
            var TabName = Alias[ByName] + " " + ByName;

            Builder.Append(" FROM " + TabName);
        }
Exemple #8
0
 public string ToSql()
 {
     return(string.IsNullOrEmpty(ColumnName)
         ? string.Empty
         : Alias.Add(".", "[" + ColumnName + "]"));
 }
Exemple #9
0
 public GUTag(string title, Guid id)
 {
     Id = id;
     Alias.Add(title);
 }