本文整理汇总了C#中BLL.users.Add方法的典型用法代码示例。如果您正苦于以下问题:C# BLL.users.Add方法的具体用法?C# BLL.users.Add怎么用?C# BLL.users.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLL.users
的用法示例。
在下文中一共展示了BLL.users.Add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: user_register
private void user_register(HttpContext context)
{
string code = DTRequest.GetFormString("txtCode").Trim();
string invitecode = DTRequest.GetFormString("txtInviteCode").Trim();
string username = DTRequest.GetFormString("txtUserName").Trim();
string password = DTRequest.GetFormString("txtPassword").Trim();
string email = DTRequest.GetFormString("txtEmail").Trim();
string userip = DTRequest.GetIP();
#region 检查各项并提示
//检查是否开启会员功能
if (siteConfig.memberstatus == 0)
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,会员功能已被关闭,无法注册新会员!\"}");
return;
}
if (userConfig.regstatus == 0)
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,系统暂不允许注册新用户!\"}");
return;
}
//校检验证码
string result = verify_code(context, code);
if (result != "success")
{
context.Response.Write(result);
return;
}
//检查用户输入信息是否为空
if (username == "" || password == "")
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"用户名和密码不能为空!\"}");
return;
}
if (email == "")
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"电子邮箱不能为空!\"}");
return;
}
//检查用户名
BLL.users bll = new BLL.users();
Model.users model = new Model.users();
if (bll.Exists(username))
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"该用户名已经存在!\"}");
return;
}
//检查同一IP注册时隔
if (userConfig.regctrl > 0)
{
if (bll.Exists(userip, userConfig.regctrl))
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,同一IP在" + userConfig.regctrl + "小时内不能注册多个用户!\"}");
return;
}
}
//不允许同一Email注册不同用户
if (userConfig.regemailditto == 0)
{
if (bll.ExistsEmail(email))
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"Email不允许重复注册,如果你忘记用户名,请找回密码!\"}");
return;
}
}
//检查默认组别是否存在
Model.user_groups modelGroup = new BLL.user_groups().GetDefault();
if (modelGroup == null)
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"系统尚未分组,请联系管理员设置会员分组!\"}");
return;
}
//检查是否通过邀请码注册
if (userConfig.regstatus == 2)
{
string result1 = verify_invite_reg(username, invitecode);
if (result1 != "success")
{
context.Response.Write(result1);
return;
}
}
#endregion
//保存注册信息
model.group_id = modelGroup.id;
model.user_name = username;
model.password = DESEncrypt.Encrypt(password);
model.email = email;
model.reg_ip = userip;
model.reg_time = DateTime.Now;
model.is_lock = userConfig.regverify; //设置为对应状态
int newId = bll.Add(model);
if (newId < 1)
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"系统故障,注册失败,请联系网站管理员!\"}");
return;
}
model = bll.GetModel(newId);
//.........这里部分代码省略.........
示例2: user_oauth_register
private void user_oauth_register(HttpContext context)
{
//检查URL参数
if (context.Session["oauth_name"] == null)
{
context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:授权参数不正确!\"}");
return;
}
//获取授权信息
string result = Utils.UrlExecute(siteConfig.webpath + "api/oauth/" + context.Session["oauth_name"].ToString() + "/result_json.aspx");
if (result.Contains("error"))
{
context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:请检查URL是否正确!\"}");
return;
}
//反序列化JSON
Dictionary<string, object> dic = JsonMapper.ToObject<Dictionary<string, object>>(result);
if (dic["ret"].ToString() != "0")
{
context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误代码:" + dic["ret"] + "," + dic["msg"] + "\"}");
return;
}
string password = DTRequest.GetFormString("txtPassword").Trim();
string email = DTRequest.GetFormString("txtEmail").Trim();
string userip = DTRequest.GetIP();
//检查用户名
BLL.users bll = new BLL.users();
Model.users model = new Model.users();
//检查默认组别是否存在
Model.user_groups modelGroup = new BLL.user_groups().GetDefault();
if (modelGroup == null)
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"系统尚未分组,请联系管理员设置会员分组!\"}");
return;
}
//保存注册信息
model.group_id = modelGroup.id;
model.user_name = bll.GetRandomName(10);
model.password = DESEncrypt.Encrypt(password);
model.email = email;
if (!string.IsNullOrEmpty(dic["nick"].ToString()))
{
model.nick_name = dic["nick"].ToString();
}
if (dic["avatar"].ToString().StartsWith("http://"))
{
model.avatar = dic["avatar"].ToString();
}
if (!string.IsNullOrEmpty(dic["sex"].ToString()))
{
model.sex = dic["sex"].ToString();
}
if (!string.IsNullOrEmpty(dic["birthday"].ToString()))
{
model.birthday = DateTime.Parse(dic["birthday"].ToString());
}
model.reg_ip = userip;
model.reg_time = DateTime.Now;
model.is_lock = 0; //设置为对应状态
int newId = bll.Add(model);
if (newId < 1)
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"系统故障,注册失败,请联系网站管理员!\"}");
return;
}
model = bll.GetModel(newId);
//赠送积分金额
if (modelGroup.point > 0)
{
new BLL.point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分");
}
if (modelGroup.amount > 0)
{
new BLL.amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1);
}
//判断是否发送站内短消息
if (userConfig.regmsgstatus == 1)
{
new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt);
}
//绑定到对应的授权类型
Model.user_oauth oauthModel = new Model.user_oauth();
oauthModel.oauth_name = dic["oauth_name"].ToString();
oauthModel.user_id = model.id;
oauthModel.user_name = model.user_name;
oauthModel.oauth_access_token = dic["oauth_access_token"].ToString();
oauthModel.oauth_openid = dic["oauth_openid"].ToString();
new BLL.user_oauth().Add(oauthModel);
context.Session[DTKeys.SESSION_USER_INFO] = model;
context.Session.Timeout = 45;
//记住登录状态,防止Session提前过期
Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name);
Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password);
//写入登录日志
new BLL.user_login_log().Add(model.id, model.user_name, "会员登录", DTRequest.GetIP());
//返回URL
context.Response.Write("{\"msg\":1, \"msgbox\":\"会员登录成功!\"}");
return;
//.........这里部分代码省略.........
示例3: user_register
//.........这里部分代码省略.........
if (result4 != "success")
{
context.Response.Write(result4);
return;
}
break;
}
#endregion
#region 保存用户注册信息
Model.users model = new Model.users();
model.group_id = modelGroup.id;
model.user_name = username;
model.salt = Utils.GetCheckCode(6); //获得6位的salt加密字符串
model.password = DESEncrypt.Encrypt(password, model.salt);
model.email = email;
model.mobile = mobile;
model.reg_ip = userip;
model.reg_time = DateTime.Now;
//设置用户状态
if (userConfig.regstatus == 3)
{
model.status = 1; //待验证
}
else if (userConfig.regverify == 1)
{
model.status = 2; //待审核
}
else
{
model.status = 0; //正常
}
//开始写入数据库
model.id = bll.Add(model);
if (model.id < 1)
{
context.Response.Write("{\"status\":0, \"msg\":\"系统故障,请联系网站管理员!\"}");
return;
}
//检查用户组是否需要赠送积分
if (modelGroup.point > 0)
{
new BLL.user_point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分", false);
}
//检查用户组是否需要赠送金额
if (modelGroup.amount > 0)
{
new BLL.user_amount_log().Add(model.id, model.user_name, modelGroup.amount, "注册赠送金额");
}
#endregion
#region 是否发送欢迎消息
if (userConfig.regmsgstatus == 1) //站内短消息
{
new BLL.user_message().Add(1, string.Empty, model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt);
}
else if (userConfig.regmsgstatus == 2 && !string.IsNullOrEmpty(email)) //发送邮件
{
//取得邮件模板内容
Model.mail_template mailModel = new BLL.mail_template().GetModel("welcomemsg");
if (mailModel != null)
{
//替换标签
string mailTitle = mailModel.maill_title;
mailTitle = mailTitle.Replace("{username}", model.user_name);
string mailContent = mailModel.content;
示例4: DoAdd
private bool DoAdd()
{
bool result = false;
Model.users model = new Model.users();
BLL.users bll = new BLL.users();
model.group_id = int.Parse(ddlGroupId.SelectedValue);
model.status = int.Parse(rblStatus.SelectedValue);
//检测用户名是否重复
if (bll.Exists(txtUserName.Text.Trim()))
{
JscriptMsg("用户名已存在!", "", "Error");
return false;
}
model.user_name = Utils.DropHTML(txtUserName.Text.Trim());
//获得6位的salt加密字符串
model.salt = Utils.GetCheckCode(6);
//以随机生成的6位字符串做为密钥加密
model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
model.email = Utils.DropHTML(txtEmail.Text);
model.nick_name = Utils.DropHTML(txtNickName.Text);
model.avatar = Utils.DropHTML(txtAvatar.Text);
model.sex = rblSex.SelectedValue;
DateTime _birthday;
if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
{
model.birthday = _birthday;
}
model.telphone = Utils.DropHTML(txtTelphone.Text.Trim());
model.mobile = Utils.DropHTML(txtMobile.Text.Trim());
model.qq = Utils.DropHTML(txtQQ.Text);
model.address = Utils.DropHTML(txtAddress.Text.Trim());
model.amount = decimal.Parse(txtAmount.Text.Trim());
model.point = int.Parse(txtPoint.Text.Trim());
model.exp = int.Parse(txtExp.Text.Trim());
model.reg_time = DateTime.Now;
model.reg_ip = DTRequest.GetIP();
model.province = Convert.ToInt32(ddl_province.SelectedValue);
model.city = Convert.ToInt32(ddl_city.SelectedValue);
model.district = Convert.ToInt32(ddl_district.SelectedValue);
model.user_type = Convert.ToInt32(rb_user_type.SelectedValue);
if (bll.Add(model) > 0)
{
AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
result = true;
}
return result;
}
示例5: user_oauth_register
private void user_oauth_register(HttpContext context)
{
//检查URL参数
if (context.Session["oauth_name"] == null)
{
context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:授权参数不正确!\"}");
return;
}
//获取授权信息
string result = Utils.UrlExecute(siteConfig.webpath + "api/oauth/" + context.Session["oauth_name"].ToString() + "/result_json.aspx");
if (result.Contains("error"))
{
context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:请检查URL是否正确!\"}");
return;
}
string password = DTRequest.GetFormString("txtPassword").Trim();
string email = Utils.ToHtml(DTRequest.GetFormString("txtEmail").Trim());
string mobile = Utils.ToHtml(DTRequest.GetFormString("txtMobile").Trim());
string userip = DTRequest.GetIP();
//反序列化JSON
Dictionary<string, object> dic = JsonHelper.DataRowFromJSON(result);
if (dic["ret"].ToString() != "0")
{
context.Response.Write("{\"status\": 0, \"msg\": \"错误代码:" + dic["ret"] + "," + dic["msg"] + "\"}");
return;
}
BLL.users bll = new BLL.users();
Model.users model = new Model.users();
//如果开启手机登录要验证手机
if (userConfig.mobilelogin == 1 && !string.IsNullOrEmpty(mobile))
{
if (bll.ExistsMobile(mobile))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,该手机号码已被使用!\"}");
return;
}
}
//如果开启邮箱登录要验证邮箱
if (userConfig.emaillogin == 1 && !string.IsNullOrEmpty(email))
{
if (bll.ExistsEmail(email))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,该电子邮箱已被使用!\"}");
return;
}
}
//检查默认组别是否存在
Model.user_groups modelGroup = new BLL.user_groups().GetDefault();
if (modelGroup == null)
{
context.Response.Write("{\"status\":0, \"msg\":\"用户尚未分组,请联系管理员!\"}");
return;
}
//保存注册信息
model.group_id = modelGroup.id;
model.user_name = bll.GetRandomName(10); //随机用户名
model.salt = Utils.GetCheckCode(6); //获得6位的salt加密字符串
model.password = DESEncrypt.Encrypt(password, model.salt);
model.email = email;
model.mobile = mobile;
if (!string.IsNullOrEmpty(dic["nick"].ToString()))
{
model.nick_name = dic["nick"].ToString();
}
if (dic["avatar"].ToString().StartsWith("http://"))
{
model.avatar = dic["avatar"].ToString();
}
if (!string.IsNullOrEmpty(dic["sex"].ToString()))
{
model.sex = dic["sex"].ToString();
}
if (!string.IsNullOrEmpty(dic["birthday"].ToString()))
{
model.birthday = Utils.StrToDateTime(dic["birthday"].ToString());
}
model.reg_ip = userip;
model.reg_time = DateTime.Now;
model.status = 0; //设置为正常状态
model.id = bll.Add(model); //保存数据
if (model.id < 1)
{
context.Response.Write("{\"status\":0, \"msg\":\"注册失败,请联系网站管理员!\"}");
return;
}
//赠送积分金额
if (modelGroup.point > 0)
{
new BLL.user_point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分", false);
}
if (modelGroup.amount > 0)
{
new BLL.user_amount_log().Add(model.id, model.user_name, modelGroup.amount, "注册赠送金额");
}
//判断是否发送欢迎消息
if (userConfig.regmsgstatus == 1) //站内短消息
{
new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt);
}
else if (userConfig.regmsgstatus == 2) //发送邮件
//.........这里部分代码省略.........
示例6: DoAdd
private bool DoAdd()
{
bool result = true;
Model.users model = new Model.users();
BLL.users bll = new BLL.users();
model.group_id = int.Parse(ddlGroupId.SelectedValue);
model.is_lock = int.Parse(rblIsLock.SelectedValue);
model.user_name = txtUserName.Text.Trim();
model.password = DESEncrypt.Encrypt(txtPassword.Text);
model.email = txtEmail.Text;
model.nick_name = txtNickName.Text;
model.avatar = txtAvatar.Text;
model.sex = rblSex.SelectedValue;
DateTime _birthday;
if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
{
model.birthday = _birthday;
}
model.telphone = txtTelphone.Text.Trim();
model.mobile = txtMobile.Text.Trim();
model.qq = txtQQ.Text;
model.address = txtAddress.Text.Trim();
model.amount = decimal.Parse(txtAmount.Text.Trim());
model.point = int.Parse(txtPoint.Text.Trim());
model.exp = int.Parse(txtExp.Text.Trim());
model.reg_time = DateTime.Now;
model.reg_ip = DTRequest.GetIP();
if (bll.Add(model) < 1)
{
result = false;
}
return result;
}
示例7: user_register
//.........这里部分代码省略.........
if (userConfig.regstatus == 2)
{
string result1 = verify_invite_reg(username, invitecode);
if (result1 != "success")
{
context.Response.Write(result1);
return;
}
}
#endregion
//保存注册信息
model.group_id = modelGroup.id;
model.user_name = username;
model.salt = Utils.GetCheckCode(6); //获得6位的salt加密字符串
model.password = DESEncrypt.Encrypt(password, model.salt);
model.email = email;
model.mobile = mobile;
model.reg_ip = userip;
model.reg_time = DateTime.Now;
//设置对应的状态
switch (userConfig.regverify)
{
case 0:
model.status = 0; //正常
break;
case 3:
model.status = 2; //人工审核
break;
default:
model.status = 1; //待验证
break;
}
int newId = bll.Add(model);
if (newId < 1)
{
context.Response.Write("{\"status\":0, \"msg\":\"系统故障,请联系网站管理员!\"}");
return;
}
model = bll.GetModel(newId);
//赠送积分金额
if (modelGroup.point > 0)
{
new BLL.user_point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分", false);
}
if (modelGroup.amount > 0)
{
new BLL.user_amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1);
}
#region 判断是否发送欢迎消息
if (userConfig.regmsgstatus == 1) //站内短消息
{
new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt);
}
else if (userConfig.regmsgstatus == 2) //发送邮件
{
//取得邮件模板内容
Model.mail_template mailModel = new BLL.mail_template().GetModel("welcomemsg");
if (mailModel != null)
{
//替换标签
string mailTitle = mailModel.maill_title;
mailTitle = mailTitle.Replace("{username}", model.user_name);
string mailContent = mailModel.content;
mailContent = mailContent.Replace("{webname}", siteConfig.webname);
示例8: dealing_users
/// <summary>
/// 添加分配账户员工
/// </summary>
/// <param name="context"></param>
private void dealing_users(HttpContext context)
{
string username = DTRequest.GetString("username");
string password = DTRequest.GetString("psd");
string phone = DTRequest.GetString("phone");
string email = DTRequest.GetString("email");
string real_name = DTRequest.GetString("real_name");
int branch = DTRequest.GetFormInt("branch_id");
Model.users model = new Model.users();
BLL.users bll = new BLL.users();
Model.users model1 = new BasePage().GetUserInfo();
if (model1 == null)
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,请重新登录!\"}");
return;
}
if (bll.Exists(username))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,该账户名已存在!\"}");
return;
}
model.user_name = username;
model.password = password;
model.telphone = phone;
model.real_name = real_name;
model.email = email;
model.branch_id = branch;
model.user_status = 3;
model.user_type = 1;
model.parent_id = model1.id;
model.group_id = 1;
if (bll.Add(model) > 0)
{
context.Response.Write("{\"status\":1, \"msg\":\"添加员工成功!\"}");
return;
}
else
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,添加员工失败!\"}");
return;
}
}
示例9: DoAdd
private bool DoAdd()
{
bool result = true;
Model.users model = new Model.users();
BLL.users bll = new BLL.users();
model.group_id = int.Parse(ddlGroupId.SelectedValue);
model.is_lock = int.Parse(rblIsLock.SelectedValue);
int number = bll.GetOnlyCodeNumber();
model.user_name = "sxzh" + number.ToString();//txtUserName.Text.Trim();
model.password = DESEncrypt.Encrypt(txtPassword.Text);
model.email = txtEmail.Text;
model.nick_name = txtNickName.Text;
model.avatar = txtAvatar.Text;
model.sex = rblSex.SelectedValue;
DateTime _birthday;
if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
{
model.birthday = _birthday;
}
model.telphone = txtTelphone.Text.Trim();
model.mobile = txtMobile.Text.Trim();
model.qq = txtQQ.Text;
model.address = txtAddress.Text.Trim();
model.amount = decimal.Parse(txtAmount.Text.Trim());
model.point = int.Parse(txtPoint.Text.Trim());
model.exp = 0;// int.Parse(txtExp.Text.Trim());
model.reg_time = DateTime.Now;
model.reg_equ = txtRegEqu.Text.Trim();
model.guid_card = txtGuidCard.Text.Trim();
model.card = txtCard.Text.Trim();
model.age = int.Parse(txtAge.Text.Trim());
model.work_type = int.Parse(rblWorkType.SelectedValue);
model.description = Utils.ToHtml(txtContent.Text.Trim());
model.work_age = ddlWorkAge.SelectedValue.ToString();
if (bll.Add(model) < 1)
{
result = false;
}
return result;
}