protected void btnLogon_Click(object sender, EventArgs e) { string username = txtName.Text.Trim().ToLower(); string password = txtPwd.Text.Trim().ToLower(); EnterpriseUser enterpriseUser = new EnterpriseUser(); enterpriseUser.Username = username; enterpriseUser.Password = password; EnterpriseUserBLL enterpriseBll = new EnterpriseUserBLL(); if (enterpriseBll.CheckLogin(enterpriseUser)) { if (txtValidate.Text.ToUpper().Equals(Session["CheckCode"].ToString())) { /*设置session变量username为用户名*/ Session["username"] = username; Session["EuserID"] = enterpriseBll.GetEnterpriseIdByUser(username); Session["usertype"] = "E";//E - 企业端,S-系统端,A-答题端 Session["userfullName"] = enterpriseBll.GetIncNameByUser(username); Response.Redirect("~/Enterprise/ManageActivity.aspx"); } else { MessageBox.ShowAndRedirect(this, "您输入的验证码有误,请重新输入!", "EnterpriseLogin.aspx"); } } else { MessageBox.ShowAndRedirect(this, "您输入的用户名称或者密码有误,请重新输入!", "EnterpriseLogin.aspx"); } }
protected void GrVActivityManage_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = Int32.Parse(e.CommandArgument.ToString());//获取点击了第几行 if (e.CommandName == "GuidSetting") { string guidNew = GenerateGuid.NewGuidNo().Substring(0, 8); GuidNo guidObject = new GuidNo(); guidObject.GuidStr = guidNew; guidObject.ActivityId = int.Parse(grVActivityManage.DataKeys[rowIndex].Values[0].ToString()); guidObject.CreateTime = DateTime.Now; GuidBLL temp = new GuidBLL(); if (temp.Add(guidObject) != -1) { MessageBox.ShowAndRedirect(this, "已成功开启项目", "ManageActivity.aspx"); } } if (e.CommandName == "DisableActivity") { string strStatus = ((Button)grVActivityManage.Rows[rowIndex].Cells[8].Controls[0]).Text; string actid = grVActivityManage.DataKeys[rowIndex].Values[0].ToString(); string positonid = grVActivityManage.DataKeys[rowIndex].Values[1].ToString(); EnterpriseUserBLL enterprisebll = new EnterpriseUserBLL(); string enterpriseid = enterprisebll.GetEnterpriseIdByUser(Session["username"].ToString()); ActivityBLL temp = new ActivityBLL(); switch (strStatus) { case "开启项目": if (temp.UpdateActivityStatus(actid, positonid, enterpriseid, false) != -1) { MessageBox.ShowAndRedirect(this, "已成功开启项目", "ManageActivity.aspx"); } break; case "停止项目": if (temp.UpdateActivityStatus(actid, positonid, enterpriseid, true) != -1) { MessageBox.ShowAndRedirect(this, "已成功停止项目", "ManageActivity.aspx"); } break; default: break; } temp = null; } }
protected void btnDelete_Click(object sender, EventArgs e) { EnterpriseUserBLL temp = new EnterpriseUserBLL(); int selectCount = 0; int users_id = 0; foreach (GridViewRow gr in grVEnterpriseList.Rows) { CheckBox chk = (CheckBox)gr.Cells[0].FindControl("CB_Select"); if (chk.Checked) { users_id = int.Parse(grVEnterpriseList.DataKeys[gr.RowIndex].Values[0].ToString()); temp.Delete(users_id); selectCount++; } } if (0 == selectCount) { //MessageBox.Show("对不起,你没有选择记录!"); } temp = null; Response.Redirect(Request.Url.ToString()); }
private void bind() { EnterpriseUserBLL temp = new EnterpriseUserBLL(); DataSet ds = temp.GetListAll(); DataView dv = ds.Tables[0].DefaultView; dv.Sort = (String)ViewState["orderby"] + " " + (String)ViewState["asc"]; grVEnterpriseList.DataSource = dv; grVEnterpriseList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { ((SiteEnterpriseMaster)Master).InitMenu(); ((SiteEnterpriseMaster)Master).li1.Attributes.Add("class", "hover ccc"); ((SiteEnterpriseMaster)Master).b_hmenu1.Style.Clear(); ((SiteEnterpriseMaster)Master).b_hmenu2.Style.Add("display", "none"); ((SiteEnterpriseMaster)Master).b_hmenu3.Style.Add("display", "none"); ((SiteEnterpriseMaster)Master).b_hmenu4.Style.Add("display", "none"); ((SiteEnterpriseMaster)Master).s_menu1_1.Style.Add("COLOR", "#147ab8"); ((SiteEnterpriseMaster)Master).s_menu1_1.Style.Add("TEXT-DECORATION", "none"); if (Session["username"] == null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "<script>alert('请先登录系统!');top.location.href='../Enterprise/EnterpriseLogin.aspx';</script>"); return; } else { if (!IsPostBack) { if (Request["actid"] != null) { m_actid = Request["actid"].ToString(); ActivityBLL activityBll = new ActivityBLL(); EnterpriseUserBLL enterpriseUserBll = new EnterpriseUserBLL(); string username = Session["username"].ToString(); string enterpriseId = enterpriseUserBll.GetEnterpriseIdByUser(username); DataSet dsActivity = activityBll.GetActivityAll(enterpriseId); if (dsActivity != null) { ddlActivity.DataSource = dsActivity.Tables[0].DefaultView; ddlActivity.DataValueField = "activity_id"; ddlActivity.DataTextField = "activity_name"; ddlActivity.DataBind(); ddlActivity.SelectedValue = m_actid; } bind(Int32.Parse(m_actid)); } } } }
protected void Page_Load(object sender, EventArgs e) { ((SiteSystemMaster)Master).InitMenu(); ((SiteSystemMaster)Master).li1.Attributes.Add("class", "hover ccc"); ((SiteSystemMaster)Master).b_hmenu1.Style.Clear(); ((SiteSystemMaster)Master).b_hmenu2.Style.Add("display", "none"); ((SiteSystemMaster)Master).b_hmenu3.Style.Add("display", "none"); ((SiteSystemMaster)Master).s_menu1_1.Style.Add("COLOR", "#147ab8"); ((SiteSystemMaster)Master).s_menu1_1.Style.Add("TEXT-DECORATION", "none"); /*判断是否是管理员身份*/ if (Session["username"] == null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "<script>alert('请先登录系统!');top.location.href='../System/Login.aspx';</script>"); return; } else { if (!IsPostBack) { string users_id = Request.QueryString["users_id"]; if (!string.IsNullOrEmpty(users_id)) { EnterpriseUserBLL userBLL = new EnterpriseUserBLL(); EnterpriseUser usr = userBLL.GetModel(Int32.Parse(users_id)); if (usr != null) { lblEnterpriseName.Text = usr.Username; lblEnterpriseFull.Text = usr.Users_incname; } } txtbActivityenterpriseuid.Text = users_id; bind(); btnDelete.Attributes.Add("onclick", "return confirm('确实要删除这个项目吗?');"); } } }
protected void Page_Load(object sender, EventArgs e) { ((SiteEnterpriseMaster)Master).InitMenu(); ((SiteEnterpriseMaster)Master).li1.Attributes.Add("class", "hover ccc"); ((SiteEnterpriseMaster)Master).b_hmenu1.Style.Clear(); ((SiteEnterpriseMaster)Master).b_hmenu2.Style.Add("display", "none"); ((SiteEnterpriseMaster)Master).b_hmenu3.Style.Add("display", "none"); ((SiteEnterpriseMaster)Master).b_hmenu4.Style.Add("display", "none"); ((SiteEnterpriseMaster)Master).s_menu1_1.Style.Add("COLOR", "#147ab8"); ((SiteEnterpriseMaster)Master).s_menu1_1.Style.Add("TEXT-DECORATION", "none"); if (Request.QueryString["UID"] == null)//普通企业用户输入用户名和密码登录 { /*判断是否是企业用户身份*/ if (Session["username"] == null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "<script>alert('请先登录系统!');top.location.href='../Enterprise/EnterpriseLogin.aspx';</script>"); return; } else { username = Session["username"].ToString(); bind(); } } else//从系统端直接跳转过来2012.3.13 { string uID = Request.QueryString["UID"].ToString(); Session["EuserID"] = uID; EnterpriseUserBLL euserbll = new EnterpriseUserBLL(); username = euserbll.GetModel(Int32.Parse(uID)).Username; Session["username"] = username; bind(); } }
protected void btnSave_Click(object sender, EventArgs e) { int userId = 0; if (Request.QueryString["users_id"] != null) { userId = int.Parse(Request.QueryString["users_id"]); } // *验证用户输入的信息*/ if (string.IsNullOrEmpty(UserName.Text)) { MessageBox.ResponseScript(this, "您好,请填写用户名!"); } if (string.IsNullOrEmpty(Password.Text)) { MessageBox.ResponseScript(this, "您好,请填写密码!"); } if (string.IsNullOrEmpty(CompanyName.Text)) { MessageBox.ResponseScript(this, "您好,请填写公司名称!"); } EnterpriseUserBLL enterpriseUserBll = new EnterpriseUserBLL(); EnterpriseUser enterpriseUser = new EnterpriseUser(); if (0 == userId) { if (enterpriseUserBll.Exists(UserName.Text.Trim().ToLower())) { MessageBox.ShowAndRedirect(this, "用户添加失败:此用户名已存在", "AddEnterpriseUser.aspx"); return; } enterpriseUser.Username = UserName.Text.Trim().ToLower(); enterpriseUser.Users_incname = CompanyName.Text.Trim(); enterpriseUser.Password = Password.Text.Trim().ToLower(); enterpriseUser.Users_phone = txtbPhone.Text.Trim(); enterpriseUser.Users_contact = txtbContact.Text.Trim(); if (enterpriseUserBll.Add(enterpriseUser) != -1) { MessageBox.ShowAndRedirect(this, "企业用户添加成功", "EnterpriseUserList.aspx"); } else { MessageBox.ShowAndRedirect(this, "企业用户添加失败", "EnterpriseUserList.aspx"); } } else { enterpriseUser.Id = userId; enterpriseUser.Username = UserName.Text.Trim(); enterpriseUser.Users_incname = CompanyName.Text.Trim(); enterpriseUser.Password = Password.Text.Trim(); enterpriseUser.Users_phone = txtbPhone.Text.Trim(); enterpriseUser.Users_contact = txtbContact.Text.Trim(); if (enterpriseUserBll.Update(enterpriseUser) == 1) { MessageBox.ShowAndRedirect(this, "企业用户修改成功", "EnterpriseUserList.aspx"); } else { MessageBox.ShowAndRedirect(this, "企业用户修改失败", "EnterpriseUserList.aspx"); } } }
protected void UserName_TextChanged(object sender, EventArgs e) { EnterpriseUserBLL enterpriseUserBll = new EnterpriseUserBLL(); if (enterpriseUserBll.Exists(UserName.Text.Trim().ToLower())) { lblMessage.Text = "该用户名已经注册"; } else { lblMessage.Text = ""; } }