Beispiel #1
0
        /// <summary>
        /// 获得数据List
        /// </summary>
        public TeamGuideTrainmanArray GetTrainmanDataList(RsQueryTrainman QueryTrainman, RsQueryTrainman FilterTrainman)
        {
            StringBuilder strSql       = new StringBuilder();
            StringBuilder SqlCondition = new StringBuilder();

            SqlCondition.Append(QueryTrainman.strWorkShopGUID != "" ? " and A.strWorkShopGUID = @strWorkShopGUID" : "");
            SqlCondition.Append(QueryTrainman.strGuideGroupGUID != "" ? " and A.strGuideGroupGUID = @strGuideGroupGUID" : "");
            SqlCondition.Append(FilterTrainman.strWorkShopGUID != "" ? " and (A.strWorkShopGUID is null or A.strWorkShopGUID <> @strWorkShopGUIDFil)" : "");
            SqlCondition.Append(FilterTrainman.strGuideGroupGUID != "" ? " and (A.strGuideGroupGUID is null or A.strGuideGroupGUID <> @strGuideGroupGUIDFil)" : "");
            SqlParameter[] sqlParams =
            {
                new SqlParameter("strWorkShopGUID",      QueryTrainman.strWorkShopGUID),
                new SqlParameter("strGuideGroupGUID",    QueryTrainman.strGuideGroupGUID),
                new SqlParameter("strWorkShopGUIDFil",   FilterTrainman.strWorkShopGUID),
                new SqlParameter("strGuideGroupGUIDFil", FilterTrainman.strGuideGroupGUID)
            };
            strSql.Append("select A.strTrainmanGUID,A.strTrainmanNumber,A.strTrainmanName,A.strWorkShopGUID,B.strWorkShopName,A.strGuideGroupGUID,C.strGuideGroupName From Tab_Org_Trainman A");
            strSql.Append(" left join TAB_Org_WorkShop B on A.strWorkShopGUID=B.strWorkShopGUID");
            strSql.Append(" left join TAB_Org_GuideGroup C on A.strGuideGroupGUID=C.strGuideGroupGUID");
            strSql.Append(" where 1=1 " + SqlCondition.ToString() + " order by strTrainmanNumber");
            DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            TeamGuideTrainmanArray list = new TeamGuideTrainmanArray();

            foreach (DataRow dr in dt.Rows)
            {
                TeamGuideTrainman _Org_Trainman = new TeamGuideTrainman();
                TrainmanDataRowToModel(_Org_Trainman, dr);
                list.Add(_Org_Trainman);
            }
            return(list);
        }
Beispiel #2
0
        /// <summary>
        /// 获得数据List
        /// </summary>
        public TeamGuideTrainmanArray GetTrainmanDataListByPost(string strWorkShopGUID, int nPostID, int cmdType)
        {
            StringBuilder strSql = new StringBuilder();

            #region 查询条件
            StringBuilder SqlCondition = new StringBuilder();
            SqlCondition.Append(strWorkShopGUID != "" ? " and A.strWorkShopGUID = @strWorkShopGUID" : "");
            switch (cmdType)
            {
            case 0:
                SqlCondition.Append(((nPostID >= 1) && (nPostID <= 3)) ? " and  A.nPostID = @nPostID" : "");
                break;

            case 1:
                SqlCondition.Append(nPostID == 0 ? " and (A.nPostID is null or A.nPostID = 0)" : "");
                SqlCondition.Append(((nPostID >= 1) && (nPostID <= 3)) ? " and (A.nPostID is null or A.nPostID <> @nPostID)" : "");
                break;
            }

            SqlParameter[] sqlParams =
            {
                new SqlParameter("strWorkShopGUID", strWorkShopGUID),
                new SqlParameter("nPostID",         nPostID)
            };
            #endregion 查询条件

            strSql.Append("select A.strTrainmanGUID,A.strTrainmanNumber,A.strTrainmanName,A.strWorkShopGUID,B.strWorkShopName,A.nPostID From Tab_Org_Trainman A");
            strSql.Append(" left join TAB_Org_WorkShop B on A.strWorkShopGUID=B.strWorkShopGUID");
            strSql.Append(" where 1=1 " + SqlCondition.ToString() + " order by A.strTrainmanNumber");

            DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            TeamGuideTrainmanArray list = new TeamGuideTrainmanArray();
            foreach (DataRow dr in dt.Rows)
            {
                TeamGuideTrainman _Org_Trainman = new TeamGuideTrainman();
                TrainmanDataRowToModelByPost(_Org_Trainman, dr);
                list.Add(_Org_Trainman);
            }
            return(list);
        }