예제 #1
0
        public DrinkInfoArray QueryNoPlanDrink(DateTime dtBeginTime, DateTime dtEndTime, string TrainmanNumber, int DrinkTypeID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from VIEW_Drink_Query where dtCreateTime >= @dtBeginTime and dtCreateTime <= @dtEndTime ");
            strSql.Append(!string.IsNullOrEmpty(TrainmanNumber) ? " and strTrainmanNumber = @strTrainmanNumber" : "");
            strSql.Append(DrinkTypeID > -1 ? " and nWorkTypeID = @nWorkTypeID" : "");
            strSql.Append(" and  (strWorkID = '' or strWorkID is Null ) order by dtCreateTime desc");
            SqlParameter[] sqlParams =
            {
                new SqlParameter("dtBeginTime",       dtBeginTime),
                new SqlParameter("dtEndTime",         dtEndTime),
                new SqlParameter("strTrainmanNumber", TrainmanNumber),
                new SqlParameter("nWorkTypeID",       DrinkTypeID)
            };

            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);
        }
예제 #2
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);
        }
예제 #3
0
        public DrinkInfoArray GetTrainNoDrinkInfo(DateTime dtStartTime, string strTrainNo, string strPlaceID, int ncount)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top " + ncount + " strTrainmanNumber,strTrainmanName,strTrainmanGUID, dwAlcoholicity,nDrinkResult,dtCreateTime ");
            strSql.Append(" from TAB_Drink_Information WHERE dtCreateTime in (select max(dtCreateTime) from TAB_Drink_Information");
            strSql.Append(" where dtcreatetime >= @dtStartTime and strTrainNo = @strTrainNo ");
            if (!string.IsNullOrEmpty(strPlaceID))
            {
                strSql.Append(" and strPlaceID=@strPlaceID");
            }
            strSql.Append(" group by strTrainmanNumber)");
            SqlParameter[] sqlParams =
            {
                new SqlParameter("dtStartTime", dtStartTime),
                new SqlParameter("strTrainNo",  strTrainNo),
                new SqlParameter("strPlaceID",  strPlaceID)
            };
            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();
                _Drink_Query.strTrainmanGUID   = ObjectConvertClass.static_ext_string(dr["strTrainmanGUID"]);
                _Drink_Query.strTrainmanNumber = ObjectConvertClass.static_ext_string(dr["strTrainmanNumber"]);
                _Drink_Query.strTrainmanName   = ObjectConvertClass.static_ext_string(dr["strTrainmanName"]);
                _Drink_Query.dwAlcoholicity    = ObjectConvertClass.static_ext_int(dr["dwAlcoholicity"]);
                _Drink_Query.nDrinkResult      = ObjectConvertClass.static_ext_int(dr["nDrinkResult"]);
                _Drink_Query.dtCreateTime      = ObjectConvertClass.static_ext_date(dr["dtCreateTime"]);
                list.Add(_Drink_Query);
            }
            return(list);
        }