Beispiel #1
0
    //取得報名資訊
    private ACMS.VO.ActivityRegistVO GetActivityRegistVO()
    {
        ACMS.VO.ActivityRegistVO myActivityRegistVO = new ACMS.VO.ActivityRegistVO();

        myActivityRegistVO.activity_id = ActivityID;
        myActivityRegistVO.emp_id      = EmpID;
        myActivityRegistVO.regist_by   = RegistBy;
        myActivityRegistVO.idno_type   = (FormView_fixA.FindControl("tr_person_fix1").FindControl("rblidno_type") as RadioButtonList).SelectedIndex;
        myActivityRegistVO.idno        = (FormView_fixA.FindControl("tr_person_fix1").FindControl("txtperson_fix1") as TextBox).Text;
        // myActivityRegistVO.idno_ext = (FormView_fixA.FindControl("tr_person_fix1").FindControl("txtidno_ext") as TextBox).Text;

        myActivityRegistVO.team_name = "";
        try
        {
            myActivityRegistVO.ext_people = Convert.ToInt32((FormView_fixA.FindControl("tr_person_fix1").FindControl("txtperson_fix2") as TextBox).Text);
        }
        catch
        {
            myActivityRegistVO.ext_people = 0;
        }


        return(myActivityRegistVO);
    }
Beispiel #2
0
    //完成
    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");
    }