protected void btnSubmit_Click(object sender, EventArgs e) { string Code = txtCode.Text.Trim(); string UserName = txtUserName.Text.Trim(); string pwd = txtpwd.Text.Trim(); if (Code.ToLower() != (Session["DtCode"].ToString()).ToLower()) { Response.Write("<script>alert('您输入的验证码与系统的不一致!');</script>"); return; } if (string.IsNullOrEmpty(UserName)) { Response.Write("<script>alert('请输入会员名!');</script>"); return; } if (string.IsNullOrEmpty(pwd)) { Response.Write("<script>alert('请输入密码!');</script>"); return; } // if (RadioButtonListRole.SelectedValue == "管理员") //{ // DtCms.Model.Administrator administrator = new DtCms.Model.Administrator(); // administrator.UserName = UserName; // administrator.UserPwd = pwd; // DtCms.BLL.Administrator bll = new DtCms.BLL.Administrator(); // if (bll.chkAdminLogin(UserName, DESEncrypt.Encrypt(pwd))) //{ // Session["Administrator"] = UserName; // Response.Write("<script>alert('登录成功!')</script>"); // Response.Redirect("~/Admin/Admin_Index.aspx"); // } // else if (bll.GetCount(" Username='******' and UserPwd='" + pwd + "' ") == 0) // { // Response.Write("<script>alert('登录失败,管理员名名或密码输入错误!');</script>"); // } // } if (RadioButtonListRole.SelectedValue == "学生") { DtCms.Model.Member member = new DtCms.Model.Member(); member.Username = UserName; member.Pwd = pwd; DtCms.BLL.Member bll = new DtCms.BLL.Member(); if (bll.GetCount(" Username='******' and Pwd='" + pwd + "' ") > 0) { Session["Member"] = UserName; Response.Write("<script>alert('登录成功!');window.location.href='index.aspx'</script>"); } else { Response.Write("<script>alert('登录失败,用户名或密码输入错误!');</script>"); } } if (RadioButtonListRole.SelectedValue == "队长") { DtCms.Model.TeamLeader teamleader = new DtCms.Model.TeamLeader(); teamleader.Username = UserName; teamleader.Pwd = pwd; DtCms.BLL.TeamLeader bll = new DtCms.BLL.TeamLeader(); if (bll.GetCount(" Username='******' and Pwd='" + pwd + "' ") > 0) { Session["TeamLeader"] = UserName; Response.Write("<script>alert('登录成功!');window.location.href='Tindex.aspx'</script>"); } else { Response.Write("<script>alert('登录失败,用户名或密码输入错误!');</script>"); } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "ButtonSV") { int dataItemIndex = Convert.ToInt32(e.CommandArgument); int papeSize = GridView1.PageSize; int pageIndex = GridView1.PageIndex; int rowIndex = dataItemIndex - papeSize * pageIndex; string activityId = GridView1.DataKeys[rowIndex].Value.ToString(); DtCms.BLL.JoinActivity joinActivityBLL = new DtCms.BLL.JoinActivity(); string username = Session["Member"].ToString(); if (joinActivityBLL.GetCount(activityId) < Convert.ToInt32(GridView1.Rows[rowIndex].Cells[5].Text)) { if (joinActivityBLL.AcExists(activityId, username) == false) { DtCms.BLL.Member memberBLL = new DtCms.BLL.Member(); DtCms.Model.JoinActivity joinActivity = new DtCms.Model.JoinActivity(); string UserTel = memberBLL.QueryOneRecord(username).Usertel.ToString(); joinActivity.ActivityId = activityId; joinActivity.UserName = username; joinActivity.UserTel = UserTel; joinActivity.TicketType = "SuperVIP"; joinActivityBLL.Add(joinActivity); Response.Write("<script>alert('抢票成功。')</script>"); } else { Response.Write("<script>alert('抢票失败。')</script>"); } } else { Response.Write("<script>alert('抢票失败。')</script>"); } } if (e.CommandName == "ButtonV") { int dataItemIndex = Convert.ToInt32(e.CommandArgument); int papeSize = GridView1.PageSize; int pageIndex = GridView1.PageIndex; int rowIndex = dataItemIndex - papeSize * pageIndex; string activityId = GridView1.DataKeys[rowIndex].Value.ToString(); DtCms.BLL.JoinActivity joinActivityBLL = new DtCms.BLL.JoinActivity(); string username = Session["Member"].ToString(); if (joinActivityBLL.GetCount(activityId) < Convert.ToInt32(GridView1.Rows[rowIndex].Cells[7].Text)) { if (joinActivityBLL.AcExists(activityId, username) == false) { DtCms.BLL.Member memberBLL = new DtCms.BLL.Member(); DtCms.Model.JoinActivity joinActivity = new DtCms.Model.JoinActivity(); string UserTel = memberBLL.QueryOneRecord(username).Usertel.ToString(); joinActivity.ActivityId = activityId; joinActivity.UserName = username; joinActivity.UserTel = UserTel; joinActivity.TicketType = "VIP"; joinActivityBLL.Add(joinActivity); Response.Write("<script>alert('抢票成功。')</script>"); } else { Response.Write("<script>alert('抢票失败。')</script>"); } } else { Response.Write("<script>alert('抢票失败。')</script>"); } } if (e.CommandName == "ButtonC") { int dataItemIndex = Convert.ToInt32(e.CommandArgument); int papeSize = GridView1.PageSize; int pageIndex = GridView1.PageIndex; int rowIndex = dataItemIndex - papeSize * pageIndex; string activityId = GridView1.DataKeys[rowIndex].Value.ToString(); DtCms.BLL.JoinActivity joinActivityBLL = new DtCms.BLL.JoinActivity(); string username = Session["Member"].ToString(); if (joinActivityBLL.GetCount(activityId) < Convert.ToInt32(GridView1.Rows[rowIndex].Cells[9].Text)) { if (joinActivityBLL.AcExists(activityId, username) == false) { DtCms.BLL.Member memberBLL = new DtCms.BLL.Member(); DtCms.Model.JoinActivity joinActivity = new DtCms.Model.JoinActivity(); string UserTel = memberBLL.QueryOneRecord(username).Usertel.ToString(); joinActivity.ActivityId = activityId; joinActivity.UserName = username; joinActivity.UserTel = UserTel; joinActivity.TicketType = "Common"; joinActivityBLL.Add(joinActivity); Response.Write("<script>alert('抢票成功。')</script>"); } else { Response.Write("<script>alert('抢票失败。')</script>"); } } else { Response.Write("<script>alert('抢票失败。')</script>"); } } if (e.CommandName == "ButtonS") { int dataItemIndex = Convert.ToInt32(e.CommandArgument); int papeSize = GridView1.PageSize; int pageIndex = GridView1.PageIndex; int rowIndex = dataItemIndex - papeSize * pageIndex; string activityId = GridView1.DataKeys[rowIndex].Value.ToString(); DtCms.BLL.JoinActivity joinActivityBLL = new DtCms.BLL.JoinActivity(); string username = Session["Member"].ToString(); if (joinActivityBLL.GetCount(activityId) < Convert.ToInt32(GridView1.Rows[rowIndex].Cells[11].Text)) { if (joinActivityBLL.AcExists(activityId, username) == false) { DtCms.BLL.Member memberBLL = new DtCms.BLL.Member(); DtCms.Model.JoinActivity joinActivity = new DtCms.Model.JoinActivity(); string UserTel = memberBLL.QueryOneRecord(username).Usertel.ToString(); joinActivity.ActivityId = activityId; joinActivity.UserName = username; joinActivity.UserTel = UserTel; joinActivity.TicketType = "Standing"; joinActivityBLL.Add(joinActivity); Response.Write("<script>alert('抢票成功。')</script>"); } else { Response.Write("<script>alert('抢票失败,活动只能领取一张门票。')</script>"); } } else { Response.Write("<script>alert('抢票失败,抢票人数到达上限。')</script>"); } } }