Exemple #1
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool Join_CardEdit(Entity.Join_Card info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@CardId",       SqlDbType.Int,       4, info.CardId),
                SqlDB.MakeInParam("@CardBank",     SqlDbType.VarChar,  50, info.CardBank),
                SqlDB.MakeInParam("@CardPass",     SqlDbType.VarChar,  16, info.CardPass),
                SqlDB.MakeInParam("@IsValid",      SqlDbType.Int,       4, info.IsValid),
                SqlDB.MakeInParam("@UseState",     SqlDbType.Int,       4, info.UseState),
                SqlDB.MakeInParam("@DianId",       SqlDbType.Int,       4, info.DianId),
                SqlDB.MakeInParam("@ProvinceId",   SqlDbType.Int,       4, info.ProvinceId),
                SqlDB.MakeInParam("@OpenCardTime", SqlDbType.DateTime,  8, info.OpenCardTime),
                SqlDB.MakeInParam("@StudentId",    SqlDbType.Int,       4, info.StudentId),
                SqlDB.MakeInParam("@UseTime",      SqlDbType.DateTime,  8, info.UseTime),
                SqlDB.MakeInParam("@UseIp",        SqlDbType.VarChar,  20, info.UseIp),
                SqlDB.MakeInParam("@IsTest",       SqlDbType.Int,       4, info.IsTest),
            };
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(strCon, CommandType.StoredProcedure, "Join_CardEdit", prams);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }
Exemple #2
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="CardId">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.Join_Card Join_CardEntityGet(int CardId)
        {
            Entity.Join_Card info = new Entity.Join_Card();
            DataTable        dt   = SqlDB.ExecuteDataset(strCon, CommandType.Text, "SELECT * FROM [Join_Card] WHERE CardId = " + CardId + ";").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.CardId       = Basic.Utils.StrToInt(dt.Rows[0]["CardId"].ToString(), 0);
                info.CardBank     = dt.Rows[0]["CardBank"].ToString();
                info.CardPass     = dt.Rows[0]["CardPass"].ToString();
                info.IsValid      = Basic.Utils.StrToInt(dt.Rows[0]["IsValid"].ToString(), 0);
                info.UseState     = Basic.Utils.StrToInt(dt.Rows[0]["UseState"].ToString(), 0);
                info.DianId       = Basic.Utils.StrToInt(dt.Rows[0]["DianId"].ToString(), 0);
                info.ProvinceId   = Basic.Utils.StrToInt(dt.Rows[0]["ProvinceId"].ToString(), 0);
                info.StudentId    = Basic.Utils.StrToInt(dt.Rows[0]["StudentId"].ToString(), 0);
                info.UseIp        = dt.Rows[0]["UseIp"].ToString();
                info.IsTest       = Basic.Utils.StrToInt(dt.Rows[0]["IsTest"].ToString(), 0);
                info.OpenCardTime = Basic.TypeConverter.StrToDateTime(dt.Rows[0]["OpenCardTime"].ToString());
                info.UseTime      = Basic.TypeConverter.StrToDateTime(dt.Rows[0]["UseTime"].ToString());

                return(info);
            }
            else
            {
                return(null);
            }
        }
Exemple #3
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int Join_CardAdd(Entity.Join_Card info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@CardBank",     SqlDbType.VarChar,  50, info.CardBank),
         SqlDB.MakeInParam("@CardPass",     SqlDbType.VarChar,  16, info.CardPass),
         SqlDB.MakeInParam("@IsValid",      SqlDbType.Int,       4, info.IsValid),
         SqlDB.MakeInParam("@UseState",     SqlDbType.Int,       4, info.UseState),
         SqlDB.MakeInParam("@DianId",       SqlDbType.Int,       4, info.DianId),
         SqlDB.MakeInParam("@ProvinceId",   SqlDbType.Int,       4, info.ProvinceId),
         SqlDB.MakeInParam("@OpenCardTime", SqlDbType.DateTime,  8, info.OpenCardTime),
         SqlDB.MakeInParam("@StudentId",    SqlDbType.Int,       4, info.StudentId),
         SqlDB.MakeInParam("@UseTime",      SqlDbType.DateTime,  8, info.UseTime),
         SqlDB.MakeInParam("@UseIp",        SqlDbType.VarChar,  20, info.UseIp),
         SqlDB.MakeInParam("@IsTest",       SqlDbType.Int,       4, info.IsTest),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(strCon, CommandType.StoredProcedure, "Join_CardAdd", prams).ToString(), -1));
 }
Exemple #4
0
        /*使用账号和密码 检测 Join_Card 表*/
        string Join_Card(string strBank, string strPwd)
        {
            Entity.Join_Card infoCard = DAL.TengXB.Join_Card.Join_CardEntityGetByCardBank(strBank, strPwd);
            if (infoCard != null)
            {
                //UserInfo
                user.ProvinceId = infoCard.ProvinceId;//UserInfo


                //JsonCallBack
                infoJson.Bank         = infoCard.CardBank;                    //账号
                infoJson.Level        = 9;                                    //会员等级:会员卡账号
                infoJson.ProvinceName = GetProvinceName(infoCard.ProvinceId); //省份


                //判定是否已经关闭
                if (infoCard.UseState == 1)
                {
                    infoJson.Status = 2;//会员卡已关闭
                }
                else
                {
                    //没有被关闭的一张卡 , 等待接下来的处理即可

                    //通过StudentId 验证Join_Student  主要是判定Status   返回的结果:0StudentId为0;1注册账号;2会员卡账号;3高考卡账号

                    int ProvinceId = ValidJoin_Student(4, infoCard.StudentId, infoCard.OpenCardTime);
                    if (infoCard.ProvinceId == 0)
                    {
                        infoJson.ProvinceName = GetProvinceName(ProvinceId);//省份
                        infoCard.ProvinceId   = ProvinceId;
                        DAL.Join_Card.Join_CardEdit(infoCard);
                    }
                }

                return(GetJson(infoJson));
            }
            else
            {
                return("");
            }
        }