Exemplo n.º 1
0
        private int EditPwd_Trans(IDbHelp thelp, DbHelp.ITransM pMod)
        {
            EditPwd_TransM tmod = (EditPwd_TransM)pMod;

            //查询是否生效
            string sql = "select FK_User from User_FindPwdEmail where FPEmail=@FPEmail and FPKey=@FPKey and AddDate>(dateadd(dd,-3,getdate())) order by AddDate desc";

            IDataParameter[] param =
            {
                DbHelp.Def.AddParam("@FPEmail", Email),
                DbHelp.Def.AddParam("@FPKey",   Key),
            };
            string str = thelp.First(sql, param, "0");

            if (str == "0")
            {
                tmod.returnValue = "此链接已失效";
                return(0);
            }

            //更新密码
            sql = "update User_Info set UserPwd=@UserPwd where UserSN=@UserSN";
            IDataParameter[] param2 =
            {
                DbHelp.Def.AddParam("@UserPwd", Fn.MD5(tmod.sPwd)),
                DbHelp.Def.AddParam("@UserSN",  str),
            };

            //删除用户的找回密码记录
            if (thelp.Update(sql, param2) <= 0)
            {
                tmod.returnValue = "找不到此用户";
                return(0);
            }

            sql = "delete User_FindPwdEmail where FK_User=@FK_User";
            IDataParameter[] param3 =
            {
                DbHelp.Def.AddParam("@FK_User", str),
            };
            if (thelp.Update(sql, param3) <= 0)
            {
                tmod.returnValue = "设置失败";
                return(0);
            }

            tmod.returnValue = "1";
            return(1);
        }
Exemplo n.º 2
0
        private int EditInfo_Trans(IDbHelp thelp, DbHelp.ITransM pMod)
        {
            EditInfo_TransM tmod    = (EditInfo_TransM)pMod;
            User_InfoM      infoMod = tmod.infoMod;
            User_TeamM      teamMod = tmod.teamMod;

            #region 保存个人信息
            string           sql_pre = "update User_Team set TeamName=@TeamName,RealName=@RealName,Area=@Area,Address=@Address,Tel=@Tel,FixTel=@FixTel,Detail=@Detail where FK_User="******"@TeamName", teamMod.TeamName),
                DbHelp.Def.AddParam("@RealName", teamMod.RealName),
                DbHelp.Def.AddParam("@Area",     teamMod.Area),
                DbHelp.Def.AddParam("@Address",  teamMod.Address),
                DbHelp.Def.AddParam("@Tel",      teamMod.Tel),
                DbHelp.Def.AddParam("@FixTel",   teamMod.FixTel),
                DbHelp.Def.AddParam("@Detail",   teamMod.Detail),
            };
            if (thelp.Update(sql_pre, dp_pre) <= 0)
            {
                tmod.returnValue = "您的账号信息可能已损坏,请重新注册账号或通过客服帮助";//个人用户信息保存失败
                return(0);
            }
            #endregion

            #region 保存账户信息
            string           sql_info = "update User_Info set Email=@Email where UserSN=" + userID + " and OpenIdentity&8=8";
            IDataParameter[] dp_info  =
            {
                DbHelp.Def.AddParam("@Email", infoMod.Email),
            };

            if (thelp.Update(sql_info, dp_info) <= 0)
            {
                tmod.returnValue = "c";//账户信息保存失败
                return(0);
            }
            #endregion

            tmod.returnValue = "1";
            return(1);
        }
Exemplo n.º 3
0
        private int EditInfo_Trans(IDbHelp thelp, DbHelp.ITransM pMod)
        {
            EditInfo_TransM tmod    = (EditInfo_TransM)pMod;
            User_InfoM      infoMod = tmod.infoMod;
            User_PersonalM  perMod  = tmod.perMod;
            SurveyM         surMod  = tmod.surMod;

            #region 保存调查信息
            string sql_sur = "if exists(select 1 from Survey where FK_User=@FK_User) "
                             + "update Survey set BirDate=@BirDate,FamilyN=@FamilyN,Trades=@Trades,Income=@Income,Cuisine=@Cuisine,Vegetables=@Vegetables,Taste=@Taste,Factor=@Factor,Proposal=@Proposal where FK_User=@FK_User "
                             + "else "
                             + "insert into Survey(FK_User,BirDate,FamilyN,Trades,Income,Cuisine,Vegetables,Taste,Factor,Proposal) values(@FK_User,@BirDate,@FamilyN,@Trades,@Income,@Cuisine,@Vegetables,@Taste,@Factor,@Proposal)";
            IDataParameter[] dp_sur =
            {
                DbHelp.Def.AddParam("@FK_User",    surMod.FK_User),
                DbHelp.Def.AddParam("@BirDate",    surMod.BirDate),
                DbHelp.Def.AddParam("@FamilyN",    surMod.FamilyN),
                DbHelp.Def.AddParam("@Trades",     surMod.Trades),
                DbHelp.Def.AddParam("@Income",     surMod.Income),
                DbHelp.Def.AddParam("@Cuisine",    surMod.Cuisine),
                DbHelp.Def.AddParam("@Vegetables", surMod.Vegetables),
                DbHelp.Def.AddParam("@Taste",      surMod.Taste),
                DbHelp.Def.AddParam("@Factor",     surMod.Factor),
                DbHelp.Def.AddParam("@Proposal",   surMod.Proposal),
            };
            if (thelp.Update(sql_sur, dp_sur) <= 0)
            {
                tmod.returnValue = "a";//调查信息保存失败
                return(0);
            }
            #endregion

            #region 保存个人信息
            string           sql_pre = "update User_Personal set RealName=@RealName,Sex=@Sex,Area=@Area,Address=@Address,Tel=@Tel,FixTel=@FixTel where FK_User="******"@RealName", perMod.RealName),
                DbHelp.Def.AddParam("@Sex",      perMod.Sex),
                DbHelp.Def.AddParam("@Area",     perMod.Area),
                DbHelp.Def.AddParam("@Address",  perMod.Address),
                DbHelp.Def.AddParam("@Tel",      perMod.Tel),
                DbHelp.Def.AddParam("@FixTel",   perMod.FixTel),
            };
            if (thelp.Update(sql_pre, dp_pre) <= 0)
            {
                tmod.returnValue = "您的账号信息可能已损坏,请重新注册账号或通过客服帮助";//个人用户信息保存失败
                return(0);
            }
            #endregion

            #region 保存账户信息
            string           sql_info = "update User_Info set Email=@Email where UserSN=" + userID;
            IDataParameter[] dp_info  =
            {
                DbHelp.Def.AddParam("@Email", infoMod.Email),
            };

            if (thelp.Update(sql_info, dp_info) <= 0)
            {
                tmod.returnValue = "c";//账户信息保存失败
                return(0);
            }
            #endregion

            tmod.returnValue = "1";
            return(1);
        }