private void InitializeComponent() { if (!Page.IsPostBack) { if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); if (Session["UserInfo"] == null) { Maticsoft.Accounts.Bus.User currentUser = new Maticsoft.Accounts.Bus.User(user); Session["UserInfo"] = currentUser; Session["Style"] = currentUser.Style; Response.Write("<script defer>location.reload();</script>"); } if ((PermissionID != -1) && (!user.HasPermissionID(PermissionID))) { Response.Clear(); Response.Write("<script defer>window.alert('You do not have permission to access this page!\\n Please login again or contact your administrator');history.back();</script>"); Response.End(); } } else { string defaullogin = Maticsoft.Common.ConfigHelper.GetConfigString("defaulloginadmin"); FormsAuthentication.SignOut(); Session.Clear(); Session.Abandon(); Response.Clear(); Response.Write("<script defer>window.alert('You do not have permission to access this page or session expired!\\n Please login again or contact your administrator!');parent.location='" + defaullogin + "';</script>"); Response.End(); } } }
protected virtual bool InitializeComponent(ActionExecutingContext filterContext) { if (base.HttpContext.User.Identity.IsAuthenticated) { try { this.userPrincipal = new AccountsPrincipal(base.HttpContext.User.Identity.Name); } catch (IdentityNotMappedException) { FormsAuthentication.SignOut(); base.Session.Remove(Globals.SESSIONKEY_USER); base.Session.Clear(); base.Session.Abandon(); return false; } if (base.Session[Globals.SESSIONKEY_USER] == null) { this.currentUser = new User(this.userPrincipal); base.Session[Globals.SESSIONKEY_USER] = this.currentUser; base.Session["Style"] = this.currentUser.Style; } else { this.currentUser = (User) base.Session[Globals.SESSIONKEY_USER]; base.Session["Style"] = this.currentUser.Style; ((dynamic) base.ViewBag).UserType = this.currentUser.UserType; } ((dynamic) base.ViewBag).CurrentUid = this.currentUser.UserID; } return true; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new Maticsoft.Accounts.Bus.User(user); this.lblName.Text = currentUser.UserName; this.lblTruename.Text = currentUser.TrueName; //this.lblSex.Text = currentUser.Sex.Trim() == "1" ? Resources.Site.fieldSexM : Resources.Site.fieldSexF; //this.lblPhone.Text = currentUser.Phone; this.lblEmail.Text = currentUser.Email; lblUserIP.Text = Request.UserHostAddress; //switch(currentUser.Style) //{ // case 1: // this.lblStyle.Text = "DefaultBlue"; // break; // case 2: // this.lblStyle.Text = "Olive"; // break; // case 3: // this.lblStyle.Text = "Red"; // break; // case 4: // this.lblStyle.Text = "Green"; // break; //} } } }
public ActionResult AjaxLogin(string UserName, string UserPwd) { if (Maticsoft.BLL.SysManage.ConfigSystem.GetBoolValueByCache("System_Close_Login")) { return base.Content("-1"); } if (!base.ModelState.IsValid) { return base.Content("0"); } AccountsPrincipal existingPrincipal = AccountsPrincipal.ValidateLogin(UserName, UserPwd); if (existingPrincipal == null) { return base.Content("0"); } User user = new User(existingPrincipal); if (!user.Activity) { base.ModelState.AddModelError("Message", "对不起,该帐号已被冻结,请联系管理员!"); } base.HttpContext.User = existingPrincipal; FormsAuthentication.SetAuthCookie(UserName, true); base.Session[Globals.SESSIONKEY_USER] = user; int num = new Maticsoft.BLL.Members.PointsDetail().AddPoints("Login", user.UserID, "登录操作", ""); return base.Content("1|" + num.ToString()); }
protected void btnSubmit_Click(object sender, EventArgs e) { this.btnSubmit.Enabled = false; User useModel = new User(); string UserName = this.txtUserName.Value; string Email = this.txtMail.Value; string pwd = this.txtConfirm.Value; useModel.UserName = UserName; useModel.TrueName = UserName; useModel.Password = AccountsPrincipal.EncryptPassword(pwd); useModel.Email = Email; useModel.Activity = true; useModel.UserType = "UU"; useModel.User_dateCreate = DateTime.Now; int userid = useModel.Create(); if (userid > 0) { useModel.UserID = userid; FormsAuthentication.SetAuthCookie(UserName, false); Session["UserInfo"] = useModel; Session["Regsuccess"] = true; //查询用户购买的所有的章节ID,存储在Session里面。 BLL.Tao.OrderItemHistory OrderItemHistoryBLL = new BLL.Tao.OrderItemHistory(); Session["ModuleIDList"] = OrderItemHistoryBLL.GetIDList(userid); Response.Redirect("NRegsuccess.aspx"); } else { Common.MessageBox.ShowFailTip(this, "系统忙,请稍后再试"); return; } }
//private void BindRoles(AccountsPrincipal user) //{ // if (user.Permissions.Count > 0) // { // RoleList.Visible = true; // ArrayList Permissions = user.Permissions; // RoleList.Text = "权限列表:<ul>"; // for (int i = 0; i < Permissions.Count; i++) // { // RoleList.Text += "<li>" + Permissions[i] + "</li>"; // } // RoleList.Text += "</ul>"; // } //} protected void btnSave_Click(object sender, System.EventArgs e) { if (Page.IsValid) { string username = this.lblName.Text.Trim(); AccountsPrincipal user = new AccountsPrincipal(username); User currentUser = new Maticsoft.Accounts.Bus.User(user); currentUser.UserName = username; currentUser.TrueName = txtTrueName.Text.Trim(); //if (RadioButton1.Checked) // currentUser.Sex = "1"; //else // currentUser.Sex = "0"; //currentUser.Phone = this.txtPhone.Text.Trim(); currentUser.Email = txtEmail.Text.Trim(); //currentUser.UserType = dropUserType.SelectedValue; //int style = int.Parse(this.dropStyle.SelectedValue); //currentUser.Style = style; if (!currentUser.Update()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = Resources.Site.TooltipUpdateError; } else { this.lblMsg.ForeColor = Color.Blue; this.lblMsg.Text = Resources.Site.TooltipSaveOK; } } }
public string GetUserName(object target) { string str = string.Empty; if (!StringPlus.IsNullOrEmpty(target)) { User user = new User(Globals.SafeInt(target, 0)); str = (user == null) ? "" : user.NickName; } return str; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new Maticsoft.Accounts.Bus.User(user); this.lblName.Text = currentUser.UserName; } } }
public static bool PayForOrder(OrderInfo orderInfo, User currentUser = new User()) { if ((orderInfo.OrderItems == null) || (orderInfo.OrderItems.Count < 1)) { orderInfo = orderManage.GetModelInfoByCache(orderInfo.OrderId); } if (orderInfo.HasChildren && (orderInfo.SubOrders.Count < 1)) { orderInfo.SubOrders = orderManage.GetModelList(" ParentOrderId=" + orderInfo.OrderId); } return service.PayForOrder(orderInfo, currentUser); }
private User GetBuyerUserInfo(HttpContext context) { if (!context.User.Identity.IsAuthenticated) { return null; } if (context.Session[Globals.SESSIONKEY_USER] == null) { User user = new User(new AccountsPrincipal(context.User.Identity.Name)); context.Session[Globals.SESSIONKEY_USER] = user; return user; } return (User) context.Session[Globals.SESSIONKEY_USER]; }
public bool CancelOrder(OrderInfo orderInfo, User currentUser = new User()) { List<CommandInfo> cmdList = new List<CommandInfo>(); if ((orderInfo.OrderItems != null) && (orderInfo.OrderItems.Count > 0)) { foreach (Maticsoft.Model.Shop.Order.OrderItems items in orderInfo.OrderItems) { StringBuilder builder = new StringBuilder(); builder.Append("update Shop_SKUs set Stock=Stock+@Stock"); builder.Append(" where SKU=@SKU"); SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@SKU", SqlDbType.NVarChar, 50), new SqlParameter("@Stock", SqlDbType.Int, 4) }; parameterArray[0].Value = items.SKU; parameterArray[1].Value = items.Quantity; cmdList.Add(new CommandInfo(builder.ToString(), parameterArray)); } } StringBuilder builder2 = new StringBuilder(); builder2.Append("UPDATE Shop_Orders SET OrderStatus=-1, UpdatedDate=@UpdatedDate"); builder2.Append(" where OrderId=@OrderId OR ParentOrderId=@OrderId"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@OrderId", SqlDbType.BigInt, 8), new SqlParameter("@UpdatedDate", SqlDbType.DateTime) }; para[0].Value = orderInfo.OrderId; para[1].Value = DateTime.Now; CommandInfo item = new CommandInfo(builder2.ToString(), para, EffentNextType.ExcuteEffectRows); cmdList.Add(item); StringBuilder builder3 = new StringBuilder(); builder3.Append("insert into Shop_OrderAction("); builder3.Append("OrderId,OrderCode,UserId,Username,ActionCode,ActionDate,Remark)"); builder3.Append(" values ("); builder3.Append("@OrderId,@OrderCode,@UserId,@Username,@ActionCode,@ActionDate,@Remark)"); SqlParameter[] parameterArray3 = new SqlParameter[] { new SqlParameter("@OrderId", SqlDbType.BigInt, 8), new SqlParameter("@OrderCode", SqlDbType.NVarChar, 50), new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@Username", SqlDbType.NVarChar, 200), new SqlParameter("@ActionCode", SqlDbType.NVarChar, 100), new SqlParameter("@ActionDate", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.NVarChar, 0x3e8) }; parameterArray3[0].Value = orderInfo.OrderId; parameterArray3[1].Value = orderInfo.OrderCode; parameterArray3[2].Value = (currentUser != null) ? currentUser.UserID : orderInfo.BuyerID; parameterArray3[3].Value = (currentUser != null) ? currentUser.NickName : orderInfo.BuyerName; parameterArray3[4].Value = 0x65; parameterArray3[5].Value = DateTime.Now; if ((currentUser != null) && (currentUser.UserType == "AA")) { parameterArray3[6].Value = "管理员取消订单"; } else { parameterArray3[6].Value = "取消订单"; } item = new CommandInfo(builder3.ToString(), parameterArray3, EffentNextType.ExcuteEffectRows); cmdList.Add(item); return (DbHelperSQL.ExecuteSqlTran(cmdList) > 0); }
protected void btnLogin_Click(object sender, EventArgs e) { string UserName = this.txtName.Value; string UserPwd = this.txtPwd.Value; byte[] encPassword = AccountsPrincipal.EncryptPassword(UserPwd); AccountsPrincipal newUser = AccountsPrincipal.ValidateLogin(UserName, UserPwd); if (newUser != null) { CurrentUser = new Maticsoft.Accounts.Bus.User(newUser); Context.User = newUser; if (!CurrentUser.Activity) { Maticsoft.Common.MessageBox.ShowFailTip(this, "对不起,该帐号已被冻结,请联系管理员!"); return; } if (CurrentUser.UserType != "UU") { Maticsoft.Common.MessageBox.ShowFailTip(this, "管理员不能从此处进入!"); return; } FormsAuthentication.SetAuthCookie(UserName, false); LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, "登录成功", this); Session["UserInfo"] = CurrentUser; //查询用户购买的所有的章节ID,存储在Session里面。 Session["ModuleIDList"] = OrderItemHistoryBLL.GetIDList(CurrentUser.UserID); HttpCookie cuser = new HttpCookie("TaoUser"); cuser.Value = UserName; cuser.Expires = DateTime.Now.AddYears(10); Response.Cookies.Add(cuser); if (chkAutoLogin.Checked) { HttpCookie cpwd = new HttpCookie("TaoPwd"); cpwd.Value = Encrypt(UserPwd); cpwd.Expires = DateTime.Now.AddYears(10); Response.Cookies.Add(cpwd); } GoPage(); } else { Maticsoft.Common.MessageBox.ShowFailTip(this, "用户名或密码错误!"); LogHelp.AddUserLog(UserName, "", "登录失败!", this); } }
private void ShowInfo(int ID) { AccountsPrincipal existingPrincipal = new AccountsPrincipal(ID); User user = new User(existingPrincipal); UsersExpModel usersExpModel = new UsersExp().GetUsersExpModel(ID); if ((user != null) && (usersExpModel != null)) { this.lblUserName.Text = user.UserName; this.lblTrueName.Text = user.TrueName; this.lblPhone.Text = user.Phone; this.lblNickName.Text = user.NickName; this.lblEmail.Text = user.Email; this.lblAblums.Text = usersExpModel.AblumsCount.ToString(); this.lblFans.Text = usersExpModel.FansCount.ToString(); this.lblFav.Text = usersExpModel.FavouritesCount.ToString(); this.lblFellows.Text = usersExpModel.FellowCount.ToString(); this.lblProducts.Text = usersExpModel.ProductsCount.ToString(); this.lblSex.Text = (!string.IsNullOrWhiteSpace(user.Sex) && (user.Sex.Trim() == "0")) ? "女" : "男"; this.lblActivity.Text = user.Activity ? "正常使用" : "已经冻结"; this.lblCreTime.Text = user.User_dateCreate.ToString("yyyy-MM-dd HH:mm:ss"); } if (usersExpModel != null) { Regions regions = new Regions(); this.imageGra.ImageUrl = string.Format("/Upload/User/Gravatar/{0}.jpg", usersExpModel.UserID); string regionNameByRID = regions.GetRegionNameByRID(Globals.SafeInt(usersExpModel.Address, 0)); if (regionNameByRID.Contains("北京北京")) { regionNameByRID = regionNameByRID.Replace("北京北京", "北京"); } else if (regionNameByRID.Contains("上海上海")) { regionNameByRID = regionNameByRID.Replace("上海上海", "上海"); } else if (regionNameByRID.Contains("重庆重庆")) { regionNameByRID = regionNameByRID.Replace("重庆重庆", "重庆"); } else if (regionNameByRID.Contains("天津天津")) { regionNameByRID = regionNameByRID.Replace("天津天津", "天津"); } this.lblAddress.Text = string.IsNullOrEmpty(usersExpModel.Address) ? "暂未设置" : regionNameByRID; this.lblPoints.Text = usersExpModel.Points.ToString(); this.lblLoginDate.Text = usersExpModel.LastLoginTime.ToString("yyyy-MM-dd HH:mm:ss"); } }
public void btnSave_Click(object sender, EventArgs e) { int selectedUserId = this.SelectedUserId; User user = new User(selectedUserId); foreach (ListItem item in this.cblRole.Items) { int roleID = Globals.SafeInt(item.Value, -1); if (item.Selected) { user.AddAssignRole(selectedUserId, roleID); } else { user.DeleteAssignRole(selectedUserId, roleID); } } }
public void btnSave_Click(object sender, EventArgs e) { User user = new User(Convert.ToInt32(this.lblUserID.Text)); foreach (ListItem item in this.CheckBoxList1.Items) { if (item.Selected) { user.AddToRole(Convert.ToInt32(item.Value)); } else { user.RemoveRole(Convert.ToInt32(item.Value)); } } LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, string.Format("编辑用户【{0}】的权限", user.UserName), this); base.Response.Redirect("UserAdmin.aspx?PageIndex=" + base.Request.Params["PageIndex"]); }
//public string userid = ""; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { User currentUser; if ((Request.Params["userid"] != null) && (Request.Params["userid"].ToString() != "")) { int userid = int.Parse(Request["userid"]); currentUser = new User(userid); if (currentUser == null) { Response.Write("<script language=javascript>window.alert('"+Resources.Site.TooltipUserExist+"\\');history.back();</script>"); return; } this.lblName.Text = currentUser.UserName; txtTrueName.Text = currentUser.TrueName; //if (currentUser.Sex != null) //{ // if (currentUser.Sex.Trim().ToUpper() == "1") // RadioButton1.Checked = true; // else // RadioButton2.Checked = true; //} this.txtPhone.Text = currentUser.Phone; txtEmail.Text = currentUser.Email; if (currentUser.EmployeeID > 0) { txtEmployeeID.Text = currentUser.EmployeeID.ToString(); } dropUserType.SelectedValue = currentUser.UserType; chkActive.Checked = !currentUser.Activity; //for(int i=0;i<this.Dropdepart.Items.Count;i++) //{ // if(this.Dropdepart.Items[i].Value==currentUser.DepartmentID) // { // this.Dropdepart.Items[i].Selected=true; // } //} //this.dropStyle.SelectedIndex = currentUser.Style - 1; //AccountsPrincipal user = new AccountsPrincipal(userid); //BindRoles(user); } } }
public void btnSave_Click(object sender, System.EventArgs e) { User newUser = new User(); string strErr = ""; if (newUser.HasUser(txtUserName.Text)) { strErr += Resources.Site.TooltipUserExist; } if (strErr != "") { Maticsoft.Common.MessageBox.Show(this, strErr); return; } newUser.UserName = txtUserName.Text; newUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text); newUser.TrueName = txtTrueName.Text; newUser.Sex = "1"; //if (RadioButton1.Checked) // newUser.Sex = "1";//男 //else // newUser.Sex = "0";//女 newUser.Phone = txtPhone.Text.Trim(); newUser.Email = txtEmail.Text; newUser.EmployeeID = 0; //newUser.DepartmentID=this.Dropdepart.SelectedValue; newUser.Activity = true; newUser.UserType = dropUserType.SelectedValue; newUser.Style = 1; newUser.User_dateCreate = DateTime.Now; newUser.User_iCreator = CurrentUser.UserID; newUser.User_dateValid = DateTime.Now; newUser.User_cLang = "zh-CN"; int userid = newUser.Create(); if (userid == -100) { this.lblMsg.Text = Resources.Site.TooltipUserExist; this.lblMsg.Visible = true; } else { Response.Redirect("RoleAssignment.aspx?UserID=" + userid); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new Maticsoft.Accounts.Bus.User(user); this.lblName.Text = currentUser.UserName; txtTrueName.Text = currentUser.TrueName; //if (currentUser.Sex.Trim().ToUpper() == "1") // RadioButton1.Checked = true; //else // RadioButton2.Checked = true; //this.txtPhone.Text = currentUser.Phone; txtEmail.Text = currentUser.Email; // for(int i=0;i<this.Dropdepart.Items.Count;i++) // { // if(this.Dropdepart.Items[i].Value==currentUser.DepartmentID) // { // this.Dropdepart.Items[i].Selected=true; // } // } //for (int i = 0; i < this.dropUserType.Items.Count; i++) //{ // if (this.dropUserType.Items[i].Value == currentUser.UserType) // { // this.dropUserType.Items[i].Selected = true; // } //} //this.dropStyle.SelectedIndex = currentUser.Style - 1; // BindRoles(user); } } }
protected void btnSave_Click(object sender, System.EventArgs e) { string username = this.lblName.Text.Trim(); AccountsPrincipal user = new AccountsPrincipal(username); User currentUser = new Maticsoft.Accounts.Bus.User(user); currentUser.UserName = username; currentUser.TrueName = txtTrueName.Text.Trim(); if (txtPassword.Text.Trim() != "") { currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text); } //if (RadioButton1.Checked) // currentUser.Sex = "1"; //else // currentUser.Sex = "0"; currentUser.UserType = dropUserType.SelectedValue; currentUser.Phone = this.txtPhone.Text.Trim(); currentUser.Email = txtEmail.Text.Trim(); if (txtEmployeeID.Text.Length > 0) { currentUser.EmployeeID = Convert.ToInt32(txtEmployeeID.Text); } else { currentUser.EmployeeID = -1; } currentUser.Activity = !chkActive.Checked; //int style = int.Parse(this.dropStyle.SelectedValue); //currentUser.Style = style; if (!currentUser.Update()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = Resources.Site.TooltipUpdateError; } else { Response.Redirect("useradmin.aspx"); } }
public void BindData() { DataSet ds = new DataSet(); string usertype = DropUserType.SelectedValue; string keyword = ""; if (txtKeyword.Text.Trim() != "") { keyword = txtKeyword.Text.Trim(); } User userAdmin = new User(); if (usertype != "") { ds = userAdmin.GetUsersByType(usertype, keyword); } else { ds = userAdmin.GetUserList(keyword); } gridView.DataSetSource = ds; }
public void btnSave_Click(object sender, System.EventArgs e) { if (Page.IsValid) { SiteIdentity SID = new SiteIdentity(User.Identity.Name); if (SID.TestPassword(txtOldPassword.Text) == 0) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "原密码输入错误!"; } else if (this.txtPassword.Text.Trim() != this.txtPassword1.Text.Trim()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "密码输入的不一致!请重试!"; } else { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new Maticsoft.Accounts.Bus.User(user); currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text); if (!currentUser.Update()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = Resources.Site.TooltipUpdateError; //日志 //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新失败"); } else { this.lblMsg.ForeColor = Color.Blue; this.lblMsg.Text = Resources.Site.TooltipSaveOK; //日志 //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新成功"); } } } }
protected void btnSave_Click(object sender, EventArgs e) { User currentUser; if (Session["UserInfo"] != null) { currentUser = (User)Session["UserInfo"]; } else { return; } int count = listboxSysManage.Items.Count; for (int i = 0; i < count; i++) { int NodeID = Convert.ToInt32(listboxSysManage.Items[i].Value); int OrderID = i + 1; sm.UpDate(OrderID,currentUser.UserID,NodeID); } Maticsoft.Common.MessageBox.Show(this, Resources.Site.TooltipSaveOK); }
public void Page_Load(object sender, EventArgs e) { if ((!this.Page.IsPostBack && (base.Request.Params["UserID"] != null)) && (base.Request.Params["UserID"] != "")) { string str = base.Request.Params["UserID"]; this.lblUserID.Text = str; User user = new User(Convert.ToInt32(str)); DataSet roleList = AccountsTool.GetRoleList(); this.CheckBoxList1.DataSource = roleList.Tables[0].DefaultView; this.CheckBoxList1.DataTextField = "Description"; this.CheckBoxList1.DataValueField = "RoleID"; this.CheckBoxList1.DataBind(); AccountsPrincipal principal = new AccountsPrincipal(user.UserName); if (principal.Roles.Count > 0) { ArrayList roles = principal.Roles; for (int i = 0; i < roles.Count; i++) { foreach (ListItem item in this.CheckBoxList1.Items) { if (item.Text == roles[i].ToString()) { item.Selected = true; } } } } if (!base.UserPrincipal.HasPermissionID(base.GetPermidByActID(this.Act_ShowReservedRole))) { for (int j = 0; j < this.CheckBoxList1.Items.Count; j++) { if (this.ReservedRoleIDs.Contains(this.CheckBoxList1.Items[j].Value)) { this.CheckBoxList1.Items.Remove(this.CheckBoxList1.Items[j]); } } } } }
protected void btnSubmit_Click(object sender, EventArgs e) { //检测旧密码是否争取 string uInput = this.txtOldpws.Value.Trim(); AccountsPrincipal newUser = AccountsPrincipal.ValidateLogin(CurrentUser.UserName, uInput); if (newUser == null) { Common.MessageBox.ShowFailTip(this, "旧密码错误,请重新输入!"); return; } string NewPwd = this.txtSurePwd.Value; AccountsPrincipal APUser = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new Maticsoft.Accounts.Bus.User(APUser); currentUser.Password = AccountsPrincipal.EncryptPassword(NewPwd); if (!currentUser.Update()) { Maticsoft.Common.MessageBox.ShowFailTip(this, "'系统忙,请稍后再试!"); return; } else { Maticsoft.Common.MessageBox.ShowSuccessTip(this, "密码修改成功!下次登录生效!"); } }
public void UpdateUserInfo(FormCollection collection) { JsonObject obj2 = new JsonObject(); UsersExpModel usersModel = this.userEXBll.GetUsersModel(base.CurrentUser.UserID); usersModel.TelPhone = collection["TelPhone"]; string str = collection["Birthday"]; if (!string.IsNullOrWhiteSpace(str) && PageValidate.IsDateTime(str)) { usersModel.Birthday = new DateTime?(Globals.SafeDateTime(str, DateTime.Now)); } else { usersModel.Birthday = null; } usersModel.Constellation = collection["Constellation"]; usersModel.PersonalStatus = collection["PersonalStatus"]; usersModel.Singature = collection["Singature"]; usersModel.Address = collection["Address"]; User user = new User(base.CurrentUser.UserID) { Sex = collection["Sex"], Email = collection["Email"], NickName = collection["NickName"], Phone = collection["Phone"] }; if (user.Update() && this.userEXBll.UpdateUsersExp(usersModel)) { obj2.Accumulate("STATUS", "SUCC"); } else { obj2.Accumulate("STATUS", "FAIL"); } base.Response.Write(obj2.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (CurrentUser != null) { GoPage(); } else { if (Request.Cookies["TaoUser"] != null && Request.Cookies["TaoPwd"] != null) { string UserName = Request.Cookies["TaoUser"].Value; string Pwd = Request.Cookies["TaoPwd"].Value; if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(Pwd)) { return; } string DecPwd = Common.DEncrypt.DESEncrypt.Decrypt(Common.DEncrypt.DESEncrypt.Decrypt(Pwd.Remove(0, 2)).Remove(0, 2)); AccountsPrincipal newUser = AccountsPrincipal.ValidateLogin(UserName, DecPwd); if (newUser != null) { CurrentUser = new Maticsoft.Accounts.Bus.User(newUser); Session["UserInfo"] = CurrentUser; //查询用户购买的所有的章节ID,存储在Session里面 Session["ModuleIDList"] = OrderItemHistoryBLL.GetIDList(CurrentUser.UserID); FormsAuthentication.SetAuthCookie(CurrentUser.UserName, false); GoPage(); } } } }
public UsersExpModel GetUsersModel(int UserID) { UsersExpModel model = this.dal.GetModel(UserID); if (model == null) { model = new UsersExpModel(); } User user = new User(UserID); model.Activity = user.Activity; model.DepartmentID = user.DepartmentID; model.Email = user.Email; model.EmployeeID = user.EmployeeID; model.Phone = user.Phone; if (user.Sex != null) { model.Sex = user.Sex.Trim(); } model.Style = user.Style; model.TrueName = user.TrueName; model.NickName = user.NickName; model.User_cLang = user.User_cLang; model.User_dateApprove = user.User_dateApprove; model.User_dateCreate = user.User_dateCreate; model.User_dateExpire = user.User_dateExpire; model.User_dateValid = user.User_dateValid; model.User_iApprover = user.User_iApprover; model.User_iApproveState = user.User_iApproveState; model.User_iCreator = user.User_iCreator; model.UserID = user.UserID; model.UserName = user.UserName; model.UserType = user.UserType; return model; }
protected void gridView_RowDeleting(object sender, GridViewDeleteEventArgs e) { string ID = gridView.DataKeys[e.RowIndex].Value.ToString(); List<string> UserIDlist = Maticsoft.Common.StringPlus.GetStrArray(BLL.SysManage.ConfigSystem.GetValueByCache("AdminUserID"), ',', true); if (UserIDlist.Contains(ID)) { Maticsoft.Common.MessageBox.Show(this, "系统管理保留帐号,不能删除"); return; } try { User User2 = new User(int.Parse(ID)); User2.Delete(); gridView.OnBind(); } catch (System.Data.SqlClient.SqlException ex) { if (ex.Number == 547) { Maticsoft.Common.MessageBox.Show(this, "该用户已被其他数据引用,不能删除!"); } } }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtIntroduction.Text.Trim().Length == 0) { strErr += "企业介绍不能为空!\\n"; } if (!PageValidate.IsDateTime(txtEstablishedDate.Text)) { strErr += "成立时间格式错误!\\n"; } if (string.IsNullOrEmpty(hfRegionID.Value)) { strErr += "请选择省/市!\\n"; } User newUser = new User(); if (newUser.HasUser(this.txtUserName.Text)) { strErr += Resources.Site.TooltipUserExist; } if (strErr != "") { MessageBox.Show(this, strErr); return; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int EnterpriseID = 0; try { Maticsoft.Model.Tao.Enterprise model = new Maticsoft.Model.Tao.Enterprise(); model.Name = this.txtName.Text; model.Introduction = this.txtIntroduction.Text; model.RegisteredCapital = 0;//this.txtRegisteredCapital.Text; model.TelPhone = this.txtTelPhone.Text; model.CellPhone = this.txtCellPhone.Text; model.ContactMail = this.txtContactMail.Text; model.RegionID = Convert.ToInt32(this.hfRegionID.Value); model.Address = this.txtAddress.Text; model.Remark = this.txtRemark.Text; model.Contact = this.txtContact.Text; model.UserName = this.txtUserName.Text; model.EstablishedDate = Convert.ToDateTime(this.txtEstablishedDate.Text); model.EstablishedCity = 0;// this.txtEstablishedCity.Text; model.LOGO = UploadImage(FileUploadLogo, 2); model.Fax = this.txtFax.Text; model.PostCode = this.txtPostCode.Text; model.HomePage = this.txtHomePage.Text; model.ArtiPerson = this.txtArtiPerson.Text; model.EnteRank = 0;// this.txtEnteRank.Text; model.EnteClassID = 0;// this.txtEnteClassID.Text; model.CompanyType = int.Parse(this.ddlCompanyType.Text); model.BusinessLicense = UploadImage(FileUploadBusinessLicense, 2); model.TaxNumber = this.txtTaxNumber.Text; model.AccountBank = this.txtAccountBank.Text; model.AccountInfo = this.txtAccountInfo.Text; model.ServicePhone = this.txtServicePhone.Text; model.QQ = this.txtQQ.Text; model.MSN = this.txtMSN.Text; model.Status = Convert.ToInt32(this.ddlStatus.SelectedValue); model.CreatedDate = System.DateTime.Now; model.CreatedUserID = CurrentUser.UserID; model.UpdatedDate = System.DateTime.Now; model.UpdatedUserID = CurrentUser.UserID; model.AgentID = 0; EnterpriseID = bll.Add(model); newUser.UserName = txtUserName.Text; newUser.Password = AccountsPrincipal.EncryptPassword("111111"); newUser.TrueName = ""; newUser.Sex = "1"; newUser.Phone = this.txtCellPhone.Text; newUser.Email = this.txtContactMail.Text; newUser.EmployeeID = 0; newUser.DepartmentID = EnterpriseID.ToString(); newUser.Activity = true; newUser.UserType = "UU"; newUser.Style = 1; newUser.User_dateCreate = System.DateTime.Now; newUser.User_iCreator = CurrentUser.UserID; newUser.User_dateValid = DateTime.Now; newUser.User_cLang = "zh-CN"; int userid = newUser.Create(); if (userid == -100) { Maticsoft.Common.MessageBox.Show(this, Resources.Site.TooltipUserExist); } else { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "List.aspx"); } } catch (Exception ex) { //若创建用户失败则删除创建的企业编号。 bll.Delete(EnterpriseID); throw ex; } finally { } }
private void ShowInfo() { Maticsoft.Model.Shop.Inquiry.InquiryInfo model = this.infoBll.GetModel((long) this.InquiryId); if (model != null) { this.lblTitle.Text = "正在查看询盘的详细信息"; User user = new User(model.UpdatedUserId); this.lblAddress.Text = this.regionBll.GetFullNameById4Cache(model.RegionId) + model.Address; this.lblCellPhone.Text = model.CellPhone; this.lblDate.Text = model.CreatedDate.ToString("yyyy-MM-dd"); this.lblEmail.Text = model.Email; this.lblTelephone.Text = model.Telephone; this.lblUserName.Text = model.UserName; this.lblCompany.Text = model.Company; this.txtAmount.Text = model.Amount.ToString(); this.txtLeaveMsg.Text = model.LeaveMsg; this.txtReplyMsg.Text = model.ReplyMsg; this.lblUpdateDate.Text = model.UpdatedDate.HasValue ? model.UpdatedDate.Value.ToString("yyyy-MM-dd") : ""; this.lblUpdateUser.Text = user.UserName; this.lblStatus.Text = (model.Status == 1) ? "未处理" : "已处理"; } }