【自然框架】开源社区活动,会员注册的第一份代码!
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;
}
自然框架开源社区的第一次活动——实现会员注册
人员表设计思想 —— 也许会有点帮助自然框架开发系列(一):自然框架 和 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;
}
相关文章推荐
- 【自然框架】注册会员活动——第一份代码的修改建议(第一版)
- 自然框架开源社区的第一次活动——实现会员注册
- 自然框架开源社区的第一次活动——实现会员注册
- C#窗体应用 电子杂志注册会员代码
- 【自然框架】之鼠标点功能现(一):单表的增删改查(即上次5月23日活动的一个主题)【Demo、源码下载】
- 【自然框架】之鼠标点功能现(二):表单控件的“应用”—— 代码?只写需要的!
- 【自然框架】之鼠标点功能现(一):单表的增删改查(即上次5月23日活动的一个主题)【Demo、源码下载】
- 会员注册验证代码(php+mysql+Ajax)
- nodejs的express框架登陆注册退出代码记录
- 自然框架开源社区,如何开展活动
- 漂亮的css+div会员注册或登录页面代码
- Java 实现会员注册升级 关键代码
- 分享:带会员注册登录一级纯css导航栏代码
- web会员注册页面代码(4)
- EasyUI框架 使用Ajax提交注册信息的实现代码
- 浏览器屏幕顶部提示未登录会员注册代码解决方法
- kphp框架中实现自定义session会话处理方法的php和msyql代码分享
- GZFramwork快速开发框架演练之会员系统(一)框架源码下载
- Android MVP框架代码(供大家参考)