Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["user"] != null)
     {
         logoninfo lg = new logoninfo(Session["user"].ToString());
         lg             = bal.selectname(lg);
         this.user.Text = lg.Name;
         //string name = Session["user"].ToString();
         //string cmdText = "SELECT [bookName], [author], [type], [introduce], [path] FROM [ViewBook]";
         //string[] paramList = { "@type" };
         //object[] valueList = { name };
         //DataSet da = db.FillDataSet(cmdText, paramList, valueList);
         //GridView1.DataSource = da;
         //GridView1.DataSourceID = "";
         //GridView1.DataBind();
         //string cmdText2 = "SELECT [ebookName], [author], [type], [introduce], [path] FROM [ViewEbook]";
         //string[] paramList2 = { "@type" };
         //object[] valueList2 = { name };
         //DataSet da2 = db.FillDataSet(cmdText2, paramList2, valueList2);
         //GridView2.DataSource = da2;
         //GridView2.DataSourceID = "";
         //GridView2.DataBind();
     }
     else
     {
         Response.Redirect("Login.aspx");
     }
 }
Beispiel #2
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public OperationResult Regist(logoninfo user)
        {
            logoninfo temp = dao.Query(user.Email);

            if (temp != null)
            {
                if (temp.Email == null)
                {
                    int mun = dao.Add(user);
                    if (mun == 1)
                    {
                        return(OperationResult.success);
                    }
                    return(OperationResult.failure);
                }
                else if (temp.Email != null)
                {
                    return(OperationResult.exist);
                }

                return(OperationResult.failure);
            }
            else
            {
                int mun = dao.Add(user);
                if (mun == 1)
                {
                    return(OperationResult.success);
                }
                return(OperationResult.failure);
            }
        }
Beispiel #3
0
        public List <logoninfo> Query(string Email, bool isAccurate = false)
        {
            List <logoninfo> userList = new List <logoninfo>();
            DataSet          ds       = new DataSet();

            if (isAccurate)
            {
                string   cmdText   = "select * from T_UserInfo where email = @email";
                string[] paramList = { "@email" };
                object[] valueList = { Email };
                ds = db.FillDataSet(cmdText, paramList, valueList);
            }
            else
            {
                string   cmdText   = "select * from T_UserInfo where email like @email";
                string[] paramList = { "@email" };
                object[] valueList = { "%" + Email + "%" };
                ds = db.FillDataSet(cmdText, paramList, valueList);
            }
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                DataRow   dr   = ds.Tables[0].Rows[i];
                logoninfo user = new logoninfo(dr["userName"].ToString(), dr["pwd"].ToString(), dr["userName"].ToString(), dr["sex"].ToString());
                userList.Add(user);
            }
            return(userList);
        }
Beispiel #4
0
        public int Update(logoninfo user)
        {
            string cmdText = "update T_UserInfo set pwd=@pwd,realName=@realName where userName=@userName";

            string[] paramList  = { "@email", "@password", "@userName" };
            object[] valuesList = { user.Email, user.Pwd, user.Name };
            return(db.ExecuteNoneQuery(cmdText, paramList, valuesList));
        }
Beispiel #5
0
        public int Add(logoninfo user)
        {
            string cmdText = "insert into T_UserInfo(userName,password,sex,email) values(@userName,@password,@sex,@email)";

            string[] paramList = { "@email", "@userName", "@password", "@sex" };
            object[] valueList = { user.Email, user.Name, user.Pwd, user.sex };
            return(db.ExecuteNoneQuery(cmdText, paramList, valueList));
        }
Beispiel #6
0
        /// <summary>
        /// 根据Email查修
        /// </summary>
        /// <returns></returns>

        public logoninfo selectname(logoninfo user)
        {
            logoninfo tep = dao.Query(user.Email);

            if (tep != null)
            {
                return(tep);
            }
            else
            {
                return(null);
            }
        }
Beispiel #7
0
        public logoninfo login(logoninfo user)
        {
            logoninfo tep = dao.Query(user.Email);

            if (tep != null && tep.Pwd == user.Pwd)
            {
                return(tep);
            }
            else
            {
                return(null);
            }
        }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["user"] != null)
     {
         logoninfo lg = new logoninfo(Session["user"].ToString());
         lg             = bal.selectname(lg);
         this.user.Text = lg.Name;
         this.loginli.Style["display"] = "none";
     }
     else
     {
         this.userli.Style["display"] = "none";
     }
 }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] != null)
            {
                logoninfo lg = new logoninfo(Session["user"].ToString());
                lg = bal.selectname(lg);

                this.user.Text = lg.Name;
            }
            else
            {
                this.user.Text = "登录";
            }
        }
Beispiel #10
0
        public logoninfo Query(string Email)
        {
            string cmdText = "select * from T_UserInfo where email = @email";

            string[]      paramList = { "@email" };
            object[]      valueList = { Email };
            SqlDataReader reader    = db.ExecuteReader(cmdText, paramList, valueList);
            logoninfo     user      = new logoninfo();

            if (reader.Read())
            {
                user.Email = reader["email"].ToString();;
                user.Pwd   = reader["password"].ToString();
                user.Name  = reader["userName"].ToString();
                user.sex   = reader["sex"].ToString();
            }
            reader.Close();
            return(user);
        }
Beispiel #11
0
        /// <summary>
        /// 向用户发送邮箱
        /// </summary>
        /// <returns></returns>
        public string useryzm(logoninfo user)
        {
            try
            {
                char[] sjslist = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };

                Random ran = new Random();
                string sjs = "";
                for (int i = 0; i < 6; i++)
                {
                    sjs += sjslist[ran.Next(sjslist.Length)];
                }

                MailMessage myEmail = new MailMessage("*****@*****.**", user.Email);

                myEmail.Subject = "Email Example";
                myEmail.Body    = sjs;
                string str = @"C:\gg.jpeg";

                //Attachment myAtt = new Attachment(str,System.Net.Mime.MediaTypeNames.Application.Octet);

                //myEmail.Attachments.Add(myAtt);

                string tt   = "*****@*****.**";
                String wd   = "2214567693";
                string name = "413459804";
                string pwd  = "wfcmwojrqzvwdjfb";
                String ss   = "xdslgjeggzxjcaee";

                SmtpClient client = new SmtpClient("smtp.qq.com", 25);
                client.EnableSsl             = true;
                client.UseDefaultCredentials = false;
                client.Credentials           = new System.Net.NetworkCredential(wd, pwd);
                client.Send(myEmail);
                return(sjs);
            }
            catch (Exception e)
            {
                string ss = "失败";
                return(ss);
            }
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] != null)
            {
                logoninfo lg = new logoninfo(Session["user"].ToString());
                lg = bal.selectname(lg);

                this.user.Text = lg.Name;
            }
            else
            {
                Response.Redirect("Login.aspx");
            }


            string[] List = { "都市传奇", "玄幻", "仙侠修真", "灵异", "历史", "游戏竞技", "科幻", "武侠", "奇幻", "古代言情", "现代言情", "玄幻言情", "校园生活", "其他" };
            for (int i = 1; i < List.Length; i++)
            {
                DropDownList1.Items.Add(List[i]);
                DropDownList2.Items.Add(List[i]);
            }
        }
Beispiel #13
0
 /// <summary>
 /// 重置用户密码
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public bool ResetPwd(logoninfo user)
 {
     return(false);
 }
Beispiel #14
0
 /// <summary>
 /// 更新用户基本信息
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public bool Update(logoninfo user)
 {
     return(false);
 }
Beispiel #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] != null)
            {
                logoninfo lg = new logoninfo(Session["user"].ToString());
                lg             = ball.selectname(lg);
                this.user.Text = lg.Name;
                this.loginli.Style["display"] = "none";
            }
            else
            {
                this.userli.Style["display"] = "none";
                this.textshuru.Visible       = false;
                this.Button4.Visible         = false;
            }


            this.name.Text = Session["name"].ToString();
            this.inth.Text = Session["type"].ToString();


            string cmdText = "select * from T_Comment where bookName =  @bookName";

            string[] paramList = { "@bookName" };
            object[] valueList = { this.name.Text };
            DataSet  da        = db.FillDataSet(cmdText, paramList, valueList);

            GridView1.DataSource   = da;
            GridView1.DataSourceID = "";
            GridView1.DataBind();



            if (Session["type"].ToString() == null)
            {
            }
            else if (Session["type"].ToString() == "e")
            {
                this.jieyue.Visible = false;
                string  name = Session["name"].ToString();
                UpEbook lg   = new UpEbook(name);
                lg = bll.selectebook(lg);
                if (lg.path != null)
                {
                    this.smname.Text   = lg.name.ToString();
                    this.name.Text     = lg.name.ToString();
                    this.inth.Text     = lg.inthro.ToString();
                    this.intrduce.Text = lg.intrduce.ToString();
                    this.smtype.Text   = lg.type.ToString();


                    this.Image1.ImageUrl = "~/UploadPic/" + lg.path.ToString() + " ";

                    Session["path"] = lg.path.ToString();
                }
                else
                {
                    this.Image1.ImageUrl = "~/image/pic1.jpg";
                }
            }
            else if (Session["type"].ToString() == "b")
            {
                string name = Session["name"].ToString();
                UpBook lg   = new UpBook(name);
                lg = bll.selectbook(lg);
                if (lg.path != null)
                {
                    this.smname.Text   = lg.name.ToString();
                    this.name.Text     = lg.name.ToString();
                    this.inth.Text     = lg.inthro.ToString();
                    this.intrduce.Text = lg.intrduce.ToString();
                    this.smtype.Text   = lg.type.ToString();

                    this.Image1.ImageUrl = "~/image/" + lg.path.ToString() + " ";
                }
                else
                {
                    this.Image1.ImageUrl = "~/image/pic1.jpg";
                }
            }
        }