/// <summary> /// 调用存储过程修改一个 /// </summary> /// <param name="info">实体对象</param> /// <returns>更新成功返回ture,否则返回false</returns> public static bool GaoKaoCardEdit(Entity.GaoKaoCard info) { SqlParameter[] prams = { SqlDB.MakeInParam("@ID", SqlDbType.Int, 4, info.ID), SqlDB.MakeInParam("@KaHao", SqlDbType.NVarChar, 50, info.KaHao), SqlDB.MakeInParam("@MiMa", SqlDbType.NVarChar, 50, info.MiMa), SqlDB.MakeInParam("@StudentId", SqlDbType.Int, 4, info.StudentId), SqlDB.MakeInParam("@ProvinceId", SqlDbType.Int, 4, info.ProvinceId), SqlDB.MakeInParam("@Belong", SqlDbType.Int, 4, info.Belong), SqlDB.MakeInParam("@DianId", SqlDbType.Int, 4, info.DianId), SqlDB.MakeInParam("@CardLevel", SqlDbType.Int, 4, info.CardLevel), SqlDB.MakeInParam("@IsPause", SqlDbType.Int, 4, info.IsPause), SqlDB.MakeInParam("@RegisterDate", SqlDbType.DateTime, 8, info.RegisterDate), SqlDB.MakeInParam("@AllowChangeCount", SqlDbType.Int, 4, info.AllowChangeCount), SqlDB.MakeInParam("@HaveChangeCount", SqlDbType.Int, 4, info.HaveChangeCount), SqlDB.MakeInParam("@EndTime", SqlDbType.DateTime, 8, info.EndTime), SqlDB.MakeInParam("@Memo", SqlDbType.NVarChar, 500, info.Memo), SqlDB.MakeInParam("@DingDanHao", SqlDbType.NVarChar, 100, info.DingDanHao), }; int intReturnValue = 0; intReturnValue = SqlDB.ExecuteNonQuery(CommandType.StoredProcedure, "GaoKaoCardEdit", prams); if (intReturnValue == 1) { return(true); } return(false); }
public static Entity.GaoKaoCard GaoKaoCardEntityGetByKaHao(string strKaoHao) { Entity.GaoKaoCard info = new Entity.GaoKaoCard(); DataTable dt = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [GaoKaoCard] WHERE KaHao = '" + strKaoHao + "'").Tables[0]; if (dt.Rows.Count > 0) { info.ID = Basic.Utils.StrToInt(dt.Rows[0]["ID"].ToString(), 0); info.KaHao = dt.Rows[0]["KaHao"].ToString(); info.MiMa = dt.Rows[0]["MiMa"].ToString(); info.StudentId = Basic.Utils.StrToInt(dt.Rows[0]["StudentId"].ToString(), 0); info.ProvinceId = Basic.Utils.StrToInt(dt.Rows[0]["ProvinceId"].ToString(), 0); info.Belong = Basic.Utils.StrToInt(dt.Rows[0]["Belong"].ToString(), 0); info.DianId = Basic.Utils.StrToInt(dt.Rows[0]["DianId"].ToString(), 0); info.CardLevel = Basic.Utils.StrToInt(dt.Rows[0]["CardLevel"].ToString(), 0); info.IsPause = Basic.Utils.StrToInt(dt.Rows[0]["IsPause"].ToString(), 0); info.AllowChangeCount = Basic.Utils.StrToInt(dt.Rows[0]["AllowChangeCount"].ToString(), 0); info.HaveChangeCount = Basic.Utils.StrToInt(dt.Rows[0]["HaveChangeCount"].ToString(), 0); info.Memo = dt.Rows[0]["Memo"].ToString(); info.DingDanHao = dt.Rows[0]["DingDanHao"].ToString(); info.EndTime = Basic.TypeConverter.StrToDateTime(dt.Rows[0]["DingDanHao"].ToString()); info.RegisterDate = Basic.TypeConverter.StrToDateTime(dt.Rows[0]["RegisterDate"].ToString()); info.IsArt = Basic.Utils.StrToInt(dt.Rows[0]["IsArt"].ToString(), 0); return(info); } else { return(null); } }
//空或者0:账号或者密码错误 //1:未完善个人信息:目前只有账号和密码 //2:账号被完全关闭账号:卡用户的卡已关闭或者过期;注册用户被关闭 //3:高考卡用户:可以正常使用系统的账户 //4.注册用户或者会员卡用户(如果是先注册,后绑定的报考卡,那么报考卡过期之后该用户又是一个普通注册用户了) /*使用账号和密码 检测 GaoKaoCard 表*/ string GaoKaoCard(string strBank, string strPwd) { #region 针对卡号段 '19140600001' and '19140610000' 作如下处理 if (strBank.StartsWith("191406")) { string strBank2 = strBank.Substring(6); int intBank = Basic.TypeConverter.StrToInt(strBank2, 0); if (intBank >= 1 && intBank <= 10000) { strBank += DAL.AnalysisArea.GetProvinceIdByIp(); } } #endregion Entity.GaoKaoCard infoCard = DAL.GaoKaoCard.GaoKaoCardEntityGetByKaHao(strBank, strPwd); if (infoCard != null) { //UserInfo user.ProvinceId = infoCard.ProvinceId;//UserInfo //JsonCallBack infoJson.Bank = infoCard.KaHao; //账号 infoJson.Level = infoCard.CardLevel; //会员等级 infoJson.ProvinceName = GetProvinceName(infoCard.ProvinceId); //省份 //Basic.CookieHelper.WriteCookie("EndTime", infoCard.EndTime.ToString()); //Basic.CookieHelper.WriteCookie("EndTime222", DateTime.Now.ToString()); //判定是否已经关闭或者过期 if (infoCard.IsPause == 1 || DateTime.Compare(DateTime.Now, infoCard.EndTime) > 0) { infoJson.Status = 2;//高考卡已关闭或者过期 } else { //没有关闭也没有过期的一张卡,等待接下来的处理 //通过StudentId 验证Join_Student int ProvinceId = ValidJoin_Student(3, infoCard.StudentId, infoCard.RegisterDate); if (infoCard.ProvinceId == 0) { infoCard.ProvinceId = ProvinceId; DAL.GaoKaoCard.GaoKaoCardEdit(infoCard); } } return(GetJson(infoJson)); } else { return(""); } }
/// <summary> /// 暂停该值 /// </summary> /// <param name="ID">自增id的值</param> /// <returns>暂停成功返回ture,否则返回false</returns> public static bool GaoKaoCardPause(Entity.GaoKaoCard info) { int intReturnValue = 0; intReturnValue = SqlDB.ExecuteNonQuery(CommandType.Text, "UPDATE [GaoKaoCard] SET IsPause = " + info.IsPause + " WHERE ID = " + info.ID); if (intReturnValue == 1) { return(true); } return(false); }
public static bool GaoKaoCardHaveChangeCount(Entity.GaoKaoCard info) { int intReturnValue = 0; intReturnValue = SqlDB.ExecuteNonQuery(CommandType.Text, "UPDATE [GaoKaoCard] SET HaveChangeCount = " + info.HaveChangeCount + " WHERE ID = " + info.ID); if (intReturnValue == 1) { return(true); } return(false); }
/*使用账号和密码 检测 Join_Student 表*/ string Join_Student(string strBank, string strPwd) { //判定是否是注册账号 Entity.Join_Student infoStudent = DAL.TengXB.Join_Student.Join_StudentEntityGetBank(strBank, strPwd); if (infoStudent != null) //是注册账号 { //UserInfo user.StudentId = infoStudent.StudentId; //UserInfo user.ProvinceId = infoStudent.ProvinceId; //UserInfo user.KeLei = infoStudent.WenLi; //UserInfo user.GKYear = infoStudent.GKYear; //UserInfo //JsonCallBack infoJson.StudentName = infoStudent.StudentName; //学生姓名 infoJson.Bank = infoStudent.StudentBank; //账号 infoJson.Level = 1; //会员等级:普通注册用户 infoJson.Status = 4; //账号状态:注册用户 infoJson.ProvinceName = GetProvinceName(infoStudent.ProvinceId); //省份 //判定是否关闭 if (infoStudent.IsPause == 1) { infoJson.Status = 2;//账号状态:注册用户被关闭 } else { //判定是否绑定高考卡了 Entity.GaoKaoCard infoGaoKaoCard = DAL.GaoKaoCard.GaoKaoCardEntityGetByStudentId(infoStudent.StudentId); if (infoGaoKaoCard != null) { infoJson.Status = 3; infoJson.Level = infoGaoKaoCard.CardLevel; } } return(GetJson(infoJson)); } else { //不是注册用户 return(""); } }
/// <summary> /// 调用存储过程增加一个 /// </summary> /// <param name="info">实体对象</param> /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns> public static int GaoKaoCardAdd(Entity.GaoKaoCard info) { SqlParameter[] prams = { SqlDB.MakeInParam("@KaHao", SqlDbType.NVarChar, 50, info.KaHao), SqlDB.MakeInParam("@MiMa", SqlDbType.NVarChar, 50, info.MiMa), SqlDB.MakeInParam("@StudentId", SqlDbType.Int, 4, info.StudentId), SqlDB.MakeInParam("@ProvinceId", SqlDbType.Int, 4, info.ProvinceId), SqlDB.MakeInParam("@Belong", SqlDbType.Int, 4, info.Belong), SqlDB.MakeInParam("@DianId", SqlDbType.Int, 4, info.DianId), SqlDB.MakeInParam("@CardLevel", SqlDbType.Int, 4, info.CardLevel), SqlDB.MakeInParam("@IsPause", SqlDbType.Int, 4, info.IsPause), // SqlDB.MakeInParam("@RegisterDate", SqlDbType.DateTime, 8, info.RegisterDate), SqlDB.MakeInParam("@AllowChangeCount", SqlDbType.Int, 4, info.AllowChangeCount), SqlDB.MakeInParam("@HaveChangeCount", SqlDbType.Int, 4, info.HaveChangeCount), SqlDB.MakeInParam("@EndTime", SqlDbType.DateTime, 8, info.EndTime), SqlDB.MakeInParam("@Memo", SqlDbType.NVarChar, 500, info.Memo), SqlDB.MakeInParam("@DingDanHao", SqlDbType.NVarChar, 100, info.DingDanHao), }; return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "GaoKaoCardAdd", prams).ToString(), -1)); }
public static Entity.GaoKaoCard GaoKaoCardEntityGetByKaHao(string strKaoHao, string strMiMa) { Entity.GaoKaoCard info = new Entity.GaoKaoCard(); SqlParameter[] prams = { SqlDB.MakeInParam("@KaHao", SqlDbType.NVarChar, 500, strKaoHao), SqlDB.MakeInParam("@MiMa", SqlDbType.NVarChar, 50, strMiMa), }; DataTable dt = SqlDB.ExecuteDataset(CommandType.StoredProcedure, "GaoKaoCardEntityGet", prams).Tables[0]; //DataTable dt = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [GaoKaoCard] WHERE KaHao = '" + strKaoHao + "' AND MiMa = '" + strMiMa + "'").Tables[0]; if (dt.Rows.Count > 0) { info.ID = Basic.Utils.StrToInt(dt.Rows[0]["ID"].ToString(), 0); info.KaHao = dt.Rows[0]["KaHao"].ToString(); info.MiMa = dt.Rows[0]["MiMa"].ToString(); info.StudentId = Basic.Utils.StrToInt(dt.Rows[0]["StudentId"].ToString(), 0); info.ProvinceId = Basic.Utils.StrToInt(dt.Rows[0]["ProvinceId"].ToString(), 0); info.Belong = Basic.Utils.StrToInt(dt.Rows[0]["Belong"].ToString(), 0); info.DianId = Basic.Utils.StrToInt(dt.Rows[0]["DianId"].ToString(), 0); info.CardLevel = Basic.Utils.StrToInt(dt.Rows[0]["CardLevel"].ToString(), 0); info.IsPause = Basic.Utils.StrToInt(dt.Rows[0]["IsPause"].ToString(), 0); info.AllowChangeCount = Basic.Utils.StrToInt(dt.Rows[0]["AllowChangeCount"].ToString(), 0); info.HaveChangeCount = Basic.Utils.StrToInt(dt.Rows[0]["HaveChangeCount"].ToString(), 0); info.Memo = dt.Rows[0]["Memo"].ToString(); info.DingDanHao = dt.Rows[0]["DingDanHao"].ToString(); info.EndTime = Basic.TypeConverter.StrToDateTime(dt.Rows[0]["EndTime"].ToString()); info.RegisterDate = Basic.TypeConverter.StrToDateTime(dt.Rows[0]["RegisterDate"].ToString()); info.IsArt = Basic.Utils.StrToInt(dt.Rows[0]["IsArt"].ToString(), 0); return(info); } else { return(null); } }
/* intCardLevel:3表示高考卡;4表示会员卡 */ int ValidJoin_Student(int intCardLevel, int intStudentId, DateTime dtRegisterDate) { int provinceid = 0; //判定该卡是否完善个人信息了 Entity.Join_Student infoStudent = DAL.Join_Student.Join_StudentEntityGet(intStudentId); if (infoStudent != null) //已经完善过个人信息了 { provinceid = infoStudent.ProvinceId; user.KeLei = infoStudent.WenLi; //UserInfo user.GKYear = infoStudent.GKYear; //UserInfo user.StudentId = infoStudent.StudentId; //UserInfo infoJson.StudentName = infoStudent.StudentName; //学生姓名 //一张完善过个人信息的正常的高考卡 infoJson.Status = intCardLevel;//高考卡3 会员卡4 } else { //Student表中不存在数据 这时候 说明需要先去完善个人信息 infoJson.Status = 1; } //已经完善过个人信息的会员卡的话,需要去判定是否绑定了高考卡 if (infoJson.Status == 4) { Entity.GaoKaoCard infoGaoKaoCard = DAL.GaoKaoCard.GaoKaoCardEntityGetByStudentId(intStudentId); if (infoGaoKaoCard != null) { infoJson.Status = 3; infoJson.Level = infoGaoKaoCard.CardLevel; } } return(provinceid); }