Пример #1
0
          public string ToSqlWhere(out MySqlParameter[] paras)
        {
            if (FilterHelper.IsObjectEmpty<AccountFilter>(this))
            {
                paras = null;
                return string.Empty;
            }

            List<string> listWhere = new List<string>();
            List<MySqlParameter> listPara = new List<MySqlParameter>();

            if (!string.IsNullOrWhiteSpace(TypeId))
            {
                listWhere.Add("a.TypeId=@TypeId");
                listPara.Add(new MySqlParameter("TypeId", this.TypeId));
            }
            if (!string.IsNullOrWhiteSpace(Pid))
            {
                listWhere.Add("Pid=@Pid");
                listPara.Add(new MySqlParameter("Pid", this.Pid));

            }
 
    }
Пример #2
0
         public string ToSqlWhere(out MySqlParameter[] paras)
        {
            if (FilterHelper.IsObjectEmpty<AccountFilter>(this))
            {
                paras = null;
                return string.Empty;
            }

            List<string> listWhere = new List<string>();
            List<MySqlParameter> listPara = new List<MySqlParameter>();

            if (!string.IsNullOrWhiteSpace(Name))
            {
                listWhere.Add("Name=@Name");
                listPara.Add(new MySqlParameter("Name", this.Name));

            }
             if (!string.IsNullOrWhiteSpace(Administrator))
            {
                listWhere.Add("(Administrator like @Administrator or Administrator like @Administrator)");
                listPara.Add(new MySqlParameter("Administrator", this.Administrator.Wrap("%")));
            }

    }
Пример #3
0
        public string ToSqlWhere(out MySqlParameter[] paras)
        {
            if (FilterHelper.IsObjectEmpty <AccountFilter>(this))
            {
                paras = null;
                return(string.Empty);
            }

            List <string>         listWhere = new List <string>();
            List <MySqlParameter> listPara  = new List <MySqlParameter>();

            if (!string.IsNullOrWhiteSpace(SerialNumber))
            {
                listWhere.Add("SerialNumber=@SerialNumber");
                listPara.Add(new MySqlParameter("SerialNumber", this.SerialNumber));
            }
            if (!string.IsNullOrWhiteSpace(GrowthStage))
            {
                listWhere.Add("GrowthStage=@GrowthStage");
                listPara.Add(new MySqlParameter("GrowthStage", this.GrowthStage));
            }
            if (!string.IsNullOrWhiteSpace(Gender))
            {
                listWhere.Add("Gender=@Gender");
                listPara.Add(new MySqlParameter("Gender", this.Gender));
            }

            if (!string.IsNullOrWhiteSpace(SheepfoldId))
            {
                listWhere.Add("SheepfoldId=@SheepfoldId");
                listPara.Add(new MySqlParameter("SheepfoldId", this.SheepfoldId));
            }
            if (!string.IsNullOrWhiteSpace(BirthWeight))
            {
                listWhere.Add("( BirthWeight like @ BirthWeight or  BirthWeight like @ BirthWeight)");
                listPara.Add(new MySqlParameter(" BirthWeight", this.BirthWeight.Wrap("%")));
            }
            if (StartTime != null)
            {
                listWhere.Add("Birthday >= @StartTime");
                listPara.Add(new MySqlParameter("StartTime", this.StartTime));
            }
            if (EndTime != null)
            {
                listWhere.Add("Birthday <= @EndTime");
                listPara.Add(new MySqlParameter("EndTime", this.EndTime));
            }

            if (!string.IsNullOrWhiteSpace(AblactationWeight))
            {
                listWhere.Add("( AblactationWeight like @ AblactationWeight or  AblactationWeight like @ AblactationWeight)");
                listPara.Add(new MySqlParameter(" AblactationWeight", this.AblactationWeight.Wrap("%")));
            }

            if (StartTime != null)
            {
                listWhere.Add("AblactationDate >= @StartTime");
                listPara.Add(new MySqlParameter("StartTime", this.StartTime));
            }
            if (EndTime != null)
            {
                listWhere.Add("AblactationDate <= @EndTime");
                listPara.Add(new MySqlParameter("EndTime", this.EndTime));
            }

            if (!string.IsNullOrWhiteSpace(Origin))
            {
                listWhere.Add("(Origin like @Origin or Origin like @Origin)");
                listPara.Add(new MySqlParameter("Origin", this.Origin.Wrap("%")));
            }

            if (!string.IsNullOrWhiteSpace(FatherId))
            {
                listWhere.Add("FatherId=@FatherId");
                listPara.Add(new MySqlParameter("FatherId", this.FatherId));
            }

            if (!string.IsNullOrWhiteSpace(FatherId))
            {
                listWhere.Add("MotherId=@MotherId");
                listPara.Add(new MySqlParameter("MotherId", this.MotherId));
            }
            paras = listPara.ToArray();
            return(" where " + string.Join(" and ", listWhere));
        }