代码解释问题,十万火急,救命啊!!!!!!(看到的都进来看看)

姜大牙 2006-06-05 06:16:22
部分代码解释:
(1)
private void btnGet_Click(object sender,ImageClickEvevtArgs e)
{
User NewUser=new User();
NewUser.Name = this.txtName.Text.Trim();
NewUser.Mail = this.txtEMail.Text.Trim();
这是一个Password按钮事件函数。以上这段代码新建了一个User类对象,并设置用户名和Email属性信息。
(2) if(NewUser.Check())
{
try
{
string Password = NewUser.GetPassword();
if(Password == "")
{
lblInfo.Text = "Sorry,send password FAILED,plz contact with webmaster.";
}
用户输入自己的用户名后,系统将会根据用户输入的信息,检测该用户是否存在。若该用户不存在,则会显示密码为空,系统会提示错误信息。
(3) else {
MailMessage Mailer = new MailMessage();
Mailer.From = "Webmaster@hugo.com";
Mailer.To = this.txtEMail.Text.Trim(); Mailer.Subject = "Get password--DBProjectGuide BookShop";
Mailer.Body = "Hi,name :" + this.txtName.Text.Trim() + " \n password:" + Password;
……
这部分就是系统将所查询到的注册用户的用户名和密码发到注册用户的邮箱里。这时,用户就可以去邮箱直接取回登录密码。

lblInfo.Text = "Password has been sent to your email.";
lblInfo.ForeColor = Color.Blue;
}
}
catch(Exception ex)
{
lblInfo.Text = "Sorry,send password FAILED!" + ex.Message;
}
}
else
{
lblInfo.Text = "Plz enter your correct name and email.";
}
}
发送成功的话就会在系统就会给出提示信息,提示密码已经发到您的邮箱里;如果因邮箱输入错误而致使发送失败的话,系统也会给出提示,要求用户填写正确的名字的邮箱。
3)修改密码

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace BookShop
{
/// <summary>
/// Summary description for ChangePassword.
/// </summary>
public class ChangePassword : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.TextBox txtName;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator3;
protected System.Web.UI.WebControls.TextBox txtOldPwd;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1;
protected System.Web.UI.WebControls.TextBox txtPwd;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.CompareValidator CompareValidator1;
protected System.Web.UI.WebControls.TextBox txtPwd2;
protected System.Web.UI.WebControls.ImageButton btnUpdate;
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
protected System.Web.UI.WebControls.Label lblInfo;
protected Hongfan.Components.PanelEx PanelEx1;

private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
if(Object.Equals(Session["UserID"],null))
{
Session["UserID"] = -1;
Session["UserName"] = "Guest";
}
}
this.txtName.Text = Session["UserName"].ToString();
lblInfo.Visible = false;
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnUpdate.Click += new System.Web.UI.ImageClickEventHandler(this.btnUpdate_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void btnUpdate_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
if(Page.IsValid)
{
DBProjectGuide.BookShop.User user = new DBProjectGuide.BookShop.User();
user.Name = this.txtName.Text.Trim();
user.Password = this.txtOldPwd.Text.Trim();
if(user.Login())
{
try
{
user.ChangePassword(this.txtPwd.Text.Trim());
lblInfo.Text = "Changed successful!";
}
catch
{
lblInfo.Text = "Changed failed!Plz contact with web master";
}
lblInfo.Visible = true;
}
else
{
lblInfo.Text = "Wrong name or password!";
lblInfo.Visible = true;
}
}
}
}
}
4)修改信息

大哥们帮忙啊,写论文的时候,要求注释啊。十万火急,帮忙啊!!!!!!!!!!!!!!先多谢了。哪位大哥大姐,帮忙。定当感激不尽。请多谢几行解释啊!多谢多谢
...全文
147 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuyan9132 2006-06-06
  • 打赏
  • 举报
回复
是想在上面加注释么,这注释不是都写着了么,把格式正一下就OK啦
ggygd 2006-06-06
  • 打赏
  • 举报
回复
頂!
sbsrg3000 2006-06-06
  • 打赏
  • 举报
回复
/* 老师你也看不懂我的论文吗?竟然我要注释给你看@@? */
pengchao_214 2006-06-05
  • 打赏
  • 举报
回复
说明白点,有错误还是怎么了....
kssys 2006-06-05
  • 打赏
  • 举报
回复
楼主的意思是要多写一些东西?凑数量吗?

不必啦,简练就好。

另,注释用//
Eddie005 2006-06-05
  • 打赏
  • 举报
回复
晕...


lz没看懂这些代码吗?

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧