Exemple #1
0
        public static int GetZhuanHuanFenCha(Entity.FenShuXian fenshuxian, int FenShu)
        {
            int PcFirst  = fenshuxian.PcFirst;
            int PcSecond = fenshuxian.PcSecond;
            int PcThird  = fenshuxian.PcThird;
            int ZkFirst  = fenshuxian.ZkFirst;
            int ZkSecond = fenshuxian.ZkSecond;

            int ZhuanHuanFenCha = 0;
            int PiCiXianShang   = 0;
            int PiCiXianXia     = 0;

            ////要注意一个问题,有可能一个学校是三本的,但是所有录取学生都是二本的学生,但是在这里没有区别吧!
            //if (FenShu >= PcFirst)
            //{
            //    ZhuanHuanFenCha = FenShu - PcFirst;
            //    return ZhuanHuanFenCha;
            //}
            //else if (FenShu >= PcSecond)
            //{
            //    PiCiXianShang = PcFirst;
            //    PiCiXianXia = PcSecond;

            //}
            //else if (PcThird != 0 && FenShu >= PcThird)
            //{
            //    PiCiXianShang = PcSecond;
            //    PiCiXianXia = PcThird;
            //}
            //else if (ZkFirst != 0 && FenShu >= ZkFirst)
            //{
            //    PiCiXianShang = (PcThird == 0 ? PcSecond : PcThird) - FenShu;//上一批次的线差
            //    PiCiXianXia = FenShu - ZkFirst;//批次线差
            //}
            //else if (ZkSecond != 0 && FenShu >= ZkSecond)
            //{
            //    PiCiXianShang = ZkFirst - FenShu;
            //    PiCiXianXia = FenShu - ZkSecond;
            //}
            //else
            //{
            //    studentChengJi.PiCi = 0;
            //    studentChengJi.XianChaShang = 0;//上一批次的线差
            //    studentChengJi.XianCha = 0;//批次线差
            //    studentChengJi.PiCiXian = 0;
            //}

            return(ZhuanHuanFenCha);
        }
Exemple #2
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int FenShuXianAdd(Entity.FenShuXian info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@Province",   SqlDbType.NVarChar, 50, info.Province),
         SqlDB.MakeInParam("@ProvinceId", SqlDbType.Int,       4, info.ProvinceId),
         SqlDB.MakeInParam("@KeLei",      SqlDbType.Int,       4, info.KeLei),
         SqlDB.MakeInParam("@DataYear",   SqlDbType.Int,       4, info.DataYear),
         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("@ZkFirst",    SqlDbType.Int,       4, info.ZkFirst),
         SqlDB.MakeInParam("@ZkSecond",   SqlDbType.Int,       4, info.ZkSecond),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "FenShuXianAdd", prams).ToString(), -1));
 }
Exemple #3
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="Id">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.FenShuXian FenShuXianEntityGet(int ProvinceId, string strWhere)
        {
            Entity.FenShuXian info = new Entity.FenShuXian();
            DataTable         dt   = SqlDB.ExecuteDataset(CommandType.Text, "SELECT TOP 1 * FROM [FenShuXian] WHERE ProvinceId = " + ProvinceId + strWhere + " ORDER BY DataYear DESC;").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.Id         = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
                info.Province   = dt.Rows[0]["Province"].ToString();
                info.ProvinceId = Basic.Utils.StrToInt(dt.Rows[0]["ProvinceId"].ToString(), 0);
                info.KeLei      = Basic.Utils.StrToInt(dt.Rows[0]["KeLei"].ToString(), 0);
                info.DataYear   = Basic.Utils.StrToInt(dt.Rows[0]["DataYear"].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.ZkFirst    = Basic.Utils.StrToInt(dt.Rows[0]["ZkFirst"].ToString(), 0);
                info.ZkSecond   = Basic.Utils.StrToInt(dt.Rows[0]["ZkSecond"].ToString(), 0);
            }
            return(info);
        }
Exemple #4
0
        public static int GetUserPiCiXianCha(Entity.FenShuXian fenshuxian, int FenShu, int PiCi)
        {
            int PcFirst  = fenshuxian.PcFirst;
            int PcSecond = fenshuxian.PcSecond;
            int PcThird  = fenshuxian.PcThird;
            int ZkFirst  = fenshuxian.ZkFirst;
            int ZkSecond = fenshuxian.ZkSecond;

            int XianCha = 0;

            if (PiCi == 1)
            {
                XianCha = FenShu - PcFirst;//批次线差
            }
            else if (PiCi == 2)
            {
                XianCha = FenShu - PcSecond;//批次线差
            }
            else if (PiCi == 3)
            {
                XianCha = FenShu - PcThird;//批次线差
            }
            else if (PiCi == 4)
            {
                XianCha = FenShu - ZkFirst;//批次的线差
            }
            else if (PiCi == 5)
            {
                XianCha = FenShu - ZkSecond;//批次线差
            }
            else
            {
                XianCha = 0;//批次线差
            }

            return(XianCha);
        }
Exemple #5
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool FenShuXianEdit(Entity.FenShuXian info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@Id",         SqlDbType.Int,       4, info.Id),
                SqlDB.MakeInParam("@Province",   SqlDbType.NVarChar, 50, info.Province),
                SqlDB.MakeInParam("@ProvinceId", SqlDbType.Int,       4, info.ProvinceId),
                SqlDB.MakeInParam("@KeLei",      SqlDbType.Int,       4, info.KeLei),
                SqlDB.MakeInParam("@DataYear",   SqlDbType.Int,       4, info.DataYear),
                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("@ZkFirst",    SqlDbType.Int,       4, info.ZkFirst),
                SqlDB.MakeInParam("@ZkSecond",   SqlDbType.Int,       4, info.ZkSecond),
            };
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(CommandType.StoredProcedure, "FenShuXianEdit", prams);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }
Exemple #6
0
        public static Entity.StudentChengJi GetZheJiangUserPiCi(Entity.FenShuXian fenshuxian, int FenShu, int DataYear, int ProvinceId, int KeLei)
        {
            Entity.StudentChengJi studentChengJi = new Entity.StudentChengJi();
            int PcFirst  = fenshuxian.PcFirst;
            int PcSecond = fenshuxian.PcSecond;
            int PcThird  = fenshuxian.PcThird;
            int ZkFirst  = fenshuxian.ZkFirst;
            int ZkSecond = fenshuxian.ZkSecond;

            if (FenShu >= PcFirst)
            {
                studentChengJi.PiCi         = 1;
                studentChengJi.XianChaShang = 0;                //上一批次的线差
                studentChengJi.XianCha      = FenShu - PcFirst; //批次线差
                studentChengJi.PiCiXian     = PcFirst;
            }
            else if (FenShu >= PcSecond)
            {
                studentChengJi.PiCi         = 2;
                studentChengJi.XianChaShang = PcFirst - FenShu;  //上一批次的线差
                studentChengJi.XianCha      = FenShu - PcSecond; //批次线差
                studentChengJi.PiCiXian     = PcSecond;
            }
            else if (PcThird != 0 && FenShu >= PcThird)
            {
                studentChengJi.PiCi         = 3;
                studentChengJi.XianChaShang = PcSecond - FenShu; //上一批次的线差
                studentChengJi.XianCha      = FenShu - PcThird;  //批次线差
                studentChengJi.PiCiXian     = PcThird;
            }
            else if (ZkFirst != 0 && FenShu >= ZkFirst)
            {
                studentChengJi.PiCi         = 4;
                studentChengJi.XianChaShang = (PcThird == 0 ? PcSecond : PcThird) - FenShu; //上一批次的线差
                studentChengJi.XianCha      = FenShu - ZkFirst;                             //批次线差
                studentChengJi.PiCiXian     = ZkFirst;
            }
            else if (ZkSecond != 0 && FenShu >= ZkSecond)
            {
                studentChengJi.PiCi         = 5;
                studentChengJi.XianChaShang = ZkFirst - FenShu;  //上一批次的线差
                studentChengJi.XianCha      = FenShu - ZkSecond; //批次线差
                studentChengJi.PiCiXian     = ZkSecond;
            }
            else
            {
                studentChengJi.PiCi         = 0;
                studentChengJi.XianChaShang = 0; //上一批次的线差
                studentChengJi.XianCha      = 0; //批次线差
                studentChengJi.PiCiXian     = 0;
            }

            //下面根据成绩来取位次等信息
            Entity.ProvinceWeiCi provinceWeiCi = DAL.ProvinceWeiCi.ProvinceWeiCiEntityGetByFenShu(FenShu, DataYear, ProvinceId, KeLei);
            if (provinceWeiCi == null)
            {
                studentChengJi.WeiCi       = 0;
                studentChengJi.RenShu      = 0;
                studentChengJi.LeiJiRenShu = 0;
            }
            else
            {
                studentChengJi.WeiCi       = provinceWeiCi.WeiCi;
                studentChengJi.RenShu      = provinceWeiCi.RenShu;
                studentChengJi.LeiJiRenShu = provinceWeiCi.LeiJiRenShu;
            }
            studentChengJi.FenShu = FenShu;

            return(studentChengJi);
        }