/// <summary> /// 调用存储过程增加一个 /// </summary> /// <param name="info">实体对象</param> /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns> public static int BenKeFenShuAdd(Entity.BenKeFenShu info) { SqlParameter[] prams = { SqlDB.MakeInParam("@DataYear", SqlDbType.Int, 4, info.DataYear), SqlDB.MakeInParam("@KaoShengHao", SqlDbType.VarChar, 50, info.KaoShengHao), SqlDB.MakeInParam("@ccdm", SqlDbType.VarChar, 50, info.Ccdm), SqlDB.MakeInParam("@KeLei", SqlDbType.Int, 4, info.KeLei), SqlDB.MakeInParam("@KeLeiDaiMa", SqlDbType.VarChar, 50, info.KeLeiDaiMa), SqlDB.MakeInParam("@SchoolId", SqlDbType.Int, 4, info.SchoolId), SqlDB.MakeInParam("@YuanXiaoDaiMa", SqlDbType.VarChar, 50, info.YuanXiaoDaiMa), SqlDB.MakeInParam("@YuanXiaoMingCheng", SqlDbType.VarChar, 500, info.YuanXiaoMingCheng), SqlDB.MakeInParam("@ZyId", SqlDbType.Int, 4, info.ZyId), SqlDB.MakeInParam("@ZhuanYeDaiMa", SqlDbType.VarChar, 50, info.ZhuanYeDaiMa), SqlDB.MakeInParam("@ZhuanYeMingCheng", SqlDbType.VarChar, 500, info.ZhuanYeMingCheng), SqlDB.MakeInParam("@LuQuPiCi", SqlDbType.VarChar, 50, info.LuQuPiCi), SqlDB.MakeInParam("@PiCi", SqlDbType.Int, 4, info.PiCi), SqlDB.MakeInParam("@PcLeiBie", SqlDbType.Int, 4, info.PcLeiBie), SqlDB.MakeInParam("@FenShu", SqlDbType.Int, 4, info.FenShu), SqlDB.MakeInParam("@WeiCi", SqlDbType.Int, 4, info.WeiCi), SqlDB.MakeInParam("@PiCiXian", SqlDbType.Int, 4, info.PiCiXian), SqlDB.MakeInParam("@IsAbove", SqlDbType.Int, 4, info.IsAbove), SqlDB.MakeInParam("@ShengShi", SqlDbType.VarChar, 10, info.ShengShi), SqlDB.MakeInParam("@ShengShiDaiMa", SqlDbType.VarChar, 10, info.ShengShiDaiMa), SqlDB.MakeInParam("@ProvinceId", SqlDbType.Int, 4, info.ProvinceId), }; return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "BenKeFenShuAdd", prams).ToString(), -1)); }
/// <summary> /// 获取某一个实体 /// </summary> /// <param name="Id">标识</param> /// <returns>返回Entity</returns> public static Entity.BenKeFenShu BenKeFenShuEntityGet(int Id, string strDataYear) { Entity.BenKeFenShu info = new Entity.BenKeFenShu(); DataTable dt = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [" + DAL.Common.GetYearTableName("BenKeFenShu", strDataYear) + "] WHERE Id = " + Id + ";").Tables[0]; if (dt.Rows.Count > 0) { info.Id = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0); info.DataYear = Basic.Utils.StrToInt(dt.Rows[0]["DataYear"].ToString(), 0); info.KaoShengHao = dt.Rows[0]["KaoShengHao"].ToString(); info.Ccdm = dt.Rows[0]["ccdm"].ToString(); info.KeLei = Basic.Utils.StrToInt(dt.Rows[0]["KeLei"].ToString(), 0); info.KeLeiDaiMa = dt.Rows[0]["KeLeiDaiMa"].ToString(); info.SchoolId = Basic.Utils.StrToInt(dt.Rows[0]["SchoolId"].ToString(), 0); info.YuanXiaoDaiMa = dt.Rows[0]["YuanXiaoDaiMa"].ToString(); info.YuanXiaoMingCheng = dt.Rows[0]["YuanXiaoMingCheng"].ToString(); info.ZyId = Basic.Utils.StrToInt(dt.Rows[0]["ZyId"].ToString(), 0); info.ZhuanYeDaiMa = dt.Rows[0]["ZhuanYeDaiMa"].ToString(); info.ZhuanYeMingCheng = dt.Rows[0]["ZhuanYeMingCheng"].ToString(); info.LuQuPiCi = dt.Rows[0]["LuQuPiCi"].ToString(); info.PiCi = Basic.Utils.StrToInt(dt.Rows[0]["PiCi"].ToString(), 0); info.PcLeiBie = Basic.Utils.StrToInt(dt.Rows[0]["PcLeiBie"].ToString(), 0); info.FenShu = Basic.Utils.StrToInt(dt.Rows[0]["FenShu"].ToString(), 0); info.WeiCi = Basic.Utils.StrToInt(dt.Rows[0]["WeiCi"].ToString(), 0); info.PiCiXian = Basic.Utils.StrToInt(dt.Rows[0]["PiCiXian"].ToString(), 0); info.IsAbove = Basic.Utils.StrToInt(dt.Rows[0]["IsAbove"].ToString(), 0); info.ShengShi = dt.Rows[0]["ShengShi"].ToString(); info.ShengShiDaiMa = dt.Rows[0]["ShengShiDaiMa"].ToString(); info.ProvinceId = Basic.Utils.StrToInt(dt.Rows[0]["ProvinceId"].ToString(), 0); } return(info); }
/// <summary> /// 调用存储过程修改一个 /// </summary> /// <param name="info">实体对象</param> /// <returns>更新成功返回ture,否则返回false</returns> public static bool BenKeFenShuEdit(Entity.BenKeFenShu info) { SqlParameter[] prams = { SqlDB.MakeInParam("@Id", SqlDbType.Int, 4, info.Id), SqlDB.MakeInParam("@DataYear", SqlDbType.Int, 4, info.DataYear), SqlDB.MakeInParam("@KaoShengHao", SqlDbType.VarChar, 50, info.KaoShengHao), SqlDB.MakeInParam("@ccdm", SqlDbType.VarChar, 50, info.Ccdm), SqlDB.MakeInParam("@KeLei", SqlDbType.Int, 4, info.KeLei), SqlDB.MakeInParam("@KeLeiDaiMa", SqlDbType.VarChar, 50, info.KeLeiDaiMa), SqlDB.MakeInParam("@SchoolId", SqlDbType.Int, 4, info.SchoolId), SqlDB.MakeInParam("@YuanXiaoDaiMa", SqlDbType.VarChar, 50, info.YuanXiaoDaiMa), SqlDB.MakeInParam("@YuanXiaoMingCheng", SqlDbType.VarChar, 500, info.YuanXiaoMingCheng), SqlDB.MakeInParam("@ZyId", SqlDbType.Int, 4, info.ZyId), SqlDB.MakeInParam("@ZhuanYeDaiMa", SqlDbType.VarChar, 50, info.ZhuanYeDaiMa), SqlDB.MakeInParam("@ZhuanYeMingCheng", SqlDbType.VarChar, 500, info.ZhuanYeMingCheng), SqlDB.MakeInParam("@LuQuPiCi", SqlDbType.VarChar, 50, info.LuQuPiCi), SqlDB.MakeInParam("@PiCi", SqlDbType.Int, 4, info.PiCi), SqlDB.MakeInParam("@PcLeiBie", SqlDbType.Int, 4, info.PcLeiBie), SqlDB.MakeInParam("@FenShu", SqlDbType.Int, 4, info.FenShu), SqlDB.MakeInParam("@WeiCi", SqlDbType.Int, 4, info.WeiCi), SqlDB.MakeInParam("@PiCiXian", SqlDbType.Int, 4, info.PiCiXian), SqlDB.MakeInParam("@IsAbove", SqlDbType.Int, 4, info.IsAbove), SqlDB.MakeInParam("@ShengShi", SqlDbType.VarChar, 10, info.ShengShi), SqlDB.MakeInParam("@ShengShiDaiMa", SqlDbType.VarChar, 10, info.ShengShiDaiMa), SqlDB.MakeInParam("@ProvinceId", SqlDbType.Int, 4, info.ProvinceId), }; int intReturnValue = 0; intReturnValue = SqlDB.ExecuteNonQuery(CommandType.StoredProcedure, "BenKeFenShuEdit", prams); if (intReturnValue == 1) { return(true); } return(false); }