本文整理汇总了C#中BLL.users.Update方法的典型用法代码示例。如果您正苦于以下问题:C# BLL.users.Update方法的具体用法?C# BLL.users.Update怎么用?C# BLL.users.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLL.users
的用法示例。
在下文中一共展示了BLL.users.Update方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnLogin_Click
protected void btnLogin_Click(object sender, EventArgs e)
{
BLL.users userService = new BLL.users();
string userName = txtUserName.Text.Trim();
string password = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(txtPassword.Text.Trim(), ConfigHelper.GetConfigString("PassWordEncrypt"));
//string password = txtPassword.Text.Trim();
DataTable userList = userService.GetList("userName='" + userName + "' and password='" + password + "' and roleId in (4,10,11)").Tables[0];
if (userList.Rows.Count > 0)
{
if (userList.Rows[0]["status"].ToString() == "0")
{
MessageBox.Show(this, "此用户名已被冻结,无法登陆!");
return;
}
//写入Cookie
try
{
Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_UserId, 2, userList.Rows[0]["userId"].ToString());
Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_UserName, 2, txtUserName.Text.Trim());
Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_TrueName, 2, DESEncrypt.Encrypt(userList.Rows[0]["trueName"].ToString()));
Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_RoleId, 2, userList.Rows[0]["roleId"].ToString());
Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_RoleName, 2, DESEncrypt.Encrypt(userList.Rows[0]["roleName"].ToString()));
Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_DeptId, 2, userList.Rows[0]["deptId"].ToString());
Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_IsAdmin, 2, userList.Rows[0]["isAdmin"].ToString());
Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_Avatar, 2, userList.Rows[0]["avatar_small"].ToString());
Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_LastLoginTime, 2, DateTime.Parse(userList.Rows[0]["lastLoginTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));
}
catch
{
//Session["userName"] = txtUserName.Text.Trim();
//Session["userType"] = ddrUserTyp.SelectedValue;
//Session["orgId"] = userList.Rows[0]["orgId"].ToString();
}
//更新最后登陆时间
Model.users userModel = userService.GetModel(int.Parse(userList.Rows[0]["userId"].ToString()));
userModel.lastLoginTime = DateTime.Now;
userService.Update(userModel);
Response.Redirect("index.aspx");
//MessageBox.ShowAndRedirect(this, "登录成功!", "index.html");
}
else
{
MessageBox.Show(this, "用户名或密码错误!");
}
}
示例2: user_repassword
private void user_repassword(HttpContext context)
{
string code = context.Request.Form["txtCode"];
string strcode = context.Request.Form["hideCode"];
string password = context.Request.Form["txtPassword"];
//校检验证码
string result = verify_code(context, code);
if (result != "success")
{
context.Response.Write(result);
return;
}
//检查验证字符串
if (string.IsNullOrEmpty(strcode))
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"系统找不到邮件验证的字符串!\"}");
return;
}
//检查输入的新密码
if (string.IsNullOrEmpty(password))
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"请输入您的新密码!\"}");
return;
}
BLL.user_code codeBll = new BLL.user_code();
Model.user_code codeModel = codeBll.GetModel(strcode);
if (codeModel == null)
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"邮件验证的字符串不存在或已过期!\"}");
return;
}
//验证用户是否存在
BLL.users userBll = new BLL.users();
if (!userBll.Exists(codeModel.user_id))
{
context.Response.Write("{\"msg\":0, \"msgbox\":\"该用户不存在或已被删除!\"}");
return;
}
Model.users userModel = userBll.GetModel(codeModel.user_id);
//执行修改操作
userModel.password = DESEncrypt.Encrypt(password);
userBll.Update(userModel);
//更改验证字符串状态
codeModel.count = 1;
codeModel.status = 1;
codeBll.Update(codeModel);
context.Response.Write("{\"msg\":1, \"msgbox\":\"修改密码成功,请记住您的新密码!\"}");
return;
}
示例3: DoEdit
private bool DoEdit(int _id)
{
bool result = false;
BLL.users bll = new BLL.users();
Model.users model = bll.GetModel(_id);
model.group_id = int.Parse(ddlGroupId.SelectedValue);
model.status = int.Parse(rblStatus.SelectedValue);
//判断密码是否更改
if (txtPassword.Text.Trim() != defaultpassword)
{
//获取用户已生成的salt作为密钥加密
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 = Utils.StrToDecimal(txtAmount.Text.Trim(), 0);
model.point = Utils.StrToInt(txtPoint.Text.Trim(), 0);
model.exp = Utils.StrToInt(txtExp.Text.Trim(), 0);
model.user_type = Convert.ToInt32(rb_user_type.SelectedValue);
model.province = Convert.ToInt32(ddl_province.SelectedValue);
model.city = Convert.ToInt32(ddl_city.SelectedValue);
model.district = Convert.ToInt32(ddl_district.SelectedValue);
if (bll.Update(model))
{
AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改用户信息:" + model.user_name); //记录日志
result = true;
}
return result;
}
示例4: user_info_edit
private void user_info_edit(HttpContext context)
{
//检查用户是否登录
Model.users model = new BasePage().GetUserInfo();
if (model == null)
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,用户尚未登录或已超时!\"}");
return;
}
string nick_name = Utils.ToHtml(DTRequest.GetFormString("txtNickName"));
string sex = DTRequest.GetFormString("rblSex");
string birthday = DTRequest.GetFormString("txtBirthday");
string email = Utils.ToHtml(DTRequest.GetFormString("txtEmail"));
string mobile = Utils.ToHtml(DTRequest.GetFormString("txtMobile"));
string telphone = Utils.ToHtml(DTRequest.GetFormString("txtTelphone"));
string qq = Utils.ToHtml(DTRequest.GetFormString("txtQQ"));
string msn = Utils.ToHtml(DTRequest.GetFormString("txtMsn"));
string province = Utils.ToHtml(DTRequest.GetFormString("txtProvince"));
string city = Utils.ToHtml(DTRequest.GetFormString("txtCity"));
string area = Utils.ToHtml(DTRequest.GetFormString("txtArea"));
string address = Utils.ToHtml(context.Request.Form["txtAddress"]);
//检查昵称
if (string.IsNullOrEmpty(nick_name))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入您的姓名昵称!\"}");
return;
}
//检查省市区
if (string.IsNullOrEmpty(province) || string.IsNullOrEmpty(city) || string.IsNullOrEmpty(area))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择您所在的省市区!\"}");
return;
}
BLL.users bll = new BLL.users();
//检查手机,如开启手机注册或使用手机登录需要检查
if (userConfig.regstatus == 2 || userConfig.mobilelogin == 1)
{
if (string.IsNullOrEmpty(mobile))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入您的手机号码!\"}");
return;
}
if (model.mobile != mobile && bll.ExistsMobile(mobile))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,该手机号码已被使用!\"}");
return;
}
}
//检查邮箱,如开启邮箱注册或使用邮箱登录需要检查
if (userConfig.regstatus == 3 || userConfig.emaillogin == 1)
{
if (string.IsNullOrEmpty(email))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入您的电子邮箱!\"}");
return;
}
if (model.email != email && bll.ExistsEmail(email))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,该电子邮箱已被使用!\"}");
return;
}
}
//开始写入数据库
model.nick_name = nick_name;
model.sex = sex;
DateTime _birthday;
if (DateTime.TryParse(birthday, out _birthday))
{
model.birthday = _birthday;
}
model.email = email;
model.mobile = mobile;
model.telphone = telphone;
model.qq = qq;
model.msn = msn;
model.area = province + "," + city + "," + area;
model.address = address;
bll.Update(model);
context.Response.Write("{\"status\":1, \"msg\":\"账户资料已修改成功!\"}");
return;
}
示例5: user_repassword
private void user_repassword(HttpContext context)
{
string strcode = DTRequest.GetFormString("hideCode"); //取回密码字符串
string password = DTRequest.GetFormString("txtPassword"); //重设后的密码
//检查验证字符串
if (string.IsNullOrEmpty(strcode))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,校检码字符串不能为空!\"}");
return;
}
//检查输入的新密码
if (string.IsNullOrEmpty(password))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入您的新密码!\"}");
return;
}
BLL.user_code codeBll = new BLL.user_code();
Model.user_code codeModel = codeBll.GetModel(strcode);
if (codeModel == null)
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,校检码不存在或已过期!\"}");
return;
}
//验证用户是否存在
BLL.users userBll = new BLL.users();
if (!userBll.Exists(codeModel.user_id))
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,该用户不存在或已被删除!\"}");
return;
}
Model.users userModel = userBll.GetModel(codeModel.user_id);
//执行修改操作
userModel.password = DESEncrypt.Encrypt(password, userModel.salt);
userBll.Update(userModel);
//更改验证字符串状态
codeModel.count = 1;
codeModel.status = 1;
codeBll.Update(codeModel);
context.Response.Write("{\"status\":1, \"msg\":\"修改密码成功,请记住新密码!\"}");
return;
}
示例6: DoEdit
private bool DoEdit(int _id)
{
bool result = true;
BLL.users bll = new BLL.users();
Model.users model = bll.GetModel(_id);
model.group_id = int.Parse(ddlGroupId.SelectedValue);
model.is_lock = int.Parse(rblIsLock.SelectedValue);
if (txtPassword.Text.Trim() != model.password)
{
model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim());
}
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());
if (!bll.Update(model))
{
result = false;
}
return result;
}
示例7: user_status
private void user_status(HttpContext context)
{
int id = DTRequest.GetQueryInt("id");
int status = DTRequest.GetQueryInt("status");
BLL.users bll = new BLL.users();
Model.users model = bll.GetModel(id);
Model.users users = new BasePage().GetUserInfo();
if (users == null)
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,请重新登录!\"}");
return;
}
model.status = status;
if (bll.Update(model))
{
context.Response.Write("{\"status\":1, \"msg\":\"用户状态更改!\"}");
return;
}
}
示例8: save_user_info
private void save_user_info(HttpContext context)
{
string nick_name = DTRequest.GetFormString("nick_name");
string email = DTRequest.GetFormString("email");
string mobile = DTRequest.GetFormString("mobile");
string sex = DTRequest.GetFormString("sex");
string txtBirthday = DTRequest.GetFormString("txtBirthday");
int province = DTRequest.GetFormInt("province");
int city = DTRequest.GetFormInt("city");
int district = DTRequest.GetFormInt("district");
string address = DTRequest.GetFormString("address");
string purchase = DTRequest.GetFormString("purchase");
string purchase_mobile = DTRequest.GetFormString("purchase_mobile");
Model.users model = new BasePage().GetUserInfo();
if (model == null)
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,请重新登录!\"}");
return;
}
BLL.users bll = new BLL.users();
model.nick_name = nick_name;
model.email = email;
model.mobile = mobile;
if (!string.IsNullOrEmpty(sex))
{
model.sex = sex;
}
else
{
model.sex = "保密";
}
if (!string.IsNullOrEmpty(txtBirthday))
{
model.birthday = Convert.ToDateTime(txtBirthday);
}
model.province = province;
model.city = city;
model.district = district;
model.address = address;
model.purchase = purchase;
model.purchase_mobile = purchase_mobile;
if (bll.Update(model))
{
BLL.address bll_address = new BLL.address();
if (bll_address.GetList("user_id=" + model.id).Tables[0].Rows.Count <= 0)
{
Model.address model_address = new Model.address();
if (model.user_type == 2)
{
model_address.consignee = purchase;
model_address.consignee_mobile = purchase_mobile;
}
else
{
model_address.consignee = nick_name;
model_address.consignee_mobile = mobile;
}
model_address.user_id = model.id;
model_address.province = model.province;
model_address.city = model.city;
model_address.distract = model.district;
model_address.content = model.address;
model_address.add_time = DateTime.Now;
bll_address.Add(model_address);
}
context.Response.Write("{\"status\":1, \"msg\":\"保存成功!\"}");
return;
}
else
{
context.Response.Write("{\"status\":0, \"msg\":\"保存失败!\"}");
return;
}
}
示例9: edit_userpsd
private void edit_userpsd(HttpContext context)
{
string oldpsd = DTRequest.GetString("oldpsd");
string newpsd = DTRequest.GetString("newpsd");
BLL.users user_bll = new BLL.users();
Model.users user_model = new BasePage().GetUserInfo();
if (user_model == null)
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起请重新登录!\"}");
return;
}
string psd = DESEncrypt.Encrypt(oldpsd, user_model.salt);
if (user_model.password != psd)
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起您输入的旧密码错误,请重新操作!\"}");
return;
}
string newpsds = DESEncrypt.Encrypt(newpsd, user_model.salt);
user_model.password = newpsds;
if (user_bll.Update(user_model))
{
context.Response.Write("{\"status\":1, \"msg\":\"更改密码成功!\"}");
return;
}
}
示例10: edit_dealing_users
/// <summary>
/// 分配账户修改资料
/// </summary>
/// <param name="context"></param>
private void edit_dealing_users(HttpContext context)
{
int id = DTRequest.GetQueryInt("id");
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");
BLL.users bll = new BLL.users();
Model.users model1 = new BasePage().GetUserInfo();
if (model1 == null)
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,请重新登录!\"}");
return;
}
Model.users model = bll.GetModel(id);
string psd = DESEncrypt.Encrypt(password, model1.salt);
model.password = psd;
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.Update(model))
{
context.Response.Write("{\"status\":1, \"msg\":\"修改员工资料成功!\"}");
return;
}
else
{
context.Response.Write("{\"status\":0, \"msg\":\"对不起,修改员工资料失败!\"}");
return;
}
}
示例11: DoEdit
private bool DoEdit(int _id)
{
bool result = true;
BLL.users bll = new BLL.users();
Model.users model = bll.GetModel(_id);
model.group_id = int.Parse(ddlGroupId.SelectedValue);
model.is_lock = int.Parse(rblIsLock.SelectedValue);
if (txtPassword.Text.Trim() != model.password)
{
model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim());
}
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_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.Update(model))
{
result = false;
}
return result;
}