Beispiel #1
0
        /// <summary>
        /// 获得数据List
        /// </summary>
        public DrinkInfoArray GetDrinkDataList(DrinkQueryParam QueryCondition)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from VIEW_Drink_query where dtCreateTime >= @dtBeginTime and dtCreateTime <= @dtEndTime ");
            strSql.Append(GetWhere(QueryCondition));
            strSql.Append(" order by dtCreateTime desc");

            SqlParameter[] sqlParams =
            {
                new SqlParameter("dtBeginTime",       QueryCondition.dtBeginTime),
                new SqlParameter("dtEndTime",         QueryCondition.dtEndTime),
                new SqlParameter("strPlaceID",        QueryCondition.PlaceId),
                new SqlParameter("strAreaGUID",       QueryCondition.strJwdId),
                new SqlParameter("strWorkShopGUID",   QueryCondition.WorkShopGUID),
                new SqlParameter("strTrainmanNumber", QueryCondition.TrainmanNumber),
                new SqlParameter("nVerifyID",         QueryCondition.VerifyID),
                new SqlParameter("nWorkTypeID",       QueryCondition.DrinkTypeID),
                new SqlParameter("nDrinkResult",      QueryCondition.DrinkResultID),
                new SqlParameter("strTrainmanName",   QueryCondition.TrainmanName + "%"),
                new SqlParameter("nCadreTypeID",      QueryCondition.CadreTypeID),
                new SqlParameter("strDepartmentID",   QueryCondition.DepartmentID),
            };
            DataTable      dt   = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            DrinkInfoArray list = new DrinkInfoArray();

            foreach (DataRow dr in dt.Rows)
            {
                DrinkInfo _Drink_Query = new DrinkInfo();
                DrinkDataRowToModel(_Drink_Query, dr);
                list.Add(_Drink_Query);
            }
            return(list);
        }
Beispiel #2
0
        public string GetWhere(DrinkQueryParam model)
        {
            StringBuilder strSqlOption = new StringBuilder();

            strSqlOption.Append(!string.IsNullOrEmpty(model.PlaceId) ? " and strPlaceID = @strPlaceID" : "");
            strSqlOption.Append(!string.IsNullOrEmpty(model.strJwdId) ? " and strAreaGUID = @strAreaGUID" : "");
            strSqlOption.Append(!string.IsNullOrEmpty(model.WorkShopGUID) ? " and strWorkShopGUID = @strWorkShopGUID" : "");
            strSqlOption.Append(!string.IsNullOrEmpty(model.TrainmanNumber) ? " and strTrainmanNumber = @strTrainmanNumber" : "");
            strSqlOption.Append(model.VerifyID > -1 ? " and nVerifyID = @nVerifyID" : "");
            strSqlOption.Append(model.DrinkTypeID > -1 ? " and nWorkTypeID = @nWorkTypeID" : "");
            strSqlOption.Append(model.DrinkResultID > -1 ? " and nDrinkResult = @nDrinkResult" : "");
            strSqlOption.Append(!string.IsNullOrEmpty(model.TrainmanName) ? " and strTrainmanName like @strTrainmanName" : "");
            strSqlOption.Append(!string.IsNullOrEmpty(model.DepartmentID) ? " and strDepartmentID = @strDepartmentID" : "");
            strSqlOption.Append(model.CadreTypeID != "" && model.CadreTypeID != "-1" ? " and nCadreTypeID = @nCadreTypeID" : "");

            return(strSqlOption.ToString());
        }