//登录按钮
        protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            if (this.username.Text.Trim() == "" || this.password.Text.Trim() == "")
            {
                Response.Write("<script>alert('用户名和密码不能为空!');window.history.go(-1)</script>");
                return;
            }
            if (txtAdminCode.Text != labCode.Text)
            {
                Response.Write("<script>alert('验证码不匹配,请重新填写!');window.history.go(-1)</script>");
                txtAdminCode.Text = "";
                return;
            }
            userinfo user = new userinfo();

            if (user.validUser(this.username.Text.Trim().ToString(), this.password.Text.Trim().ToString()))
            {
                Session["userName"] = this.username.Text.Trim().ToString();
                if (CheckBox1.Checked)    //是否记住用户名
                {
                    Response.Cookies["username"].Value   = username.Text;
                    Response.Cookies["username"].Expires = DateTime.Now.AddDays(1);
                }
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('登录成功!');</script>");
                Server.Transfer("index.aspx");
            }
            else
            {
                Session["userName"] = "";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('登录失败,无此用户名或密码不正确!');window.history.go(-1)</script>");
            }
        }
Example #2
0
    public static bool AddNewCustomer(userinfo newuser)
    {
        //创建数据库连接对象
        SqlConnection con = new SqlConnection(DBAccess.DBConnString);
        //创建命令对象
        string     sql = "insert into users (userid,userpwd) values (@userid,@userpwd)";
        SqlCommand cmd = new SqlCommand(sql, con);

        //3.打开连接,以执行SQL命令
        con.Open();
        //4.为命令对象中的各个参数赋值
        try
        {
            cmd.Parameters.Add("@userid", SqlDbType.VarChar, 20);
            cmd.Parameters[0].Value = newuser.userid;
            cmd.Parameters.Add("@userpwd", SqlDbType.VarChar, 20);
            cmd.Parameters[1].Value = newuser.userpwd;

            cmd.ExecuteNonQuery();
            con.Close();
            return(true);
        }
        catch
        {
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }
            return(false);
        }
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //string hash = GetMD5HashData("testestet");
        if (CMS.Helpers.RequestContext.IsUserAuthenticated)
        {
            if (Session["userClass"] != null && Session["userClass"] != "")
            {
                userinfo ui = (userinfo)Session["userClass"];
                //OneMine(ui.ID);
                if (ui.groupNames.ToLower().Contains("member"))
                {
                    //member
                    OneMine(ui.ID);
                }
                else
                {
                    Response.Redirect("http://www.onetunnel.org?LoggedinUser=NonMember");
                    // OneMine("");
                }
            }

            else
            {
                //OneMine("01786850");
                Response.Redirect("http://www.onetunnel.org?LoggedinUser=NonMember");
            }
        }

        else
        {
            // OneMine("01786850");
            Response.Redirect("http://www.onetunnel.org");//("~/personifyebusiness/login-join.aspx?loginurl=/sso/ssoonemine.aspx");
        }
    }
Example #4
0
        public JsonResult GetDetail()
        {
            int    _userid   = (int)Session["user_id"];
            string _username = (string)Session["user_name"];
            string _zczid    = Request["zczbh"] ?? "";
            IList <ZhuCeZhengGG> _guiges;

            if (_zczid == "")
            {
                return(Json(""));
            }
            else
            {
                _guiges = new List <ZhuCeZhengGG>();
                var tempdata = ob_base_zhucezhengggservice.LoadSortEntities(p => p.IsDelete == false && p.ZCZID == int.Parse(_zczid), false, p => p.Guige);
                //_guiges = tempdata.ToList<base_zhucezhenggg>();
                foreach (base_zhucezhenggg _zczgg in tempdata)
                {
                    if (_zczgg.ID > 0)
                    {
                        ZhuCeZhengGG _guige = new ZhuCeZhengGG();
                        _guige.ID       = _zczgg.ID;
                        _guige.ZCZID    = (int)_zczgg.ZCZID;
                        _guige.Guige    = _zczgg.Guige;
                        _guige.Memo     = _zczgg.Memo;
                        _guige.Makedate = _zczgg.MakeDate.ToShortDateString();
                        userinfo _user = ServiceFactory.userinfoservice.GetEntityById(p => p.ID == _zczgg.MakeMan);
                        _guige.Makeman = _user.FullName;
                        _guiges.Add(_guige);
                    }
                }
            }
            return(Json(_guiges));
        }
Example #5
0
 protected void EditAccountsTypeInfo(object sender, EventArgs e)
 {
     try
     {
         userinfo data = new userinfo();
         data.accountstype = accountstype.Value.Trim();
         data.atdiscount = Convert.ToDecimal(TypeParse.DbObjToString(atdiscount.Value.Trim(), "1.00"));
         data.atid = TypeParse.DbObjToInt(atid.Value, 0);
         bool result = user.editaccountstype(data);
         if (result)
         {
             Response.Write("<script>alert('编辑账号类型成功!');location.href='/Manager/AccountsType.aspx';</script>");
             return;
         }
         else
         {
             Response.Write("<script>alert('编辑账号类型失败!');location.href='/Manager/AccountsType.aspx';</script>");
             return;
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
        /// <summary>
        /// 获得所有的评论
        /// </summary>
        /// <param name="uwz"></param>
        /// <returns></returns>
        public JsonResult commentlist(fenyezhuanyong uwz)
        {
            CommentBLL cb         = new CommentBLL();
            List <int> useridlist = new List <int>();
            Result <List <allwenzhengpinglun> > result = cb.GetAllwenzhengpingluns(uwz.id, out useridlist, uwz.page, uwz.pagecount);
            List <userinfo> userinfos = cb.GetUserinfos(useridlist);

            if (result.content != null)
            {
                foreach (allwenzhengpinglun item in result.content)
                {
                    userinfo uif = new userinfo();
                    uif = userinfos.Where(u => u.id == item.pinglunrenid).FirstOrDefault();
                    item.pinglunrennicheng  = uif.nicheng;
                    item.pinglunrenusername = uif.username;
                    item.usertouxiangurl    = uif.touxiangurl == null? @"\images\header-img-comment_03.png":uif.touxiangurl;
                    if (item.wenzhangpinglunsonlist.content != null)
                    {
                        foreach (wenzhangpinglunsonkuozhan wenzhangpinglunson in item.wenzhangpinglunsonlist.content)
                        {
                            uif = userinfos.Where(u => u.id == wenzhangpinglunson.pinglunrenid).FirstOrDefault();
                            wenzhangpinglunson.pinglunrennicheng  = uif.nicheng;
                            wenzhangpinglunson.pinglunrenusername = uif.username;
                            uif = userinfos.Where(u => u.id == wenzhangpinglunson.huifurenid).FirstOrDefault();
                            wenzhangpinglunson.huifurennicheng  = uif.nicheng;
                            wenzhangpinglunson.huifurenusername = uif.username;
                        }
                    }
                }
            }

            return(Json(result));
        }
Example #7
0
 /// <summary>
 /// 注册,将用户名,密码hash后同salt一起存入数据库
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public Boolean userRegister(userinfo user)
 {
     //当表中没有数据时放回0,ExecuteScalar
     if (existUser(user) == 0)
     {
         string         salt            = getSaltForPassword();
         SqlParameter[] registerParamer = new SqlParameter[] {
             new SqlParameter("@userId", SqlDbType.NVarChar, 32),
             new SqlParameter("@password", SqlDbType.NVarChar, 32),
             new SqlParameter("@salt", SqlDbType.NVarChar, 32),
             new SqlParameter("@Email", SqlDbType.NVarChar, 50),
             new SqlParameter("@indentity", SqlDbType.NVarChar, 20),
         };
         registerParamer[0].Value = usernameToMd5(user.yonghubianhao);
         registerParamer[1].Value = passwordToMd5(user.mima, salt);
         registerParamer[2].Value = salt;
         registerParamer[3].Value = user.Email;
         registerParamer[4].Value = "1";
         return(DB.ExecuteNonQuery(cs, "registerUser", registerParamer) == 1 ? true : false);
     }
     else
     {
         return(false);
     }
 }
Example #8
0
        [WebMethod]//会员注册
        public string register(string account, string pwd, string email)
        {
            userinfo item = new userinfo();

            item.accounts = HttpUtility.UrlDecode(account);
            item.pwd      = Des.MD5(HttpUtility.UrlDecode(pwd));
            item.email    = HttpUtility.UrlDecode(email);
            item.adddate  = DateTime.Now;
            item.atid     = 1;
            Random r   = new Random();
            int    num = r.Next(1, 72);

            item.headerimg = num.ToString() + ".jpg";
            bool result = user.adduser(item);

            if (result)
            {
                string     uid       = user.getuidbyemail(item);
                HttpCookie uidcookie = new HttpCookie("tfuid");
                uidcookie.Value = uid.ToString();
                HttpContext.Current.Response.Cookies.Add(uidcookie);
                return("t");
            }
            else
            {
                return("f");
            }
        }
Example #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     string uid="";
     if (Request.Cookies["tfuid"] != null)
     {
         uid = TypeParse.DbObjToString(Request.Cookies["tfuid"].Value, "");
     }
     else
     {
         Response.Redirect("/UserLog");
     }
     userinfo userdata = user.getuserinfo(uid);
     UInfoDATA = userdata;
     if (!Page.IsPostBack)
     {
         txtaccounts.Value = userdata.accounts;
         txttruename.Value = userdata.truename;
         txtqq.Value = userdata.qq;
         txtcompany.Value = userdata.company;
         txtmobile.Value = userdata.mobile;
         txttel.Value = userdata.tel;
         userid.Value = userdata.userid.ToString();
         txtaddress.Value = userdata.address;
     }
 }
Example #10
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            userinfo user = new userinfo();

            user.deleteNews(GridView1.DataKeys[e.RowIndex].Value.ToString());
            DataBinding();
        }
Example #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strErrorMsg = "";
        string strUserName = (Request["username"] ?? "").Trim();
        string strPwd      = (Request["password"] ?? "").Trim();

        List <userinfo> listUser = GetUserList(strUserName, strPwd, ref strErrorMsg);

        if (strErrorMsg.Length == 0)
        {
            userinfo          objUser = listUser[0];
            systemloginfo_Bll Bsv     = new systemloginfo_Bll();
            Bsv.Save(new systemloginfo()
            {
                SL_UserID     = objUser.User_ID,
                SL_UserName   = objUser.User_Name,
                SL_Type       = "登录",
                SL_Desc       = string.Format("{0} 登录了系统.", objUser.User_Name),
                SL_CreateTime = DateTime.Now
            });
            Session[SessionKey] = objUser;

            Response.Write("location.href='Index.aspx'");
        }
        else
        {
            Response.Write(strErrorMsg);
        }
        Response.End();
    }
Example #12
0
 protected void EditAccountsTypeInfo(object sender, EventArgs e)
 {
     try
     {
         userinfo data = new userinfo();
         data.accountstype = accountstype.Value.Trim();
         data.atdiscount   = Convert.ToDecimal(TypeParse.DbObjToString(atdiscount.Value.Trim(), "1.00"));
         data.atid         = TypeParse.DbObjToInt(atid.Value, 0);
         bool result = user.editaccountstype(data);
         if (result)
         {
             Response.Write("<script>alert('编辑账号类型成功!');location.href='/Manager/AccountsType.aspx';</script>");
             return;
         }
         else
         {
             Response.Write("<script>alert('编辑账号类型失败!');location.href='/Manager/AccountsType.aspx';</script>");
             return;
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
        protected void TextBoxInit()
        {
            userinfo user = new userinfo();

            switch (message)
            {
            case "0":       //发布新闻
            {
                Label1.Text = "发布新闻";
                break;
            }

            case "1":      //修改新闻
            {
                Label1.Text = "修改新闻";
                DataTable table = user.showNewsPer(Session["newsidqwer"].ToString());
                if (table.Rows.Count > 0)
                {
                    TextBox1.Text = table.Rows[0]["head"].ToString();
                    TextBox2.Text = "    " + table.Rows[0]["con"].ToString();
                }
                else
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('无此记录!');</script>");
                }
                break;
            }
            }
        }
Example #14
0
    private void ResetPwd()
    {
        string userid = Request["userid"]; userid = userid.Trim();

        userinfo item = null;

        if (userid.Length > 0)
        {
            item = UserBll.Get(Convert.ToInt32(userid));
        }
        if (item != null)
        {
            item.User_Pwd = Encrypt_MD5.Encrypt("123456");

            LogType = SysLogType.修改.ToString();
        }

        item = UserBll.Save(item);

        LogDesc = string.Format("用户管理 {0}", string.Format("重置用户 {0} 密码.", item.User_ID));
        WriteSystemLog();

        DataContractJsonSerializer json = new DataContractJsonSerializer(item.GetType());

        json.WriteObject(Response.OutputStream, item);
        Response.End();
    }
Example #15
0
File: user.cs Project: lamjar/shop
        //根据账号类型ID得到账号类型信息
        public static userinfo getaccoutstypeinfo(int id)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0]       = new SqlParameter("@id", SqlDbType.Int);
            parms[0].Value = id;
            string        sql  = "select atid,accountstype,atdiscount from accountstype where atid=@id";
            userinfo      item = new userinfo();
            SqlDataReader dr   = null;

            try
            {
                dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    item.atid         = TypeParse.DbObjToInt(dr["atid"].ToString(), 0);
                    item.accountstype = TypeParse.DbObjToString(dr["accountstype"].ToString(), "");
                    item.atdiscount   = Convert.ToDecimal(TypeParse.DbObjToString(dr["atdiscount"].ToString(), "1.00"));
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(item);
        }
Example #16
0
File: user.cs Project: lamjar/shop
        //编辑账号类型
        public static bool editaccountstype(userinfo data)
        {
            SqlParameter[] parms = new SqlParameter[3];
            parms[0]       = new SqlParameter("@accountstype", SqlDbType.NVarChar, 20);
            parms[0].Value = data.accountstype;
            parms[1]       = new SqlParameter("@atdiscount", SqlDbType.Decimal);
            parms[1].Value = data.atdiscount;
            parms[2]       = new SqlParameter("@atid", SqlDbType.Int);
            parms[2].Value = data.atid;

            string sql    = "update accountstype set accountstype=@accountstype,atdiscount=@atdiscount where atid=@atid";
            int    result = 0;

            try
            {
                result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
            }
            return(result > 0);
        }
Example #17
0
File: user.cs Project: lamjar/shop
        /// <summary>
        /// 修改普通用户资料
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static bool updateUserInfo(userinfo data)
        {
            SqlParameter[] parms = new SqlParameter[16];
            parms[0]       = new SqlParameter("@userid", SqlDbType.NVarChar, 40);
            parms[0].Value = data.userid;
            parms[1]       = new SqlParameter("@tel", SqlDbType.VarChar, 50);
            parms[1].Value = data.tel;
            parms[2]       = new SqlParameter("@mobile", SqlDbType.VarChar, 50);
            parms[2].Value = data.mobile;
            parms[3]       = new SqlParameter("@truename", SqlDbType.VarChar, 50);
            parms[3].Value = data.truename;
            parms[4]       = new SqlParameter("@qq", SqlDbType.VarChar, 50);
            parms[4].Value = data.qq;
            parms[5]       = new SqlParameter("@company", SqlDbType.VarChar, 50);
            parms[5].Value = data.company;
            parms[6]       = new SqlParameter("@accounts", SqlDbType.VarChar, 50);
            parms[6].Value = data.accounts;
            parms[7]       = new SqlParameter("@address", SqlDbType.VarChar, 50);
            parms[7].Value = data.address;

            string sql    = "update userinfo set accounts=@accounts,tel=@tel,mobile=@mobile,truename=@truename,qq=@qq,company=@company,address=@address where [userid]=@userid";
            int    result = 0;

            try
            {
                result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
            return(result > 0);
        }
Example #18
0
File: user.cs Project: lamjar/shop
        //得到账号类型列表
        public static List <userinfo> getaccountstype()
        {
            string          sql    = "select atid,accountstype,atdiscount from accountstype";
            List <userinfo> itlist = new List <userinfo>();

            try
            {
                DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    userinfo item = new userinfo();
                    item.atid         = TypeParse.DbObjToInt(dr["atid"].ToString(), 0);
                    item.accountstype = TypeParse.DbObjToString(dr["accountstype"].ToString(), "");
                    item.atdiscount   = Convert.ToDecimal(TypeParse.DbObjToString(dr["atdiscount"].ToString(), "1.00"));
                    itlist.Add(item);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(itlist);
        }
Example #19
0
File: user.cs Project: lamjar/shop
        /// <summary>
        /// 邮箱用户登录
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static bool emaillogin(userinfo data)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0]       = new SqlParameter("@email", SqlDbType.NVarChar, 20);
            parms[0].Value = data.email;
            parms[1]       = new SqlParameter("@pwd", SqlDbType.NVarChar, 50);
            parms[1].Value = data.MD5pwd;
            string sql = "if(EXISTS(SELECT userid FROM userinfo where email = @email and pwd=@pwd)) " +
                         "select 1 " +
                         "else " +
                         "select 0";


            int result = 0;

            try
            {
                result = TypeParse.DbObjToInt(SqlHelper.ExecuteScalar(SqlHelper.connectionstring, CommandType.Text, sql, parms), 0);
            }
            catch (Exception E)
            {
                Console.Write(E.Message);
            }
            finally
            { }
            return(result > 0);
        }
Example #20
0
File: user.cs Project: lamjar/shop
        //通过用户名得到aid
        public static string getuseridbyusername(userinfo data)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0]       = new SqlParameter("@username", SqlDbType.NVarChar, 20);
            parms[0].Value = data.accounts;
            parms[1]       = new SqlParameter("@pwd", SqlDbType.NVarChar, 50);
            parms[1].Value = data.MD5pwd;
            string sql = "SELECT [userid] FROM userinfo where [accounts] = @username and [pwd]=@pwd ";
            string uid = "";

            try
            {
                SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    uid = TypeParse.DbObjToString(dr["userid"].ToString(), "");
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception E)
            {
                Console.Write(E.Message);
            }
            finally
            { }
            return(uid);
        }
Example #21
0
File: user.cs Project: lamjar/shop
        public static bool rlogin(userinfo item)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0]       = new SqlParameter("@pwd", SqlDbType.NVarChar, 50);
            parms[0].Value = item.MD5pwd;
            parms[1]       = new SqlParameter("@email", SqlDbType.NVarChar, 50);
            parms[1].Value = item.email;
            string sql = "if(EXISTS(SELECT [userid] FROM userinfo where [pwd] = @pwd and [email] = @email)) " +
                         "select 1 " +
                         "else " +
                         "select 0";

            int result = 0;

            try
            {
                result = TypeParse.DbObjToInt(SqlHelper.ExecuteScalar(SqlHelper.connectionstring, CommandType.Text, sql, parms), 0);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
            return(result > 0);
        }
Example #22
0
        protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            string strName = TextBoxUsername.Text.Trim();

            byte[]    result = Encoding.Default.GetBytes(TextBoxPassword.Text.Trim());
            byte[]    output = new MD5CryptoServiceProvider().ComputeHash(result);
            DataTable dt     = new userinfo().validUser(strName, BitConverter.ToString(output).Replace("-", ""));

            if (dt.Rows.Count > 0)
            {
                Session["userName"] = strName;
                if (dt.Rows[0]["isAdmin"].ToString() == "True")
                {
                    Session["isAdmin"] = "true";
                    Response.Redirect("Admin.aspx");
                }
                Session["isAdmin"] = "false";
                if (Session["shopcar"] == null)
                {
                    Response.Redirect("Default.aspx");
                }
                Response.Redirect("Cart.aspx");
            }
            else
            {
                Session["userName"]  = "";
                LabelState.Text      = "用户名或密码不正确!如没有账户请<a href='register.aspx'>注册</a>";
                LabelState.ForeColor = System.Drawing.Color.Red;
            }
        }
        //重置选中用户密码
        //删除用户
        protected void BtnDel_Click(object sender, DirectEventArgs e)
        {
            RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel;

            foreach (SelectedRow row in sm.SelectedRows)
            {
                userinfo user = new userinfo();
                user.userid = int.Parse(row.RecordID);
                if (row.RecordID == Session["currentUserID"].ToString())
                {
                    X.Msg.Notify("失败", "<font color='red'>系统不允许删除超级管理员!</font>").Show();
                    continue;
                }
                userinfoMgr mgr = new userinfoMgr();
                if (mgr.Del_userinfo(user))
                {
                    X.Msg.Notify("成功", "<font color='green'>已经成功删除选中的用户</font>").Show();
                }
                else
                {
                    X.Msg.Notify("失败", "<font color='green'>删除用户失败,请您重试!</font>").Show();
                }
            }
            GridPanel1.Reload();
        }
Example #24
0
        public async Task <ActionResult> DoLogin(UserViewModel uvm)
        {
            if (ModelState.IsValid)
            {
                userinfo user = new userinfo();
                user.username = uvm.username;
                user.password = UserBusinessLayer.GetMD5(uvm.password);
                UserBusinessLayer ubl = new UserBusinessLayer();
                switch (await ubl.loginAsync(user))
                {
                case "admin":
                    return(RedirectToAction("Index", "DB"));

                case "user":
                    SignInAsync(user);
                    return(RedirectToAction("Index", "Home"));

                case "NoUser":
                    ViewBag.errorMsg = "用户名不存在或密码错误";
                    return(View("Login", uvm));
                }
                return(new EmptyResult());
            }
            else
            {
                return(View("Login", uvm));
            }
        }
Example #25
0
        public JsonResult delcommentson(wenzhangpinglunson wps)
        {
            try
            {
                userinfo uif = new userinfo();
                uif.username = HttpContext.Request.Cookies["user"];
                uif.pwd      = HttpContext.Request.Cookies["key"];
                WenZhangBLL wz = new WenZhangBLL();
                uif = DataToEnity <userinfo> .DataRowToEntity(wz.Getuserinfo(uif).Rows[0]);

                CommentBLL cb = new CommentBLL();
                if (cb.iswenzhangzuoze(uif.id, wps.id))
                {
                    wps.pinglunrenid = uif.id;
                    return(Json(new { issuf = cb.delcommentson(wps) }));
                }
                else if (cb.isgaipinglunsonzuoze(uif.id, wps.id))
                {
                    wps.pinglunrenid = uif.id;
                    return(Json(new { issuf = cb.delcommentson(wps) }));
                }
                return(Json(new { issuf = false }));
            }
            catch
            {
                return(Json(new { issuf = true }));
            }
        }
Example #26
0
        public void forgotPassword(UserPersonalInfo userPerInfo)
        {
            userinfo objUserDetails = getUserDetails(userPerInfo);
            Email    objEmail       = new Email();

            objEmail.sendMails(objUserDetails);
        }
Example #27
0
File: user.cs Project: uwitec/shop
        /// <summary>
        /// 注册新用户
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static bool adduser(userinfo data)
        {
            SqlParameter[] parms = new SqlParameter[8];
            parms[0] = new SqlParameter("@id", SqlDbType.VarChar, 20);
            parms[0].Direction = ParameterDirection.Output;
            parms[1] = new SqlParameter("@email", SqlDbType.NVarChar, 50);
            parms[1].Value = data.email;
            parms[2] = new SqlParameter("@pwd", SqlDbType.Char, 50);
            parms[2].Value = data.MD5pwd;
            parms[3] = new SqlParameter("@adddate", SqlDbType.DateTime);
            parms[3].Value = data.adddate;
            parms[4] = new SqlParameter("@accounts", SqlDbType.VarChar, 50);
            parms[4].Value = data.accounts;
            parms[5] = new SqlParameter("@headerimg", SqlDbType.VarChar, 50);
            parms[5].Value = data.headerimg;
            parms[6] = new SqlParameter("@atid", SqlDbType.Int);
            parms[6].Value = data.atid;

            string sql = "exec dbo.www_getno 'userinfo',10,@id output " +
                        "insert into userinfo (userid,pwd,email,adddate,accounts,headerimg,atid) " +
                        "values (@id,@pwd,@email,@adddate,@accounts,@headerimg,@atid) ";
            int result = 0;
            try
            {
                result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                data.userid = TypeParse.DbObjToString(parms[0].Value, "");
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
            return result > 0;
        }
Example #28
0
 public bool  save()
 {
     //  if (!filterdata()) return false ;
     try
     {
         if (_zuser == null || _zuser.user == null)
         {
             _zuser             = new userinfo();
             _zuser.user        = new users();
             _zuser.user.cardID = "空";
         }
         GetSplit(Checkdatashow, ref success, ref fail);
         torquechecktarget tqct = new torquechecktarget()
         {
             wrenchID = _wrench.id.ToString(), checkDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")), qaID = _zuser.user.cardID, operatorID = _juser.cardID, torqueTargetValue = _wrench.targetvalue, errorRangeMax = (_errorrangmax / 100).ToString("f0"), errorRangeMin = (_errorrangmin / 100).ToString("f0"), is_good = _wrenchisgood, guid = Guid.NewGuid().ToString(), count = _systemset.count ?? 0, arry = _systemset.arry ?? 0
         };
         string ttid = CheckTarget.AddReturnGuid(tqct);
         List <torquecheckrecord> tc = getresult(ttid);
         return(CheckTargetRecord.AddMany(tc));
     }
     catch {
         new Exception("保存时出现异常");
         return(false);
     }
 }
        public static userinfo getUser(string username)
        {
            TrDAL    td   = new TrDAL();
            userinfo user = td.users.Where(u => u.username == username).FirstOrDefault();

            return(user);
        }
Example #30
0
 // Start is called before the first frame update
 void Start()
 {
     Instance = this;
     webs     = GetComponent <webscript>();
     userinfo = GetComponent <userinfo>();
     login    = GetComponent <login>();
 }
Example #31
0
        private void button1_Click(object sender, EventArgs e)
        {
            string   id    = textBox1.Text.ToString();
            userinfo user1 = mydydp.GetUserById(id);

            if (user1 != null)
            {
                string pass = maskedTextBox1.Text.ToString();
                if (pass == user1.password)
                {
                    MessageBox.Show("登录成功!");
                    this.Hide();
                    DialogResult = DialogResult.OK;
                    USERID       = Int32.Parse(textBox1.Text.ToString());
                }
                else
                {
                    MessageBox.Show("密码错误,请核实!");
                }
            }
            else
            {
                MessageBox.Show("系统内无此员工号,请核实!");
            }
        }
Example #32
0
        public ApiMessage <object> LoginByToken(userinfo user)
        {
            var userData = _bll.LoginByToken(user);
            var outData  = new ApiMessage <object>
            {
                Success = userData.Success,
                Msg     = userData.Msg,
                MsgCode = userData.MsgCode
            };

            if (!userData.Success)
            {
                return(outData);
            }
            var currentUser = UserVModel.FormatUser(userData.Data);
            var key         = Encrypt.MD5(currentUser.Id + "_" + currentUser.UserType);

            outData.Data = new
            {
                Token = key,
                currentUser.UserName,
                currentUser.UserCode,
                currentUser.ImageUrl,
                currentUser.Id,
                currentUser.Phone,
                currentUser.IsMember,
                currentUser.PointAmount
            };
            CacheHelper.SetCache(key, currentUser, new TimeSpan(0, 30, 0));
            return(outData);
        }
Example #33
0
 /// <summary>
 /// 为窗体控件赋初始值(根据用户id赋值)
 /// </summary>
 /// <param name="guid_id"></param>
 internal void SetTxt(userinfo user)
 {
     if (user.Pic != null)
     {
         picUserPhoto.Image = CommonHelper.BytesToPic(user.Pic);
     }
     txtName.Text       = user.Name;
     txtQQ.Text         = user.QQ;
     txtPhone.Text      = user.Phone;
     txtIDCard.Text     = user.IdCard;
     txtSignatrue.Text  = user.Signature;
     txtRemark.Text     = user.Remark;
     btnRegister.Click -= btnRegister_Click;         //卸载注册事件
     btnGoLogin.Visible = false;                     //隐藏登陆button
     btnRegister.Click += new EventHandler((a, b) => //注册修改事件
     {
         if (!CheckInput())
         {
             return;
         }
         //填充导航属性和Guid_id
         var temp = iuserInfoService.LoadEntities(u => u.Guid_id == user.Guid_id).First();
         temp     = GetUserInfoByInput(temp);
         if (iuserInfoService.EditEntity(temp))
         {
             MessageBoxEx.Show("修改成功!!");
             this.Close();
         }
         else
         {
             MessageBoxEx.Show("修改失败!请检查输入后重试");
         }
     });
 }
Example #34
0
 public string checkeditpwd(string pwd, string userid)
 {
     userinfo item = new userinfo();
     item.pwd =Des.MD5(pwd);
     item.userid = userid;
     bool result = user.checkpwd(item);
     if (result)
     {
         return "t";
     }
     else
     {
         return "f";
     }
 }
Example #35
0
        protected void EditHeaderImg(object sender, EventArgs e)
        {
            string userid = Request.Cookies["tfuid"].Value.ToString();
            string uploadName = headerimg.Value;//获取待上传图片的完整路径,包括文件名
            //string uploadName = InputFile.PostedFile.FileName;
            string pictureName = oimgname.Value.Trim();//上传后的图片名,以当前时间为文件名,确保文件名没有重复
            if (headerimg.Value != "")
            {
                int idx = uploadName.LastIndexOf(".");
                string suffix = uploadName.Substring(idx);//获得上传的图片的后缀名
                if (suffix.ToLower() != ".bmp" && suffix.ToLower() != ".jpg" && suffix.ToLower() != ".jpeg" && suffix.ToLower() != ".png" && suffix.ToLower() != ".gif")
                {
                    imgnote.InnerHtml = "<span style=\"color:red\">上传文件必须是图片格式!</span>";
                    return;
                }
                pictureName = DateTime.Now.Ticks.ToString() + suffix;
            }
            try
            {
                if (uploadName != "")
                {
                    string path = Server.MapPath("/Files/HeaderImg/");
                    headerimg.PostedFile.SaveAs(path + pictureName);
                }

                userinfo data = new userinfo();
                data.headerimg = pictureName;
                data.userid = userid;
                bool result = user.changeHeaderImg(data);
                if (result)
                {
                    Response.Write("<script>alert('编辑图片成功!');location.href='/UHeaderImg';</script>");
                }
                else
                {
                    Response.Write("<script>alert('编辑图片失败!');location.href='/UHeaderImg';</script>");
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Example #36
0
        protected void EditUserInfo(object sender, EventArgs e)
        {
            string uid="";
            if (Request.Cookies["tfuid"] != null)
            {
                uid = TypeParse.DbObjToString(Request.Cookies["tfuid"].Value, "");
            }
            else
            {
                Response.Redirect("/UserLog");
            }

            bool result1 = user.checkaccounts(txtaccounts.Value.Trim(), uid);
            if (result1)
            {
                accountsnote.InnerHtml = "<span class=\"red\">该账号已经被注册,请使用其他账号</span>";
                return;
            }

            userinfo item = new userinfo();
            item.userid = uid;
            item.accounts = txtaccounts.Value;
            item.address = txtaddress.Value;
            item.qq = txtqq.Value;
            item.truename = txttruename.Value;
            item.tel = txttel.Value;
            item.mobile = txtmobile.Value;
            item.company = txtcompany.Value;
            bool result = user.updateUserInfo(item);
            if (result)
            {
                Response.Write("<script>alert('提交资料成功!');location.href='/UIndex';</script>");
            }
            else
            {
                Response.Write("<script>alert('提交资料失败!');location.href='/UIndex';</script>");
            }
        }
Example #37
0
File: user.cs Project: uwitec/shop
        //添加账号类型
        public static bool addaccountstype(userinfo data)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0] = new SqlParameter("@accountstype", SqlDbType.NVarChar, 20);
            parms[0].Value = data.accountstype;
            parms[1] = new SqlParameter("@atdiscount", SqlDbType.Decimal);
            parms[1].Value = data.atdiscount;

            string sql = "insert into accountstype (accountstype,atdiscount) values(@accountstype,@atdiscount)";
            int result = 0;
            try
            {
                result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return result > 0;
        }
 partial void Deleteuserinfo(userinfo instance);
Example #39
0
File: user.cs Project: uwitec/shop
 /// <summary>
 /// 改变头像
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public static bool changeHeaderImg(userinfo item)
 {
     SqlParameter[] parms = new SqlParameter[2];
     parms[0] = new SqlParameter("@userid", SqlDbType.NVarChar, 40);
     parms[0].Value = item.userid;
     parms[1] = new SqlParameter("@headerimg", SqlDbType.NVarChar, 60);
     parms[1].Value = item.headerimg;
     string sql = "update userinfo set headerimg=@headerimg where userid=@userid";
     int result = 0;
     try
     {
         result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
     }
     catch (Exception E)
     {
         Console.Write(E.Message);
     }
     finally
     { }
     return result > 0;
 }
Example #40
0
File: user.cs Project: uwitec/shop
        /// <summary>
        /// 修改普通用户资料
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static bool updateUserInfo(userinfo data)
        {
            SqlParameter[] parms = new SqlParameter[16];
            parms[0] = new SqlParameter("@userid", SqlDbType.NVarChar, 40);
            parms[0].Value = data.userid;
            parms[1] = new SqlParameter("@tel", SqlDbType.VarChar, 50);
            parms[1].Value = data.tel;
            parms[2] = new SqlParameter("@mobile", SqlDbType.VarChar, 50);
            parms[2].Value = data.mobile;
            parms[3] = new SqlParameter("@truename", SqlDbType.VarChar, 50);
            parms[3].Value = data.truename;
            parms[4] = new SqlParameter("@qq", SqlDbType.VarChar, 50);
            parms[4].Value = data.qq;
            parms[5] = new SqlParameter("@company", SqlDbType.VarChar, 50);
            parms[5].Value = data.company;
            parms[6] = new SqlParameter("@accounts", SqlDbType.VarChar, 50);
            parms[6].Value = data.accounts;
            parms[7] = new SqlParameter("@address", SqlDbType.VarChar, 50);
            parms[7].Value = data.address;

            string sql = "update userinfo set accounts=@accounts,tel=@tel,mobile=@mobile,truename=@truename,qq=@qq,company=@company,address=@address where [userid]=@userid";
            int result = 0;
            try
            {
                result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
            return result > 0;
        }
Example #41
0
File: user.cs Project: uwitec/shop
        /// <summary>
        /// 用户名用户登录
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static bool usernamelogin(userinfo data)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0] = new SqlParameter("@username", SqlDbType.NVarChar, 20);
            parms[0].Value = data.accounts;
            parms[1] = new SqlParameter("@pwd", SqlDbType.NVarChar, 50);
            parms[1].Value = data.MD5pwd;
            string sql = "if(EXISTS(SELECT userid FROM userinfo where accounts = @username and pwd=@pwd)) " +
                         "select 1 " +
                         "else " +
                         "select 0";

            int result = 0;
            try
            {
                result = TypeParse.DbObjToInt(SqlHelper.ExecuteScalar(SqlHelper.connectionstring, CommandType.Text, sql, parms), 0);
            }
            catch (Exception E)
            {
                Console.Write(E.Message);
            }
            finally
            { }
            return result > 0;
        }
Example #42
0
File: user.cs Project: uwitec/shop
        public static bool rlogin(userinfo item)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0] = new SqlParameter("@pwd", SqlDbType.NVarChar, 50);
            parms[0].Value = item.MD5pwd;
            parms[1] = new SqlParameter("@email", SqlDbType.NVarChar, 50);
            parms[1].Value = item.email;
            string sql = "if(EXISTS(SELECT [userid] FROM userinfo where [pwd] = @pwd and [email] = @email)) " +
                         "select 1 " +
                         "else " +
                         "select 0";

            int result = 0;
            try
            {
                result = TypeParse.DbObjToInt(SqlHelper.ExecuteScalar(SqlHelper.connectionstring, CommandType.Text, sql, parms), 0);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
            return result > 0;
        }
Example #43
0
File: user.cs Project: uwitec/shop
        /// <summary>
        /// 改变用户账号类型
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static bool updateuserat(userinfo data)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0] = new SqlParameter("@userid", SqlDbType.NVarChar, 40);
            parms[0].Value = data.userid;
            parms[1] = new SqlParameter("@atid", SqlDbType.Int);
            parms[1].Value = data.atid;

            string sql = "update userinfo set atid=@atid where [userid]=@userid";
            int result = 0;
            try
            {
                result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
            return result > 0;
        }
Example #44
0
File: user.cs Project: uwitec/shop
        /// <summary>
        /// 得到用户信息列表
        /// </summary>
        /// <param name="pdata"></param>
        /// <returns></returns>
        public static List<userinfo> getUserList(pageinfo pdata)
        {
            List<userinfo> userlist = new List<userinfo>();
            try
            {
                DataTable dt = pagehelper.getpagedt(pdata);
                if (dt != null)
                {
                    foreach (DataRow reader in dt.Rows)
                    {
                        userinfo data = new userinfo();
                        data.userid = TypeParse.DbObjToString(reader["userid"], "");
                        data.email = TypeParse.DbObjToString(reader["email"], "");
                        data.accounts = TypeParse.DbObjToString(reader["accounts"], "");

                        data.tel = TypeParse.DbObjToString(reader["tel"], "");
                        data.mobile = TypeParse.DbObjToString(reader["mobile"], "");

                        data.headerimg = TypeParse.DbObjToString(reader["headerimg"], "noimg.jpg");
                        data.atid = TypeParse.DbObjToInt(reader["atid"], 1);
                        data.accountstype = TypeParse.DbObjToString(reader["accountstype"], "");
                        data.truename = TypeParse.DbObjToString(reader["truename"], "");
                        data.qq = TypeParse.DbObjToString(reader["qq"], "");

                        data.company = TypeParse.DbObjToString(reader["company"], "");
                        data.address = TypeParse.DbObjToString(reader["address"], "");
                        data.adddate = TypeParse.DbObjToDateTime(reader["adddate"], DateTime.Now);
                        userlist.Add(data);
                    }
                }
                return userlist;
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
        }
Example #45
0
File: user.cs Project: uwitec/shop
        /// <summary>
        /// 根据AID读取用户信息
        /// </summary>
        /// <param name="aid"></param>
        /// <returns></returns>
        public static userinfo getuserinfo(string userid)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0] = new SqlParameter("@userid", SqlDbType.NVarChar, 50);
            parms[0].Value = userid;

            string sql = "SELECT userinfo.userid,userinfo.email,userinfo.accounts,userinfo.pwd,userinfo.tel,userinfo.mobile,userinfo.headerimg,userinfo.qq,userinfo.company,userinfo.address,userinfo.truename,userinfo.adddate,userinfo.atid,accountstype.atdiscount,accountstype.accountstype FROM userinfo,accountstype WHERE accountstype.atid=userinfo.atid and userinfo.[userid]=@userid";
            SqlDataReader reader = null;
            try
            {
                userinfo data = new userinfo();
                reader = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (reader.Read())
                {
                    data.userid = TypeParse.DbObjToString(reader["userid"], "");
                    data.email = TypeParse.DbObjToString(reader["email"], "");
                    data.adddate = TypeParse.DbObjToDateTime(reader["adddate"], DateTime.Now);
                    data.tel = TypeParse.DbObjToString(reader["tel"], "");
                    data.mobile = TypeParse.DbObjToString(reader["mobile"], "");
                    data.headerimg = TypeParse.DbObjToString(reader["headerimg"], "noimg.jpg");
                    data.truename = TypeParse.DbObjToString(reader["truename"], "");
                    data.qq = TypeParse.DbObjToString(reader["qq"], "");
                    data.company = TypeParse.DbObjToString(reader["company"], "");
                    data.accounts = TypeParse.DbObjToString(reader["accounts"], "");
                    data.address = TypeParse.DbObjToString(reader["address"], "");
                    data.atid = TypeParse.DbObjToInt(reader["atid"], 1);
                    data.accountstype = TypeParse.DbObjToString(reader["accountstype"], "");
                    data.atdiscount = Decimal.Parse(TypeParse.DbObjToString(reader["atdiscount"], "1.00"));
                    reader.Close();
                    reader.Dispose();

                }
                return data;
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            {

            }
        }
Example #46
0
File: user.cs Project: uwitec/shop
        //编辑账号类型
        public static bool editaccountstype(userinfo data)
        {
            SqlParameter[] parms = new SqlParameter[3];
            parms[0] = new SqlParameter("@accountstype", SqlDbType.NVarChar, 20);
            parms[0].Value = data.accountstype;
            parms[1] = new SqlParameter("@atdiscount", SqlDbType.Decimal);
            parms[1].Value = data.atdiscount;
            parms[2] = new SqlParameter("@atid", SqlDbType.Int);
            parms[2].Value = data.atid;

            string sql = "update accountstype set accountstype=@accountstype,atdiscount=@atdiscount where atid=@atid";
            int result = 0;
            try
            {
                result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
            }
            return result > 0;
        }
Example #47
0
File: user.cs Project: uwitec/shop
 //得到账号类型列表
 public static List<userinfo> getaccountstype()
 {
     string sql = "select atid,accountstype,atdiscount from accountstype";
     List<userinfo> itlist = new List<userinfo>();
     try
     {
         DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql);
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             userinfo item = new userinfo();
             item.atid = TypeParse.DbObjToInt(dr["atid"].ToString(), 0);
             item.accountstype = TypeParse.DbObjToString(dr["accountstype"].ToString(), "");
             item.atdiscount = Convert.ToDecimal(TypeParse.DbObjToString(dr["atdiscount"].ToString(), "1.00"));
             itlist.Add(item);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     finally
     {
     }
     return itlist;
 }
Example #48
0
File: user.cs Project: uwitec/shop
 //根据账号类型ID得到账号类型信息
 public static userinfo getaccoutstypeinfo(int id)
 {
     SqlParameter[] parms = new SqlParameter[2];
     parms[0] = new SqlParameter("@id", SqlDbType.Int);
     parms[0].Value = id;
     string sql = "select atid,accountstype,atdiscount from accountstype where atid=@id";
     userinfo item = new userinfo();
     SqlDataReader dr = null;
     try
     {
         dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
         if (dr.Read())
         {
             item.atid = TypeParse.DbObjToInt(dr["atid"].ToString(), 0);
             item.accountstype = TypeParse.DbObjToString(dr["accountstype"].ToString(), "");
             item.atdiscount = Convert.ToDecimal(TypeParse.DbObjToString(dr["atdiscount"].ToString(), "1.00"));
             dr.Close();
             dr.Dispose();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     finally
     {
     }
     return item;
 }
Example #49
0
File: user.cs Project: uwitec/shop
 //通过用户名得到aid
 public static string getuseridbyusername(userinfo data)
 {
     SqlParameter[] parms = new SqlParameter[2];
     parms[0] = new SqlParameter("@username", SqlDbType.NVarChar, 20);
     parms[0].Value = data.accounts;
     parms[1] = new SqlParameter("@pwd", SqlDbType.NVarChar, 50);
     parms[1].Value = data.MD5pwd;
     string sql = "SELECT [userid] FROM userinfo where [accounts] = @username and [pwd]=@pwd ";
     string uid = "";
     try
     {
         SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
         if (dr.Read())
         {
             uid = TypeParse.DbObjToString(dr["userid"].ToString(), "");
             dr.Close();
             dr.Dispose();
         }
     }
     catch (Exception E)
     {
         Console.Write(E.Message);
     }
     finally
     { }
     return uid;
 }
 partial void Insertuserinfo(userinfo instance);
Example #51
0
 public string register(string account,string pwd, string email)
 {
     userinfo item = new userinfo();
     item.accounts = HttpUtility.UrlDecode(account);
     item.pwd =Des.MD5(HttpUtility.UrlDecode(pwd));
     item.email =HttpUtility.UrlDecode(email);
     item.adddate = DateTime.Now;
     item.atid = 1;
     Random r = new Random();
     int num = r.Next(1, 72);
     item.headerimg = num.ToString() + ".jpg";
     bool result = user.adduser(item);
     if (result)
     {
         string uid = user.getuidbyemail(item);
         HttpCookie uidcookie = new HttpCookie("tfuid");
         uidcookie.Value = uid.ToString();
         HttpContext.Current.Response.Cookies.Add(uidcookie);
         return "t";
     }
     else
     {
         return "f";
     }
 }
Example #52
0
 public string userlogin(string pwd, string accounts)
 {
     userinfo item = new userinfo();
     item.pwd = Des.MD5(HttpUtility.UrlDecode(pwd));
     item.accounts = HttpUtility.UrlDecode(accounts);
     bool result = user.usernamelogin(item);
     if (result)
     {
         string uid = user.getuseridbyusername(item);
         return uid;
     }
     else
     {
         return "f";
     }
 }
 partial void Updateuserinfo(userinfo instance);
Example #54
0
 public string emaillogin(string pwd, string email)
 {
     userinfo item = new userinfo();
     item.pwd =Des.MD5(HttpUtility.UrlDecode(pwd));
     item.email =HttpUtility.UrlDecode(email);
     bool result = user.emaillogin(item);
     if (result)
     {
         string uid = user.getuidbyemail(item);
         return uid;
     }
     else
     {
         return "f";
     }
 }