/// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool StudentGaoKaoHistoryEdit(Entity.StudentGaoKaoHistory info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@Id",                SqlDbType.Int,      4, info.Id),
                SqlDB.MakeInParam("@StudentId",         SqlDbType.Int,      4, info.StudentId),
                SqlDB.MakeInParam("@FenShu",            SqlDbType.Int,      4, info.FenShu),
                SqlDB.MakeInParam("@FirstLevel",        SqlDbType.Int,      4, info.FirstLevel),
                SqlDB.MakeInParam("@SecondLevel",       SqlDbType.Int,      4, info.SecondLevel),
                SqlDB.MakeInParam("@PcFirst",           SqlDbType.Int,      4, info.PcFirst),
                SqlDB.MakeInParam("@PcSecond",          SqlDbType.Int,      4, info.PcSecond),
                SqlDB.MakeInParam("@PcThird",           SqlDbType.Int,      4, info.PcThird),
                SqlDB.MakeInParam("@PcZhuanKeFirst",    SqlDbType.Int,      4, info.PcZhuanKeFirst),
                SqlDB.MakeInParam("@PcZhuanKeSecond",   SqlDbType.Int,      4, info.PcZhuanKeSecond),
                SqlDB.MakeInParam("@IsSetUpFenShuXian", SqlDbType.Int,      4, info.IsSetUpFenShuXian),
                SqlDB.MakeInParam("@WeiCi",             SqlDbType.Int,      4, info.WeiCi),
                SqlDB.MakeInParam("@IsSetUpWeiCi",      SqlDbType.Int,      4, info.IsSetUpWeiCi),
                SqlDB.MakeInParam("@AddTime",           SqlDbType.DateTime, 8, info.AddTime),
                SqlDB.MakeInParam("@IsGaoKao",          SqlDbType.Int,      4, info.IsGaoKao),
                SqlDB.MakeInParam("@IsLatest",          SqlDbType.Int,      4, info.IsLatest),
            };
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(CommandType.StoredProcedure, "StudentGaoKaoHistoryEdit", prams);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="Id">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.StudentGaoKaoHistory StudentGaoKaoHistoryEntityGet(int StudentId)
        {
            Entity.StudentGaoKaoHistory info = new Entity.StudentGaoKaoHistory();
            DataTable dt = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [StudentGaoKaoHistory] WHERE StudentId = " + StudentId + " ORDER BY ID DESC;").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.Id                = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
                info.StudentId         = Basic.Utils.StrToInt(dt.Rows[0]["StudentId"].ToString(), 0);
                info.FenShu            = Basic.Utils.StrToInt(dt.Rows[0]["FenShu"].ToString(), 0);
                info.FirstLevel        = Basic.Utils.StrToInt(dt.Rows[0]["FirstLevel"].ToString(), 0);
                info.SecondLevel       = Basic.Utils.StrToInt(dt.Rows[0]["SecondLevel"].ToString(), 0);
                info.PcFirst           = Basic.Utils.StrToInt(dt.Rows[0]["PcFirst"].ToString(), 0);
                info.PcSecond          = Basic.Utils.StrToInt(dt.Rows[0]["PcSecond"].ToString(), 0);
                info.PcThird           = Basic.Utils.StrToInt(dt.Rows[0]["PcThird"].ToString(), 0);
                info.PcZhuanKeFirst    = Basic.Utils.StrToInt(dt.Rows[0]["PcZhuanKeFirst"].ToString(), 0);
                info.PcZhuanKeSecond   = Basic.Utils.StrToInt(dt.Rows[0]["PcZhuanKeSecond"].ToString(), 0);
                info.IsSetUpFenShuXian = Basic.Utils.StrToInt(dt.Rows[0]["IsSetUpFenShuXian"].ToString(), 0);
                info.WeiCi             = Basic.Utils.StrToInt(dt.Rows[0]["WeiCi"].ToString(), 0);
                info.IsSetUpWeiCi      = Basic.Utils.StrToInt(dt.Rows[0]["IsSetUpWeiCi"].ToString(), 0);
                info.IsGaoKao          = Basic.Utils.StrToInt(dt.Rows[0]["IsGaoKao"].ToString(), 0);
                info.IsLatest          = Basic.Utils.StrToInt(dt.Rows[0]["IsLatest"].ToString(), 0);
                info.AddTime           = Basic.Utils.StrToDateTime(dt.Rows[0]["AddTime"].ToString());
            }
            else
            {
                return(null);
            }
            return(info);
        }
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int StudentGaoKaoHistoryAdd(Entity.StudentGaoKaoHistory info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@StudentId",         SqlDbType.Int, 4, info.StudentId),
         SqlDB.MakeInParam("@FenShu",            SqlDbType.Int, 4, info.FenShu),
         SqlDB.MakeInParam("@FirstLevel",        SqlDbType.Int, 4, info.FirstLevel),
         SqlDB.MakeInParam("@SecondLevel",       SqlDbType.Int, 4, info.SecondLevel),
         SqlDB.MakeInParam("@PcFirst",           SqlDbType.Int, 4, info.PcFirst),
         SqlDB.MakeInParam("@PcSecond",          SqlDbType.Int, 4, info.PcSecond),
         SqlDB.MakeInParam("@PcThird",           SqlDbType.Int, 4, info.PcThird),
         SqlDB.MakeInParam("@PcZhuanKeFirst",    SqlDbType.Int, 4, info.PcZhuanKeFirst),
         SqlDB.MakeInParam("@PcZhuanKeSecond",   SqlDbType.Int, 4, info.PcZhuanKeSecond),
         SqlDB.MakeInParam("@IsSetUpFenShuXian", SqlDbType.Int, 4, info.IsSetUpFenShuXian),
         SqlDB.MakeInParam("@WeiCi",             SqlDbType.Int, 4, info.WeiCi),
         SqlDB.MakeInParam("@IsSetUpWeiCi",      SqlDbType.Int, 4, info.IsSetUpWeiCi),
         SqlDB.MakeInParam("@IsGaoKao",          SqlDbType.Int, 4, info.IsGaoKao),
         SqlDB.MakeInParam("@IsLatest",          SqlDbType.Int, 4, info.IsLatest),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "StudentGaoKaoHistoryAdd", prams).ToString(), -1));
 }
Beispiel #4
0
        public static DataTable FenShengYuanXiaoLuQuList(string strWhere, int StudentProvinceId, int StudentId, int StudentKeLei, int StudentPiCi, int StudentPcLeiBie, int XianCha, int StudentFirstLevel, int StudentSecondLevel)
        {
            Entity.StudentGaoKaoHistory studentHistory = DAL.StudentGaoKaoHistory.StudentGaoKaoHistoryEntityGet(StudentId);
            string strSql;
            string strSqlColum = "";
            string strSqlTable = " WHERE FSYXLQ.SchoolId = S.Id ";

            //江苏的推荐算法,因为有科类等级的区分,所以需要特殊处理
            if (StudentProvinceId == 10)
            {
                strSqlTable = " WHERE FSYXLQ.SchoolId = S.Id AND ((fsyxlq.FirstAsk =0 AND fsyxlq.SecondAsk = 0) OR (fsyxlq.IsAsk = 1 AND fsyxlq.FirstAsk >=" + StudentFirstLevel + " AND  fsyxlq.SecondAsk >=" + StudentSecondLevel + ") OR (fsyxlq.IsAsk = 0 AND fsyxlq.FirstAsk >=" + StudentFirstLevel + " AND  fsyxlq.SecondAsk >=" + StudentSecondLevel + ") OR (fsyxlq.IsAsk = 0 AND fsyxlq.SecondAsk >=" + StudentFirstLevel + " AND  fsyxlq.FirstAsk >=" + StudentSecondLevel + ") )";
            }
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql = "SELECT TOP 80 FSYXLQ.*,S.*,S.Id as SchoolId,FSYXLQ.YuanXiaoDaiMa as SchoolCode " + strSqlColum + " FROM [" + DAL.Common.GetProvinceTableName(StudentProvinceId, "FenShengYuanXiaoLuQu") + "] AS FSYXLQ,[School] AS S " + strSqlTable + " AND " + strWhere;
            }
            else
            {
                strSql = "SELECT TOP 80 FSYXLQ.*,S.*,S.Id as SchoolId,FSYXLQ.YuanXiaoDaiMa as SchoolCode " + strSqlColum + " FROM [" + DAL.Common.GetProvinceTableName(StudentProvinceId, "FenShengYuanXiaoLuQu") + "] AS FSYXLQ,[School] AS S " + strSqlTable + "";
            }
            //这个是有问题的,不过目的是先出来结果
            strSql = strSql + " AND FSYXLQ.ProvinceId = " + StudentProvinceId + " AND FSYXLQ.KeLei = " + StudentKeLei + " AND FSYXLQ.PiCi = " + StudentPiCi + " AND FSYXLQ.PcLeiBie = " + StudentPcLeiBie;

            if (XianCha > 0)
            {
                strSql = strSql + " order by abs(" + XianCha + " - FSYXLQ.glPingJunXianCha) asc";
            }
            else
            {
                strSql = strSql + " order by FSYXLQ.glPingJunXianCha asc";
            }

            strSql = strSql + "";

            return(SqlDB.ExecuteDataset(CommandType.Text, strSql).Tables[0]);
        }