您的位置:首页 > 编程语言

【自然框架】开源社区活动,会员注册的第一份代码!

2011-04-15 17:23 309 查看
  前情回顾:  

自然框架开源社区的第一次活动——实现会员注册

人员表设计思想 —— 也许会有点帮助

自然框架开发系列(一):自然框架 和 AgileEAS.NET 合作,开发b/s的药店系统!

  漫长的期待,终于等来了第一份代码,这份代码由“好坏”提供。十分感谢对活动的支持!他工作也很忙,经常加班,昨天是他第一次不用加班,晚上写到凌晨3点多,10点起来又写到现在才写完。我也是刚刚收到这份代码,简单的看了一下。

  项目是按照三层的方式来编写,分成了五个项目。



  几个类图:



  说明:

由于我的数据库设计的原因,导致设计成了三个实体类。这个怪我没说清楚。我的想法是,设计数据库就按照需求和数据库的规则来做;设计实体类,那么就按照需求和面向对象的规则来做。不能相互影响。这个当时没说清楚,给大家带来了不变,表示歉意!这里补充说明一下,同时也期待大家的代码!
理解这份代码后,我会提出我的看法,同时也期待大家的意见,不过我们是对代码不对人目的是给朋友帮忙,而不是找领导的感觉,呵呵。请大家注意了!

 =========================================

 

  摘录几段代码,其他的代码可以下载“好坏”的会员注册完整代码

  UI:

protected void btn_Click(object sender, EventArgs e)
{

PersonInfo person = new PersonInfo();
PersonUserInfo puser = new PersonUserInfo();
OSUserInfo osuser = new OSUserInfo();

person.PersonName = TBName.Text;
person.Birthday = Convert.ToDateTime(TBBirthday.Text);
person.IDCard = TBCardNum.Text;
person.Gender = DropDownListGender.SelectedValue;
puser.Email = TBEmail.Text;
puser.UserCode = TBCode.Text;
puser.UserPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(TBPWD.Text,"MD5");
puser.UserPassword2 = puser.UserPassword;
puser.LoginIP = Request.UserHostAddress;
osuser.ProvinceID = Convert.ToInt32(DropDownListProvince.SelectedValue);
osuser.CityID = Convert.ToInt32(DropDownListCity.SelectedValue);
osuser.CountyID = Convert.ToInt32(DropDownListCounty.SelectedValue);
osuser.NikeName = TBNikeName.Text;

string message = "";
bool flag = ir.IsRegistered(person, puser, osuser,ref message);
if (flag)
{
ir.SentEmail(puser);
Response.Redirect("Succeed.aspx");
}
else
{
RegisterStartupScript("show", "<script>window.alert('" + message + "');</script>");
}

}

BLL:

public bool IsRegistered(PersonInfo person, PersonUserInfo puser, OSUserInfo osuser, ref string message)
{
if (isUnusedCode(puser.UserCode) == false)
{
message = "账号已被使用,请重新注册!";
return false;
}
if (isUnusedEmail(puser.Email) == false)
{
message = "邮箱已被使用,请重新注册!";
return false;
}
bool flag = dal.insert(person, puser, osuser);

return flag;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: