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 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)); } } } }