protected void btnOK_Click(object sender, EventArgs e) { string emp_id = ""; string path = Server.MapPath("~/UpFiles"); foreach (GridViewRow gvr in GridView1.Rows) { if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == true) { emp_id += string.Format("{0},", GridView1.DataKeys[gvr.RowIndex].Value.ToString()); } } if (emp_id.EndsWith(",")) { emp_id = emp_id.Substring(0, emp_id.Length - 1); } MySingleton.AlterRegistResult MyResult = MySingleton.AlterRegistResult.CancelRegistSucess; if (!string.IsNullOrEmpty(emp_id)) { // MySingleton.AlterRegistResult MyResult = MySingleton.GetMySingleton().AlterRegist(null, null, MySingleton.AlterRegistType.CancelRegist, new Guid(activity_id), emp_id, regist_deadline, cancelregist_deadline, ((Button)sender).Page.Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.IndexOf('/', 7)) + "/ACMS/WebForm/RegistActivity/RegistedActivityQuery.aspx",path); string aa = string.Format("{0}://{1}{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Authority, HttpContext.Current.Request.ApplicationPath).TrimEnd('/'); MyResult = MySingleton.GetMySingleton().AlterRegist(null, null, MySingleton.AlterRegistType.CancelRegist, new Guid(activity_id), emp_id, regist_deadline, cancelregist_deadline, aa + "/Default.aspx", path, "", aa + "/Default.aspx"); GridView1.DataBind(); } if (CancelPersonRegistClick != null) { this.Visible = false; CancelPersonRegistClick(this, e); } if (MyResult == MySingleton.AlterRegistResult.CancelRegistSucess) { clsMyObj.ShowMessage("取消報名完成。"); } else if (MyResult == MySingleton.AlterRegistResult.CancelRegistFail_DayOver) { clsMyObj.ShowMessage("取消報名截止日之後無法取消報名!。"); } else if (MyResult == MySingleton.AlterRegistResult.CancelRegistFail) { clsMyObj.ShowMessage("取消報名失敗!。"); } }
protected void btnOK_Click(object sender, EventArgs e) { string emp_id1 = ""; string emp_id2 = ""; string path = Server.MapPath("~/UpFiles"); // 先檢查是否低於下限 int membersInt = 0; foreach (GridViewRow gvr in GridView1.Rows) { if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == false) { membersInt += 1; } } ACMS.BO.ActivatyBO aBO = new ACMS.BO.ActivatyBO(); ACMS.VO.ActivatyVO aVO = aBO.SelectActivatyByActivatyID(new Guid(activity_id)); if (membersInt < aVO.team_member_min) { // string sdoPostScript = " __doPostBack('" + btnCancelAll1.ClientID + "','1'); "; // string ScriptAll = " if (confirm('取消報名則團隊人數將低於下限,是否要全隊取消報名?')==true) { alert ('1232456'); window.open('http://www.google.com.tw');" + sdoPostScript + "} "; // string ScriptAll = " if (confirm('取消報名則團隊人數將低於下限,是否要全隊取消報名?')==true) { alert ('1232456')} "; //BasePage.RunClientScript (this.Page , ScriptAll); //clsMyObj.ShowMessage("若您取消報名則團隊人數將低於下限,因此系統將取消整個團隊的報名資格,若確定要取消報名,請點選「確定」按鈕後於下個視窗點選「確定取消報名」按鈕!"); btnOK.Visible = false; btnCancelAll.Visible = false; btnOK0.Visible = true; lblMessage.Visible = true; GridView1.Visible = false; mpSearch.Show(); return; } //已換隊長 if (newBoss != "") { foreach (GridViewRow gvr in GridView1.Rows) { if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == true) { if (GridView1.DataKeys[gvr.RowIndex].Value.ToString() == newBoss) { clsMyObj.ShowMessage("您為此隊隊長,請更換隊長,再進行取消!"); this.mpSearch.Show(); return; } } } ACMS.DAO.ActivityTeamMemberDAO myActivityTeamMemberDAO = new ACMS.DAO.ActivityTeamMemberDAO(); myActivityTeamMemberDAO.ChangeBoss(new Guid(activity_id), newBoss, emp_id); } foreach (GridViewRow gvr in GridView1.Rows) { if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == true && (gvr.FindControl("RadioButton1") as RadioButton).Checked == true) { clsMyObj.ShowMessage("您為此隊隊長,請更換隊長,再進行取消!"); this.mpSearch.Show(); return; } } foreach (GridViewRow gvr in GridView1.Rows) { if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == true) { emp_id1 += string.Format("{0},", GridView1.DataKeys[gvr.RowIndex].Value.ToString()); } emp_id2 += string.Format("{0},", GridView1.DataKeys[gvr.RowIndex].Value.ToString()); } if (emp_id1.EndsWith(",")) { emp_id1 = emp_id1.Substring(0, emp_id1.Length - 1); } if (emp_id1 == "" && newBoss == "") { clsMyObj.ShowMessage("您未取消報名也未更換隊長,程式沒有修改任資料!"); return; } MySingleton.AlterRegistResult MyResult = MySingleton.AlterRegistResult.CancelRegistSucess; if (!string.IsNullOrEmpty(emp_id1)) { string aa = string.Format("{0}://{1}{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Authority, HttpContext.Current.Request.ApplicationPath).TrimEnd('/'); //MySingleton.AlterRegistResult MyResult = MySingleton.GetMySingleton().AlterRegist_Team(null, null, null, MySingleton.AlterRegistType.CancelRegist, new Guid(activity_id), emp_id1, regist_deadline, cancelregist_deadline, ((Button)sender).Page.Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.IndexOf('/', 7)) + "/ACMS/WebForm/RegistActivity/RegistedActivityQuery.aspx", path); MyResult = MySingleton.GetMySingleton().AlterRegist_Team(null, null, null, MySingleton.AlterRegistType.CancelRegist, new Guid(activity_id), emp_id1, regist_deadline, cancelregist_deadline, aa + "/Default.aspx", path, "", aa + "/Default.aspx"); //.ResolveUrl("~/WebForm/RegistActivity/RegistedActivityQuery.aspx")); GridView1.DataBind(); } if (CancelTeamRegistClick != null) { this.Visible = false; CancelTeamRegistClick(this, e); } ACMS.DAO.ActivityRegistDAO regDao = new ACMS.DAO.ActivityRegistDAO(); emp_id2 = emp_id2.TrimEnd(','); string members = regDao.AllTeamMemberByMembers(new Guid(activity_id), emp_id2); if (members == "") { clsMyObj.ShowMessage("已達人數下限,目前已取消該隊的報名資格"); return; } if (MyResult == MySingleton.AlterRegistResult.CancelRegistSucess) { if (newBoss == "" && emp_id1 != "") { clsMyObj.ShowMessage("取消報名完成。"); } if (newBoss != "" && emp_id1 != "") { clsMyObj.ShowMessage("更換隊長及取消報名完成。"); } if (newBoss != "" && emp_id1 == "") { clsMyObj.ShowMessage("更換隊長完成。"); } } else if (MyResult == MySingleton.AlterRegistResult.CancelRegistFail_DayOver) { clsMyObj.ShowMessage("取消報名截止日之後無法取消報名!。"); } else if (MyResult == MySingleton.AlterRegistResult.CancelRegistFail) { clsMyObj.ShowMessage("取消報名失敗!。"); } }