protected void btnAddLimitCompany_Click(object sender, EventArgs e) { ACMS.DAO .ActivityGroupLimitDAO dao = new ACMS.DAO.ActivityGroupLimitDAO (); try { dao.InsertLimitCompany(ActivityID, ddlC_NAME.SelectedValue, ddlC_NAME.SelectedItem.Text); } catch { } gvLimitCompany.DataBind(); }
//完成 protected void FinishButton_Click(object sender, EventArgs e) { //預覽時 if (Session["form_mode1"] != null) { if (Session["form_mode1"].ToString() == "preview") { Session.Remove("form_mode1"); Response.Redirect("~/WebForm/ManageActivity/ActivityEditQuery.aspx"); } } if (hiMode1.Value == "preview") { Response.Redirect("~/WebForm/ManageActivity/ActivityEditQuery.aspx"); } if (MyFormMode == FormViewMode.ReadOnly) { Response.Redirect("RegistedActivityQuery.aspx?type=2"); } ACMS.DAO.ActivityGroupLimitDAO limDAO=new ACMS.DAO.ActivityGroupLimitDAO (); try { ACMS.VO.ActivityRegistVO myActivityRegistVO = GetActivityRegistVO(); //取得報名資訊 List<ACMS.VO.CustomFieldValueVO> myCustomFieldValueVOList = GetCustomFieldValueVOList();//取得自訂欄位值 //ACMS.DAO.ActivityRegistDAO myActivityRegistDAO = new ACMS.DAO.ActivityRegistDAO(); ACMS.DAO.ActivityRegistDAO dao = new ACMS.DAO.ActivityRegistDAO(); //報名 MySingleton.AlterRegistResult MyResult; string path = Server.MapPath("~/UpFiles"); string errMsg = ""; foreach (ACMS.VO.ActivityTeamMemberVO vo in Page_ActivityTeamMemberVOList) { if (limDAO.GroupLimitIsExist(ActivityID.ToString(), vo.emp_id) == false) { errMsg += vo.emp_id + ","; } } if (errMsg != "") { clsMyObj.ShowMessage("以下人員不在可報名名單中,所以無法報名:"+errMsg.TrimEnd (',')); return; } if (MyFormMode == FormViewMode.Insert) { if (dao.RegistableCount(ActivityID) < 0) { clsMyObj.ShowMessage("已額滿,無法報名"); return; } //MyResult = MySingleton.GetMySingleton().AlterRegist_Team(myActivityRegistVO, myCustomFieldValueVOList, Page_ActivityTeamMemberVOList, MySingleton.AlterRegistType.RegistInsert, new Guid(), "", "", "", ((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_Team(myActivityRegistVO, myCustomFieldValueVOList, Page_ActivityTeamMemberVOList, MySingleton.AlterRegistType.RegistInsert, new Guid(), "", "", "", aa + "/Default.aspx", path, "", aa + "/Default.aspx"); } else { 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_Team(myActivityRegistVO, myCustomFieldValueVOList, Page_ActivityTeamMemberVOList, MySingleton.AlterRegistType.RegistUpdate, new Guid(), "", "", "", ((Button)sender).Page.Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.IndexOf('/', 7)) + "/ACMS/WebForm/RegistActivity/RegistedActivityQuery.aspx",path); MyResult = MySingleton.GetMySingleton().AlterRegist_Team(myActivityRegistVO, myCustomFieldValueVOList, Page_ActivityTeamMemberVOList, MySingleton.AlterRegistType.RegistUpdate, new Guid(), "", "", "", aa + "/Default.aspx", path, "", aa + "/Default.aspx"); } if (MyResult == MySingleton.AlterRegistResult.RegistFail_Already) { ShowMessageForAjax(this, "已存在報名成功紀錄,無法重複報名!"); return; } else if (MyResult == MySingleton.AlterRegistResult.RegistFail_Full) { ShowMessageForAjax(this, @"抱歉,報名已額滿!若錄取名額有增加則可再次報名。"); return; } else if (MyResult == MySingleton.AlterRegistResult.RegistFail) { ShowMessageForAjax(this, @"資料存檔發生錯誤,無法完成報名。"); return; } else { } } catch (Exception ex) { WriteErrorLog("SaveData", ex.Message, "0"); } Response.Redirect("RegistedActivityQuery.aspx?type=2"); }
//完成 protected void FinishButton_Click(object sender, EventArgs e) { ACMS.DAO.ActivityGroupLimitDAO limDAO = new ACMS.DAO.ActivityGroupLimitDAO(); //預覽時 if (Session["form_mode1"] != null) { if (Session["form_mode1"].ToString() == "preview") { Session.Remove("form_mode1"); Response.Redirect("~/WebForm/ManageActivity/ActivityEditQuery.aspx"); } } if (MyFormMode == FormViewMode.ReadOnly) { Response.Redirect("RegistedActivityQuery.aspx?type=1"); } try { //以新增方式進來時 ACMS.VO.ActivityRegistVO myActivityRegistVO = GetActivityRegistVO(); //取得報名資訊 ACMS.DAO.ActivityRegistDAO dao = new ACMS.DAO.ActivityRegistDAO(); List <ACMS.VO.CustomFieldValueVO> myCustomFieldValueVOList = GetCustomFieldValueVOList(); //取得自訂欄位值 //ACMS.DAO.ActivityRegistDAO myActivityRegistDAO = new ACMS.DAO.ActivityRegistDAO(); string path = Server.MapPath("~/UpFiles"); //報名 MySingleton.AlterRegistResult MyResult; if (limDAO.GroupLimitIsExist(ActivityID.ToString(), myActivityRegistVO.emp_id) == false) { clsMyObj.ShowMessage(myActivityRegistVO.emp_id + "不在可報名的名單中!"); return; } if (MyFormMode == FormViewMode.Insert) { if (dao.IsPersonRegisted(ActivityID, myActivityRegistVO.emp_id, "", "1") > 0) { clsMyObj.ShowMessage("已報名,無法重覆報名"); return; } if (dao.RegistableCount(ActivityID) < 0) { clsMyObj.ShowMessage("已額滿,無法報名"); return; } // MyResult = MySingleton.GetMySingleton().AlterRegist(myActivityRegistVO, myCustomFieldValueVOList, MySingleton.AlterRegistType.RegistInsert, new Guid(), "", "", "", this.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(myActivityRegistVO, myCustomFieldValueVOList, MySingleton.AlterRegistType.RegistInsert, new Guid(), "", "", "", aa + "/Default.aspx", path, "", aa + "/Default.aspx"); } else { // MyResult = MySingleton.GetMySingleton().AlterRegist(myActivityRegistVO, myCustomFieldValueVOList, MySingleton.AlterRegistType.RegistUpdate, new Guid(), "", "", "", this.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(myActivityRegistVO, myCustomFieldValueVOList, MySingleton.AlterRegistType.RegistUpdate, new Guid(), "", "", "", aa + "/Default.aspx", path, "", aa + "/Default.aspx"); } if (MyResult == MySingleton.AlterRegistResult.RegistFail_Already) { clsMyObj.ShowMessage("已存在報名成功紀錄,無法重複報名!"); return; } else if (MyResult == MySingleton.AlterRegistResult.RegistFail_Full) { clsMyObj.ShowMessage(@"抱歉,報名已額滿!若錄取名額有增加則可再次報名。"); return; } else if (MyResult == MySingleton.AlterRegistResult.RegistFail) { clsMyObj.ShowMessage(@"資料存檔發生錯誤,無法完成報名。"); return; } else { } } catch (Exception ex) { WriteErrorLog("SaveData", ex.Message, "0"); return; } Response.Redirect("RegistedActivityQuery.aspx?type=1"); }