Esempio n. 1
0
        /// <summary>
        /// 获取指定维度值的号码集合
        /// </summary>
        /// <param name="dimCode">维度代码</param>
        /// <param name="value">维值</param>
        /// <returns>号码集合</returns>
        public List <DmDPC> GetNumbers(string dimCode, string value)
        {
            string  inValue = string.Join(",", value.Split(',').Select(x => string.Format("'{0}'", x)));
            Operand operand = Restrictions.Clause(SqlClause.Where)
                              .Append(Restrictions.In(dimCode, inValue));

            return(this.DataAccessor.SelectWithCondition(operand.ToString(), dimCode, SortTypeEnum.ASC, null, dimCode, DmDPC.C_Number));
        }
Esempio n. 2
0
        public List <Category> GetEnabledCategories(bool isFromCache)
        {
            if (isFromCache)
            {
                return(this.GetEnabledCategories());
            }

            Operand operand = Restrictions.Clause(SqlClause.Where)
                              .Append(Restrictions.Equal(Category.C_Enabled, 1));

            return(this.DataAccessor.SelectWithCondition(operand.ToString()));
        }
Esempio n. 3
0
        public HashSet <long> GetPeroidsByDate(DateTime date)
        {
            string  dayOfBefore3 = date.AddDays(-1).ToString("yyyyMMdd");
            Operand operand      = Restrictions.Clause(SqlClause.Where)
                                   .Append(Restrictions.GreaterThanOrEqual(DwNumber.C_Date, dayOfBefore3));
            var            dtos    = this.DataAccessor.SelectWithCondition(operand.ToString(), DwNumber.C_P);
            HashSet <long> hashSet = new HashSet <long>();

            foreach (var dto in dtos)
            {
                hashSet.Add(dto.P);
            }
            return(hashSet);
        }
        public void CompositeOperand()
        {
            string sqlCondition = "Where Name = TomDeng  AND Age = 29  AND (Weight BETWEEN 100 AND 180  AND Salary < 20w )";

            Operand operand = Restrictions.Clause(SqlClause.Where)
                              .Append(Restrictions.Equal("Name", "TomDeng"))
                              .Append(Restrictions.And)
                              .Append(Restrictions.Equal("Age", 29))
                              .Append(Restrictions.And)
                              .Append(Restrictions.Bracket(Bracket.Left))
                              .Append(Restrictions.Between("Weight", 100, 180))
                              .Append(Restrictions.And)
                              .Append(Restrictions.LessThan("Salary", "20w"))
                              .Append(Restrictions.Bracket(Bracket.Rgiht));

            Assert.That(operand.ToString(), Is.EqualTo(sqlCondition));
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            Operand operand = Restrictions.Clause(SqlClause.Where)
                              .Append(Restrictions.Equal("Name", "TomDeng"))
                              .Append(Restrictions.And)
                              .Append(Restrictions.Equal("Age", 29))
                              .Append(Restrictions.And)
                              .Append(Restrictions.Bracket(Bracket.Left))
                              .Append(Restrictions.Between("Weight", 100, 180))
                              .Append(Restrictions.And)
                              .Append(Restrictions.LessThan("Salary", "20w"))
                              .Append(Restrictions.Bracket(Bracket.Rgiht));

            System.Console.WriteLine(operand);
            System.Console.WriteLine("Finished");
            System.Console.Read();
        }