//protected void btnLogin_Click(object sender, DirectEventArgs e) //{ // string usname = TextBox1.Text; // string pwd = TextBox1.Text; // BG_User user = BG_UserLogic.UserLogin(usname, pwd); // if (user != null) // { // Session[Constant.UserID] = user.UserID; //用户ID // Session[Constant.UserName] = user.UserName; //用户名称 // Session[Constant.UserNum] = user.UserNum; //用户工号 // Session[Constant.UserLim] = user.UserLim; //用户权限 // Session[Constant.DepID] = user.DepID; //用户所属部门ID // BG_Department department = BG_DepartmentManager.GetBG_DepartmentByDepID(user.DepID); // Session[Constant.DepName] = department.DepName; //用户所属部门名称 // Response.Redirect("default.aspx", true); // } // else // { // X.Msg.Alert("Error", "密码或帐户名错误!").Show(); // } //} protected void ibtnLogin_Click(object sender, ImageClickEventArgs e) { string usname = txtUer.Text; string pwd = txtPwd.Text; BG_User user = BG_UserLogic.UserLogin(usname, pwd); if (user != null) { Session[Constant.UserID] = user.UserID; //用户ID Session[Constant.UserName] = user.UserName; //用户名称 Session[Constant.UserNum] = user.UserNum; //用户工号 Session[Constant.UserLim] = user.UserLim; //用户权限 Session[Constant.DepID] = user.DepID; //用户所属部门ID BG_Department department = BG_DepartmentManager.GetBG_DepartmentByDepID(user.DepID); Session[Constant.DepName] = department.DepName; //用户所属部门名称 Session["CurrentYear"] = BG_SysSettingLogic.GetLastYear(); Session["IsLogin"] = 1; BG_User userd = new BG_User(); user.IsLogin = 1; BG_UserManager.ModifyBG_User(userd); Session[Constant.listallocationstr] = GetXML().Trim(); Response.Redirect("default.aspx", true); } else { X.Msg.Alert("Error", "密码或帐户名错误!").Show(); } }
private void add() { UserID.Text = ""; BG_User user = new BG_User(); user.UserIDNum = TextField4.Text; user.UserName = TextField1.Text.Replace(",", string.Empty).Replace(",", string.Empty); if (user.UserName == "" || user.UserName == (string)Session["depname"]) { X.Msg.Alert("提示", "人名不能与部门名重名!").Show(); return; } if (BG_UserLogic.IsUser(user.UserName)) { X.Msg.Alert("提示", "已经存在该姓名,请使用其他姓名添加!").Show(); return; } user.UserNum = TextField3.Text; user.UserRem = txtRem.Text.Replace(",", string.Empty).Replace(",", string.Empty); string limit = string.Empty; int isvip = 0; if (Radio1.Checked == true) { limit = "100000"; user.UserDescription="管理员"; } if (Radio2.Checked == true) { limit = "010000"; user.UserDescription="局领导"; } if (Radio3.Checked == true) { limit = "001000"; user.UserDescription="审核员"; } if (Radio4.Checked == true) { limit = "000100"; user.UserDescription="录入人员"; } if (Radio5.Checked == true) { limit = "000010"; user.UserDescription="查询人员"; } if (Radio6.Checked == true) { limit = "000001"; user.UserDescription="出纳员"; } if (Radio7.Checked == true) { isvip = 1; } if (Radio8.Checked == true) { isvip = 0; } //if (Radio19.Checked == true) //{ // isvip = 2; //} string applyrem = ""; string applyrem1 = ""; string applyrem2 = ""; string applyrem3 = ""; applyrem1 = Radio9.Checked == true ? "1" : "0"; applyrem2 = Radio10.Checked == true ? "1" : "0"; applyrem3 = Radio11.Checked == true ? "1" : "0"; user.UserLim = limit; //user.UserSta = StrToInt(cbbSta.Text); //if (cbbSta.Text == "禁用") //{ // user.UserSta = 2; //} //if (cbbSta.Text == "禁用") //{ // user.UserSta = 1; //} user.UserSta = 1; user.UserPwd = "12345"; int depid = common.IntSafeConvert(BG_DepartmentLogic.GetBG_DepartmentByName((string)Session["depname"]).DepID); user.DepID = depid; user.IsVIP = isvip; user.ApplyRem = applyrem; if (BG_UserManager.AddBG_User(user).UserID > 0 ) { Node node = new Node(); node.Text = user.UserName; node.Icon = Icon.User; node.Leaf = true; STMem.GetNodeById(depid).AppendChild(node); //X.Msg.Show(new MessageBoxConfig //{ // Title = "提示", // Message = "添加成功", // Width = 300, // Buttons = MessageBox.Button.OK, //}); Session["depname"] = "政策法规科"; Response.Redirect("STMember.aspx?depid=" + depid, true); } //STMem.ExpandAll(); //int depid = AreaDepID; }
protected override void OnLoad(EventArgs e) { if (Session[Constant.UserName] != null && Session[Constant.UserLim] != null) { InComeSouce = new string[] {"财政拨款", "地方财政", "其他"}; userLim = Session[Constant.UserLim].ToString(); userName = Session[Constant.UserName].ToString(); userNum = Session[Constant.UserNum].ToString(); depID = Convert.ToInt32(Session[Constant.DepID]); depName = Session[Constant.DepName].ToString(); UserID = Convert.ToInt32(Session[Constant.UserID]); areaDepID = Convert.ToInt32(ConfigurationManager.AppSettings["AreaDepID"]); currentYear = DateTime.Now.Year.ToString(); //Session["CurrentYear"].ToString(); try { userLimStr = GetUserLimStr(userLim); } catch { } isLogin = (int)Session["IsLogin"]; listallocationstr = Session[Constant.listallocationstr].ToString(); } else { Session["IsLogin"]=0; BG_User user = new BG_User(); user.IsLogin = 0; BG_UserManager.ModifyBG_User(user); ScriptManager.RegisterStartupScript(this, GetType(), "lgout", "window.top.location.href='"+ResolveClientUrl("~/login.aspx")+"'", true); } base.OnLoad(e); }
public static bool ModifyBG_User(BG_User bG_User) { return BG_UserService.ModifyBG_User(bG_User); }
public static bool DeleteBG_User(BG_User bG_User) { return BG_UserService.DeleteBG_User(bG_User); }
public static BG_User AddBG_User(BG_User bG_User) { return BG_UserService.AddBG_User(bG_User); }
/// <summary> /// 用户Login /// </summary> /// <param name="uid">帐号</param> /// <param name="pwd">密码</param> /// <returns>BGUser</returns> public static BG_User UserLogin(string uid, string pwd) { BG_User user = null; string sqlStr = "select * from BG_User where UserNum = '{0}' and UserPwd= '{1}'"; sqlStr = string.Format(sqlStr, uid, pwd); DataTable dt = DBUnity.AdapterToTab(sqlStr); if (dt.Rows.Count > 0) { user = new BG_User(); user.UserID = (int)dt.Rows[0]["UserID"]; user.UserName = dt.Rows[0]["UserName"].ToString(); user.UserIDNum = dt.Rows[0]["UserIDNum"].ToString(); user.UserNum = dt.Rows[0]["UserNum"].ToString(); user.UserPwd = dt.Rows[0]["UserPwd"].ToString(); user.UserLim = dt.Rows[0]["UserLim"].ToString(); user.UserSta = (int)dt.Rows[0]["UserSta"]; user.DepID = (int)dt.Rows[0]["DepID"]; user.UserRem = dt.Rows[0]["UserRem"].ToString(); } return user; }