//刪除活動
    protected void lbtnDelActivaty_Click(object sender, EventArgs e)
    {
        try
        {
            string theGUID = GridView1.DataKeys[((sender as LinkButton).NamingContainer as GridViewRow).RowIndex].Value.ToString();

            ACMS.DAO.ActivatyDAO myActivatyDAO = new ACMS.DAO.ActivatyDAO();

            myActivatyDAO.DeleteActivatyByID(theGUID);


            //刪除相關檔案
            DirectoryInfo myDirectoryInfo = new DirectoryInfo(Server.MapPath(Path.Combine("~/UpFiles", theGUID)));

            if (myDirectoryInfo.Exists)
            {
                myDirectoryInfo.Delete(true);
            }

            GridView1.DataBind();
        }
        catch (Exception ex)

        {
            WriteErrorLog("DeleteActivity", ex.Message, "0");
        }
    }
Пример #2
0
    private void GetActivityDefault()
    {
        try
        {
            InitQueryBlock(ActivityID.ToString());
            //取得活動資訊
            ACMS.DAO.ActivatyDAO myActivatyDAO = new ACMS.DAO.ActivatyDAO();
            ACMS.VO.ActivatyVO   myActivatyVO  = myActivatyDAO.SelectActivatyByID(ActivityID);

            //報名截止日後要唯讀
            if (myActivatyVO.regist_deadline < DateTime.Today)
            {
                MyFormMode = FormViewMode.ReadOnly;
                //GridView_RegisterPeoplinfo.Enabled = false;
                PanelCustomFieldA1.Enabled = false;
            }
            if (MyFormMode == FormViewMode.Edit)
            {
                Wizard1.FindControl("FinishNavigationTemplateContainerID$btnHome").Visible             = true;
                ((Button)Wizard1.FindControl("FinishNavigationTemplateContainerID$FinishButton")).Text = "儲存並發送確認信";
            }
            //活動海報訊息
            Literal1.Text = myActivatyVO.activity_info;

            //活動相關訊息
            ObjectDataSource_ActivatyDetails.SelectParameters["id"].DefaultValue = ActivityID.ToString();
            ObjectDataSource_UpFiles.SelectParameters["dirName"].DefaultValue    = Server.MapPath(Path.Combine("~/UpFiles", ActivityID.ToString()));

            //報名者資訊
            ObjectDataSource_RegisterPersonInfo.SelectParameters["emp_id"].DefaultValue = clsAuth.ID;//預設登入者

            //所有報名者資訊
            ObjectDataSource_RegisterPeoplenfo.SelectParameters["activity_id"].DefaultValue = ActivityID.ToString();
            ObjectDataSource_RegisterPeoplenfo.SelectParameters["emp_id"].DefaultValue      = RegistBy;//由登入者所報名(含登入者本人)

            //注意事項
            Literal_notice.Text = myActivatyVO.notice.Replace("\r\n", "<br />");

            FormView_fixA.DataBind();
            ACMS.BO.CustomFieldBO myCustFieldBo = new ACMS.BO.CustomFieldBO();
            if (myCustFieldBo.SelectByActivity_id(ActivityID).Count > 0)
            {
                Session["ShowPanel"] = true;
            }
        }
        catch (Exception ex)
        {
            WriteErrorLog("GetDefault", ex.Message, "0");
        }
        //FormView_fixA.FindControl("tr_person_fix1").Visible = (myActivatyVO.is_showperson_fix1 == "Y");
        //FormView_fixA.FindControl("tr_person_fix2").Visible = (myActivatyVO.is_showperson_fix2 == "Y");

        //(FormView_fixA.FindControl("tr_person_fix2").FindControl("lblAf2Start") as Label).Text = myActivatyVO.personextcount_min.ToString();
        //(FormView_fixA.FindControl("tr_person_fix2").FindControl("lblAf2End") as Label).Text = myActivatyVO.personextcount_max.ToString();

        //RangeValidator myRangeValidator = (FormView_fixA.FindControl("tr_person_fix2").FindControl("chk_txtperson_fix2_3") as RangeValidator);
        //myRangeValidator.MinimumValue = myActivatyVO.personextcount_min.ToString();
        //myRangeValidator.MaximumValue = myActivatyVO.personextcount_max.ToString();
    }
Пример #3
0
    protected void FormView_fixA_DataBound(object sender, EventArgs e)
    {
        ACMS.DAO.ActivatyDAO myActivatyDAO = new ACMS.DAO.ActivatyDAO();
        ACMS.VO.ActivatyVO   myActivatyVO  = myActivatyDAO.SelectActivatyByID(ActivityID);

        FormView_fixA.FindControl("tr_person_fix1").Visible = (myActivatyVO.is_showperson_fix1 == "Y");
        FormView_fixA.FindControl("lblID").Visible          = (myActivatyVO.is_showperson_fix1 == "Y");

        FormView_fixA.FindControl("tr_person_fix2").Visible  = (myActivatyVO.is_showperson_fix2 == "Y");
        FormView_fixA.FindControl("tr_person_fix21").Visible = (myActivatyVO.is_showperson_fix2 == "Y");

        (FormView_fixA.FindControl("tr_person_fix2").FindControl("lblAf2Start") as Label).Text = myActivatyVO.personextcount_min.ToString();
        (FormView_fixA.FindControl("tr_person_fix2").FindControl("lblAf2End") as Label).Text   = myActivatyVO.personextcount_max.ToString();

        RangeValidator myRangeValidator = (FormView_fixA.FindControl("tr_person_fix2").FindControl("chk_txtperson_fix2_3") as RangeValidator);

        myRangeValidator.MinimumValue = myActivatyVO.personextcount_min.ToString();
        myRangeValidator.MaximumValue = myActivatyVO.personextcount_max.ToString();

        if (myActivatyVO.is_showperson_fix1 == "Y" || myActivatyVO.is_showperson_fix2 == "Y")
        {
            Session["ShowPanel"] = true;
        }
    }
Пример #4
0
    //存檔
    protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        if (MyFormMode == FormViewMode.ReadOnly)
        {
            //ACMS.DAO.LoginDAO myLoginDAO = new ACMS.DAO.LoginDAO();
            //string UserData;

            //string userName = Context.User.Identity.Name;
            //userName = userName.Substring(userName.IndexOf("\\") + 1);
            //myLoginDAO.CheckLogin(userName, out UserData);
            //if (UserData.IndexOf("1") == -1  &&   UserData.IndexOf("2") == -1)//是活動管理者導回報名狀態查詢
            //{

            //    Response.Redirect("ActivityQuery.aspx");
            //}

            if (Session["History"] == null)
            {
                Response.Redirect("ActivityQuery.aspx");
            }
            else
            {
                Response.Redirect("HistoryActivityQuery.aspx?type=off");
            }
        }
        if (txtnotice.Text.Trim() == "")
        {
            clsMyObj.ShowMessage("注意事項不可空白");
            return;
        }

        ACMS.VO.ActivatyVO myActivatyVO = new ACMS.VO.ActivatyVO();

        myActivatyVO.id = ActivityID;
        myActivatyVO.activity_type = ActivityType;
        myActivatyVO.activity_info = FCKeditor1.Value ;
        myActivatyVO.org_id = ((DropDownList)FormView1.FindControl("ddlorg_id")).SelectedValue;
        myActivatyVO.activity_name = ((TextBox)FormView1.FindControl("txtactivity_name")).Text;
        myActivatyVO.people_type = ((TextBox)FormView1.FindControl("txtpeople_type")).Text;
        myActivatyVO.activity_startdate = ((WebForm_DatetimePicker)FormView1.FindControl("txtactivity_startdate")).DateTimeValue;
        myActivatyVO.activity_enddate = ((WebForm_DatetimePicker)FormView1.FindControl("txtactivity_enddate")).DateTimeValue;
        if (((TextBox)FormView1.FindControl("txtlimit_count")).Text == "" || ((TextBox)FormView1.FindControl("txtlimit_count")).Text == "無上限")
        {
            ((TextBox)FormView1.FindControl("txtlimit_count")).Text = "999999";
            ((TextBox)FormView1.FindControl("txtlimit2_count")).Text = "0";
        }
        if (((TextBox)FormView1.FindControl("txtlimit2_count")).Text == "" || ((TextBox)FormView1.FindControl("txtlimit2_count")).Text == "無")
        {
            ((TextBox)FormView1.FindControl("txtlimit2_count")).Text = "0";
        }
        myActivatyVO.limit_count = Convert.ToInt32(((TextBox)FormView1.FindControl("txtlimit_count")).Text);
        myActivatyVO.limit2_count = Convert.ToInt32(((TextBox)FormView1.FindControl("txtlimit2_count")).Text);

        if (((TextBox)FormView1.FindControl("txtteam_member_max")).Text == "")
        {
            ((TextBox)FormView1.FindControl("txtteam_member_max")).Text = "0";
        }
        if (((TextBox)FormView1.FindControl("txtteam_member_min")).Text == "")
        {
            ((TextBox)FormView1.FindControl("txtteam_member_min")).Text = "0";
        }

        if (ActivityType == "2")
        {
            myActivatyVO.team_member_max = Convert.ToInt32(((TextBox)FormView1.FindControl("txtteam_member_max")).Text);
            myActivatyVO.team_member_min = Convert.ToInt32(((TextBox)FormView1.FindControl("txtteam_member_min")).Text);
        }

        myActivatyVO.regist_startdate = Convert.ToDateTime(((TextBox)FormView1.FindControl("txtregist_startdate")).Text);
        myActivatyVO.regist_deadline = Convert.ToDateTime(((TextBox)FormView1.FindControl("txtregist_deadline")).Text);
        myActivatyVO.cancelregist_deadline = Convert.ToDateTime(((TextBox)FormView1.FindControl("txtcancelregist_deadline")).Text);
        myActivatyVO.is_showfile = "Y";
        myActivatyVO.is_showprogress = ((CheckBox)FormView1.FindControl("chkis_showprogres")).Checked == true ? "Y" : "N";

        myActivatyVO.is_showperson_fix1 = ((CheckBox)FormView2.FindControl("chkis_showperson_fix1")).Checked == true ? "Y" : "N";
        myActivatyVO.is_showperson_fix2 = ((CheckBox)FormView2.FindControl("chkis_showperson_fix2")).Checked == true ? "Y" : "N";

        if (((TextBox)FormView2.FindControl("txtpersonextcount_max")).Text == "")
        {
            ((TextBox)FormView2.FindControl("txtpersonextcount_max")).Text = "0";
        }
        if (((TextBox)FormView2.FindControl("txtpersonextcount_min")).Text == "")
        {
            ((TextBox)FormView2.FindControl("txtpersonextcount_min")).Text = "0";
        }
        if (ActivityType == "1")
        {

            myActivatyVO.personextcount_max = Convert.ToInt32(((TextBox)FormView2.FindControl("txtpersonextcount_max")).Text);
            myActivatyVO.personextcount_min = Convert.ToInt32(((TextBox)FormView2.FindControl("txtpersonextcount_min")).Text);
        }
        myActivatyVO.is_showidno = ((CheckBox)FormView2.FindControl("chkis_showidno")).Checked == true ? "Y" : "N";
        myActivatyVO.is_showremark = ((CheckBox)FormView2.FindControl("chkis_showremark")).Checked == true ? "Y" : "N";
        myActivatyVO.remark_name = ((TextBox)FormView2.FindControl("txtremark_name")).Text;

        myActivatyVO.is_showteam_fix1 = ((CheckBox)FormView2.FindControl("chkis_showteam_fix1")).Checked == true ? "Y" : "N";
        myActivatyVO.is_showteam_fix2 = ((CheckBox)FormView2.FindControl("chkis_showteam_fix2")).Checked == true ? "Y" : "N";

        if (((TextBox)FormView2.FindControl("txtteamextcount_max")).Text == "")
        {
            ((TextBox)FormView2.FindControl("txtteamextcount_max")).Text = "0";
        }

        if (((TextBox)FormView2.FindControl("txtteamextcount_min")).Text == "")
        {
            ((TextBox)FormView2.FindControl("txtteamextcount_min")).Text = "0";
        }

        if (ActivityType == "2" && chkis_showteam_fix2.Checked==true)
        {
            myActivatyVO.teamextcount_max = Convert.ToInt32(((TextBox)FormView2.FindControl("txtteamextcount_max")).Text);
            myActivatyVO.teamextcount_min = Convert.ToInt32(((TextBox)FormView2.FindControl("txtteamextcount_min")).Text);
        }

        myActivatyVO.is_grouplimit = rblgrouplimit.SelectedValue;
        myActivatyVO.notice = txtnotice.Text;
        myActivatyVO.active = "Y";
        myActivatyVO.Send1DayMail = ((CheckBox)FormView1.FindControl("cbSend1DayMail")).Checked;
        myActivatyVO.Send3DayMail = ((CheckBox)FormView1.FindControl("cbSend3DayMail")).Checked;
        myActivatyVO.SendUnregist = ((CheckBox)FormView1.FindControl("cbSendUnregist")).Checked;
        try
        {
            ACMS.DAO.ActivatyDAO myActivatyDAO = new ACMS.DAO.ActivatyDAO();
            myActivatyDAO.UpdateActivaty(myActivatyVO);

        }
        catch (Exception ex)
        {
            clsMyObj.ShowMessage("存檔失敗!");
            WriteErrorLog("SaveData", ex.Message, "0");
        }

        Response.Redirect("ActivityEditQuery.aspx");
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //族群限定的上傳與匯出
        (this.Master.Master.FindControl("ScriptManager1") as ScriptManager).RegisterPostBackControl(btnUpload_GroupLimit);
        (this.Master.Master.FindControl("ScriptManager1") as ScriptManager).RegisterPostBackControl(btnExport_GroupLimit);

        if (!IsPostBack)
        {
            Wizard1.ActiveStepIndex = 0;
            //取得必要的Session
            if (Session["form_mode"] == null)
            {
                Response.Redirect("ActivityEditQuery.aspx");
            }

            //編輯時須帶入activity_id
            if (Session["form_mode"].ToString() != "new" && Session["activity_id"] == null)
            {
                Response.Redirect("ActivityEditQuery.aspx");
            }

            //取得FormView外的欄位初始值
            ACMS.DAO.ActivatyDAO myActivatyDAO = new ACMS.DAO.ActivatyDAO();
            ACMS.VO.ActivatyVO myActivatyVO = new ACMS.VO.ActivatyVO();

            if (Session["form_mode"].ToString() == "new")
            {
                //新增模式
                MyFormMode = FormViewMode.Insert;
                ActivityType= Session["activity_type"].ToString();

                //新增一筆活動
                myActivatyVO.id = ActivityID;
                myActivatyVO.emp_id = clsAuth.WORK_ID + clsAuth.NATIVE_NAME;
                myActivatyVO.activity_type = ActivityType;
                myActivatyDAO.INSERT_NewOne(myActivatyVO);

                myActivatyVO = myActivatyDAO.SelectActivatyByID(ActivityID);

            }
            else
            {
                ActivityID= new Guid(Session["activity_id"].ToString());
                myActivatyVO = myActivatyDAO.SelectActivatyByID(ActivityID);

                ActivityType = myActivatyVO.activity_type;

                if (Session["form_mode"].ToString() == "edit")
                {
                    //編輯模式
                    MyFormMode = FormViewMode.Edit;

                }

                if (Session["form_mode"].ToString() == "readonly" ||  myActivatyVO.activity_enddate< DateTime.Now)
                {
                    //唯讀模式:活動已結束也要是唯讀
                    MyFormMode = FormViewMode.ReadOnly;

                    //FCKeditor1.Visible = false;
                    FCKeditor1.Visible = false;
                    liactivity_info.Visible = true;

                    rblgrouplimit.Enabled = false;
                    Panel_GroupLimit.Enabled = false;
                    FormView2.Enabled = false;
                    FormView1.Enabled = false;
                    txtnotice.Enabled = false;
                    PanelCustomFieldC.Enabled = false;
                    plCoompanyLimit.Enabled  = false;
                }

            }
            if (Session["History"] != null)
            {
                FCKeditor1.Visible = false;
                liactivity_info.Visible = true;
            }

            Session["form_mode"] = null;
            Session["activity_type"] = null;
            Session["activity_id"] = null;

            //取得FormView外的欄位初始值
            FCKeditor1.Value = myActivatyVO.activity_info;
            liactivity_info.Text = myActivatyVO.activity_info;

            rblgrouplimit.SelectedValue = myActivatyVO.is_grouplimit;
            //if (rblgrouplimit.SelectedValue == "Y")//檢查是否可以運作
            //{
            //    FileUpload_GroupLimit.Enabled = true;
            //    btnUpload_GroupLimit.Enabled = true;
            //    HyperLink1.Enabled = true;
            //    btnAdd_GroupLimit.Enabled = true;
            //    btnExport_GroupLimit.Enabled = true;
            //}
            //else
            //{
            //    FileUpload_GroupLimit.Enabled = false;
            //    btnUpload_GroupLimit.Enabled = false;
            //    HyperLink1.Enabled = false;
            //    btnAdd_GroupLimit.Enabled = false;
            //    btnExport_GroupLimit.Enabled = false;
            //}

            if (rblgrouplimit.SelectedValue == "Y")
            {

                FileUpload_GroupLimit.Enabled = true;
                HyperLink1.Enabled = true;
                btnAdd_GroupLimit.Enabled = true;
                btnExport_GroupLimit.Enabled = true;
                btnUpload_GroupLimit.Enabled = true;
                Panel_GroupLimit.Visible = true;
                GridView_GroupLimit .Visible = true;
                plCoompanyLimit.Visible = true;
            }
            else
            {

                GridView_GroupLimit.Visible = false;
                plCoompanyLimit.Visible = false ;
            }

            //如果已經過了活動開始報名日,則某些功能需唯讀
            if (myActivatyVO.regist_startdate <= DateTime.Now)
            {
                FormView1.Enabled = false;
                FormView2.Enabled = false;
                PanelCustomFieldC.Enabled = false;
                rblgrouplimit.Enabled = false;
                Panel_GroupLimit.Enabled = false;
                plCoompanyLimit.Enabled  = false;
            }
            else
            {
                if (rblgrouplimit.SelectedValue == "Y")//檢查是否可以運作
                {
                    FileUpload_GroupLimit.Enabled = true;
                    HyperLink1.Enabled = true;
                    btnAdd_GroupLimit.Enabled = true;
                    btnExport_GroupLimit.Enabled = true;
                    btnUpload_GroupLimit.Enabled = true;
                    Panel_GroupLimit.Visible = true;
                    plCoompanyLimit.Enabled  = true;
                }
                else
                {
                    FileUpload_GroupLimit.Enabled = false;
                    HyperLink1.Enabled = false;
                    btnAdd_GroupLimit.Enabled = false;
                    btnExport_GroupLimit.Enabled = false;
                    btnUpload_GroupLimit.Enabled = false;
                    Panel_GroupLimit.Visible = false;
                    plCoompanyLimit.Enabled  = false;
                }

            }

            txtnotice.Text = myActivatyVO.notice;

            //活動資訊-活動內容
            ObjectDataSource_Activaty.SelectParameters["id"].DefaultValue = ActivityID.ToString();
            //活動資訊-上傳檔
            ObjectDataSource_UpFiles.SelectParameters["dirName"].DefaultValue = Server.MapPath(Path.Combine("~/UpFiles", ActivityID.ToString()));

            //個人固定欄位
            ObjectDataSource_Activaty2.SelectParameters["id"].DefaultValue = ActivityID.ToString();

            //自訂欄位
            ObjectDataSource_CustomField.SelectParameters["activity_id"].DefaultValue = ActivityID.ToString();

            //族群限定
            ObjectDataSource_GroupLimit.SelectParameters["activity_id"].DefaultValue = ActivityID.ToString();

            if (ActivityType == "1")
            {
                (this.Master as MyMasterPage).PanelMainGroupingText = "新增個人活動";
                (FormView1.FindControl("lbllimit_count") as Literal).Visible = true;
                (FormView1.FindControl("lbllimit2_count") as Literal).Visible = true;
                //(FormView1.FindControl("chk_txtlimit_count") as RequiredFieldValidator).ErrorMessage = "活動人數上限必填";
               // (FormView1.FindControl("chk_txtlimit_count2") as CompareValidator).ErrorMessage = "活動人數上限必填數字";
                //(FormView1.FindControl("chk_txtlimit2_count") as RequiredFieldValidator).ErrorMessage = "活動備取人數必填";
               // (FormView1.FindControl("chk_txtlimit2_count2") as CompareValidator).ErrorMessage = "活動備取人數必填數字";
                (FormView1.FindControl("trteam_member_max") as System.Web.UI.HtmlControls.HtmlTableRow).Visible = false;
                (FormView1.FindControl("trteam_member_min") as System.Web.UI.HtmlControls.HtmlTableRow).Visible = false;

                (FormView2.FindControl("PanelCustomFieldA1") as Panel).Visible = true;
                (FormView2.FindControl("PanelCustomFieldB1") as Panel).Visible = false;
                (FormView2.FindControl("PanelCustomFieldB2") as Panel).Visible = false;

                //PanelCustomFieldC.GroupingText = "個人自訂欄位";
            }
            else
            {
                (this.Master as MyMasterPage).PanelMainGroupingText = "新增團隊活動";
                (FormView1.FindControl("lbllimit_count_team") as Literal).Visible = true;
                (FormView1.FindControl("lbllimit2_count_team") as Literal).Visible = true;
                //(FormView1.FindControl("chk_txtlimit_count") as RequiredFieldValidator).ErrorMessage = "活動隊數上限必填";
               // (FormView1.FindControl("chk_txtlimit_count2") as CompareValidator).ErrorMessage = "活動隊數上限必填數字";
                //(FormView1.FindControl("chk_txtlimit2_count") as RequiredFieldValidator).ErrorMessage = "活動備取隊數必填";
               // (FormView1.FindControl("chk_txtlimit2_count2") as CompareValidator).ErrorMessage = "活動備取隊數必填數字";

                (FormView1.FindControl("trteam_member_max") as System.Web.UI.HtmlControls.HtmlTableRow).Visible = true;
                (FormView1.FindControl("trteam_member_min") as System.Web.UI.HtmlControls.HtmlTableRow).Visible = true;

                (FormView2.FindControl("PanelCustomFieldA1") as Panel).Visible = false;
                (FormView2.FindControl("PanelCustomFieldB1") as Panel).Visible = true;
                (FormView2.FindControl("PanelCustomFieldB2") as Panel).Visible = true;

                //PanelCustomFieldC.GroupingText = "團隊自訂欄位";

            }

            //andy 從報名狀況查詢進來的即使已經開始報名也要新增限制人員群組//原來活動是要有限制族群的才需要打開限制人群的管制
            if (MyFormMode == FormViewMode.ReadOnly && (myActivatyVO.activity_enddate > DateTime.Now) && myActivatyVO.is_grouplimit == "Y"  )
            {

                //GridView_GroupLimit.Enabled = false;

                rblgrouplimit.Enabled = true;
                Panel_GroupLimit.Enabled = true;
                GridView_GroupLimit.Columns[3].Visible = false;
                GridView_GroupLimit.DataBind();
                plCoompanyLimit.Enabled = true;

            }

            if (myActivatyVO.regist_deadline < DateTime.Today)
            {
               // GridView_GroupLimit.Enabled = false;

                rblgrouplimit.Enabled = false ;
                Panel_GroupLimit.Enabled = false ;
                GridView_GroupLimit.Columns[3].Visible = false;
                GridView_GroupLimit.DataBind();
                plCoompanyLimit.Enabled  = false ;
            }

        }
    }
Пример #6
0
    //步驟存檔
    private void saveStep()
    {
        if (MyFormMode == FormViewMode.ReadOnly)
        {
            return;
        }

        ACMS.VO.ActivatyVO myActivatyVO = new ACMS.VO.ActivatyVO();

        myActivatyVO.id = ActivityID;
        myActivatyVO.activity_type = ActivityType;
        myActivatyVO.activity_info = FCKeditor1.Value;
        myActivatyVO.org_id = ((DropDownList)FormView1.FindControl("ddlorg_id")).SelectedValue;
        myActivatyVO.activity_name = ((TextBox)FormView1.FindControl("txtactivity_name")).Text;
        myActivatyVO.people_type = ((TextBox)FormView1.FindControl("txtpeople_type")).Text;
        myActivatyVO.activity_startdate = ((WebForm_DatetimePicker)FormView1.FindControl("txtactivity_startdate")).DateTimeValue;
        myActivatyVO.activity_enddate = ((WebForm_DatetimePicker)FormView1.FindControl("txtactivity_enddate")).DateTimeValue;
        if (((TextBox)FormView1.FindControl("txtlimit_count")).Text == "" || ((TextBox)FormView1.FindControl("txtlimit_count")).Text == "無上限")
        {
            myActivatyVO.limit_count =999999;
            myActivatyVO.limit2_count = 0;
        }
        if (((TextBox)FormView1.FindControl("txtlimit2_count")).Text == "" || ((TextBox)FormView1.FindControl("txtlimit2_count")).Text == "無")
        {
            myActivatyVO.limit2_count = 0;
        }
        try
        {
        myActivatyVO.limit_count = Convert.ToInt32(((TextBox)FormView1.FindControl("txtlimit_count")).Text);
        myActivatyVO.limit2_count = Convert.ToInt32(((TextBox)FormView1.FindControl("txtlimit2_count")).Text);
        }
        catch
        {}

        if (((TextBox)FormView1.FindControl("txtteam_member_max")).Text == "")
        {
            ((TextBox)FormView1.FindControl("txtteam_member_max")).Text = "0";
        }
        if (((TextBox)FormView1.FindControl("txtteam_member_min")).Text == "")
        {
            ((TextBox)FormView1.FindControl("txtteam_member_min")).Text = "0";
        }

        if (ActivityType == "2")
        {
            myActivatyVO.team_member_max = Convert.ToInt32(((TextBox)FormView1.FindControl("txtteam_member_max")).Text);
            myActivatyVO.team_member_min = Convert.ToInt32(((TextBox)FormView1.FindControl("txtteam_member_min")).Text);
        }
        try
        {
            myActivatyVO.regist_startdate = Convert.ToDateTime(((TextBox)FormView1.FindControl("txtregist_startdate")).Text);
            myActivatyVO.regist_deadline = Convert.ToDateTime(((TextBox)FormView1.FindControl("txtregist_deadline")).Text);
            myActivatyVO.cancelregist_deadline = Convert.ToDateTime(((TextBox)FormView1.FindControl("txtcancelregist_deadline")).Text);
        }
        catch
        { }

        myActivatyVO.is_showfile = "Y";
        myActivatyVO.is_showprogress = ((CheckBox)FormView1.FindControl("chkis_showprogres")).Checked == true ? "Y" : "N";

        myActivatyVO.is_showperson_fix1 = ((CheckBox)FormView2.FindControl("chkis_showperson_fix1")).Checked == true ? "Y" : "N";
        myActivatyVO.is_showperson_fix2 = ((CheckBox)FormView2.FindControl("chkis_showperson_fix2")).Checked == true ? "Y" : "N";

        if (((TextBox)FormView2.FindControl("txtpersonextcount_max")).Text == "")
        {
            ((TextBox)FormView2.FindControl("txtpersonextcount_max")).Text = "0";
        }
        if (((TextBox)FormView2.FindControl("txtpersonextcount_min")).Text == "")
        {
            ((TextBox)FormView2.FindControl("txtpersonextcount_min")).Text = "0";
        }
        if (ActivityType == "1")
        {

            myActivatyVO.personextcount_max = Convert.ToInt32(((TextBox)FormView2.FindControl("txtpersonextcount_max")).Text);
            myActivatyVO.personextcount_min = Convert.ToInt32(((TextBox)FormView2.FindControl("txtpersonextcount_min")).Text);
        }
        myActivatyVO.is_showidno = ((CheckBox)FormView2.FindControl("chkis_showidno")).Checked == true ? "Y" : "N";
        myActivatyVO.is_showremark = ((CheckBox)FormView2.FindControl("chkis_showremark")).Checked == true ? "Y" : "N";
        myActivatyVO.remark_name = ((TextBox)FormView2.FindControl("txtremark_name")).Text;

        myActivatyVO.is_showteam_fix1 = ((CheckBox)FormView2.FindControl("chkis_showteam_fix1")).Checked == true ? "Y" : "N";
        myActivatyVO.is_showteam_fix2 = ((CheckBox)FormView2.FindControl("chkis_showteam_fix2")).Checked == true ? "Y" : "N";

        if (((TextBox)FormView2.FindControl("txtteamextcount_max")).Text == "")
        {
            ((TextBox)FormView2.FindControl("txtteamextcount_max")).Text = "0";
        }

        if (((TextBox)FormView2.FindControl("txtteamextcount_min")).Text == "")
        {
            ((TextBox)FormView2.FindControl("txtteamextcount_min")).Text = "0";
        }

        if (ActivityType == "2" && chkis_showteam_fix2.Checked == true)
        {
            myActivatyVO.teamextcount_max = Convert.ToInt32(((TextBox)FormView2.FindControl("txtteamextcount_max")).Text);
            myActivatyVO.teamextcount_min = Convert.ToInt32(((TextBox)FormView2.FindControl("txtteamextcount_min")).Text);
        }

        myActivatyVO.is_grouplimit = rblgrouplimit.SelectedValue;
        myActivatyVO.notice = txtnotice.Text;
        myActivatyVO.active = "";
        try
        {
            myActivatyVO.Send1DayMail = ((CheckBox)FormView1.FindControl("cbSend1DayMail")).Checked;
            myActivatyVO.Send3DayMail = ((CheckBox)FormView1.FindControl("cbSend3DayMail")).Checked;
            myActivatyVO.SendUnregist = ((CheckBox)FormView1.FindControl("cbSendUnregist")).Checked;
        }
        catch
        { }

        try
        {
            ACMS.DAO.ActivatyDAO myActivatyDAO = new ACMS.DAO.ActivatyDAO();
            myActivatyDAO.UpdateActivaty(myActivatyVO);

        }
        catch (Exception ex)
        {
            clsMyObj.ShowMessage("存檔失敗!");
            WriteErrorLog("SaveData", ex.Message, "0");
        }
    }
    private void GetActivityDefault()
    {
        try
        {
            //取得活動資訊
            ACMS.DAO.ActivatyDAO myActivatyDAO = new ACMS.DAO.ActivatyDAO();
            ACMS.VO.ActivatyVO myActivatyVO = myActivatyDAO.SelectActivatyByID(ActivityID);

            //報名截止日後要唯讀
            if (myActivatyVO.regist_deadline < DateTime.Today)
            {
                MyFormMode = FormViewMode.ReadOnly;
                Panel_TeamFix.Enabled = false;
                PanelTeamMember.Enabled = false;
                PanelCustomFieldA1.Enabled = false;
            }
            if (MyFormMode == FormViewMode.Edit)
            {
                Wizard1.FindControl("FinishNavigationTemplateContainerID$btnHome").Visible = true;
                ((Button)Wizard1.FindControl("FinishNavigationTemplateContainerID$FinishButton")).Text = "儲存並發送確認信";
            }
            //活動海報訊息
            Literal1.Text = myActivatyVO.activity_info;

            //活動相關訊息
            ObjectDataSource_ActivatyDetails.SelectParameters["id"].DefaultValue = ActivityID.ToString();
            ObjectDataSource_UpFiles.SelectParameters["dirName"].DefaultValue = Server.MapPath(Path.Combine("~/UpFiles", ActivityID.ToString()));

            //注意事項
            Literal_notice.Text = myActivatyVO.notice.Replace("\r\n", "<br />");

            //團隊固定欄位
            tr_showteam_fix1.Visible = (myActivatyVO.is_showteam_fix1 == "Y");
            tr_showteam_fix2.Visible = (myActivatyVO.is_showteam_fix2 == "Y");

            if (myActivatyVO.is_showteam_fix1 != "Y" && myActivatyVO.is_showteam_fix2 != "Y")
            {
                Panel_TeamFix.Visible = false;
            }
            //if (tr_showteam_fix1.Visible || tr_showteam_fix2.Visible)
            //{
            //    Session["ShowPanel"] = true;
            //}

            lbltext_peopleStart.Text = myActivatyVO.teamextcount_min.ToString();
            lbltext_peopleEnd.Text = myActivatyVO.teamextcount_max.ToString();

            chk_text_people3.MinimumValue = myActivatyVO.teamextcount_min.ToString();
            chk_text_people3.MaximumValue = myActivatyVO.teamextcount_max.ToString();

            //個人欄位
            //Page_is_showperson_fix1 = myActivatyVO.is_showperson_fix1;
            //Page_is_showperson_fix2 = myActivatyVO.is_showperson_fix2;
            ACMS.BO.CustomFieldBO myCustFieldBo = new ACMS.BO.CustomFieldBO();
            if (myCustFieldBo.SelectByActivity_id(ActivityID).Count > 0)
            {
                Session["ShowPanel"] = true;

            }

            (OpenTeamPersonInfo1.FindControl("tr_idno") as System.Web.UI.HtmlControls.HtmlTableRow).Visible = (myActivatyVO.is_showidno == "Y");
            (OpenTeamPersonInfo1.FindControl("tr_remark") as System.Web.UI.HtmlControls.HtmlTableRow).Visible = (myActivatyVO.is_showremark == "Y");

            (OpenTeamPersonInfo1.FindControl("lblRemark") as Label).Text = myActivatyVO.remark_name;
            (OpenTeamPersonInfo1.FindControl("chk_txtremark") as RequiredFieldValidator).ErrorMessage = string.Format("{0}必填", myActivatyVO.remark_name);

            if (myActivatyVO.is_showidno == "N" && myActivatyVO.is_showremark == "N")
            {
                IsPersonInfoRequired = false;
                GridView_TemMember.Columns[3].Visible = false;
                GridView_TemMember.Columns[4].Visible = false;
            }
            else
            {
                IsPersonInfoRequired = true;
            }

            Page_team_member_min = myActivatyVO.team_member_min;
            Page_team_member_max = myActivatyVO.team_member_max;

            //FormView_fixA.DataBind();
            //FormView_fixA.FindControl("tr_person_fix1").Visible = (myActivatyVO.is_showperson_fix1 == "Y");
            //FormView_fixA.FindControl("tr_person_fix2").Visible = (myActivatyVO.is_showperson_fix2 == "Y");

            //(FormView_fixA.FindControl("tr_person_fix2").FindControl("lblAf2Start") as Label).Text = myActivatyVO.personextcount_min.ToString();
            //(FormView_fixA.FindControl("tr_person_fix2").FindControl("lblAf2End") as Label).Text = myActivatyVO.personextcount_max.ToString();

            //RangeValidator myRangeValidator = (FormView_fixA.FindControl("tr_person_fix2").FindControl("chk_txtperson_fix2_3") as RangeValidator);
            //myRangeValidator.MinimumValue = myActivatyVO.personextcount_min.ToString();
            //myRangeValidator.MaximumValue = myActivatyVO.personextcount_max.ToString();
        }
        catch (Exception ex)
        {
            WriteErrorLog("GetDefault", ex.Message, "0");

        }
    }
    //刪除活動
    protected void lbtnDelActivaty_Click(object sender, EventArgs e)
    {
        try
        {
            string theGUID = GridView1.DataKeys[((sender as LinkButton).NamingContainer as GridViewRow).RowIndex].Value.ToString();

            ACMS.DAO.ActivatyDAO myActivatyDAO = new ACMS.DAO.ActivatyDAO();

            myActivatyDAO.DeleteActivatyByID(theGUID);

            //刪除相關檔案
            DirectoryInfo myDirectoryInfo = new DirectoryInfo(Server.MapPath(Path.Combine("~/UpFiles", theGUID)));

            if (myDirectoryInfo.Exists)
            {
                myDirectoryInfo.Delete(true);
            }

            GridView1.DataBind();
        }
        catch (Exception ex)

        {
            WriteErrorLog("DeleteActivity", ex.Message, "0");
        }
    }
    private void GetActivityDefault()
    {
        try
        {
            InitQueryBlock(ActivityID.ToString());
            //取得活動資訊
            ACMS.DAO.ActivatyDAO myActivatyDAO = new ACMS.DAO.ActivatyDAO();
            ACMS.VO.ActivatyVO myActivatyVO = myActivatyDAO.SelectActivatyByID(ActivityID);

            //報名截止日後要唯讀
            if (myActivatyVO.regist_deadline < DateTime.Today)
            {
                MyFormMode = FormViewMode.ReadOnly;
                //GridView_RegisterPeoplinfo.Enabled = false;
                PanelCustomFieldA1.Enabled = false;
            }
            if (MyFormMode == FormViewMode.Edit)
            {
                Wizard1.FindControl("FinishNavigationTemplateContainerID$btnHome").Visible = true;
                ((Button)Wizard1.FindControl("FinishNavigationTemplateContainerID$FinishButton")).Text = "儲存並發送確認信";
            }
            //活動海報訊息
            Literal1.Text = myActivatyVO.activity_info;

            //活動相關訊息
            ObjectDataSource_ActivatyDetails.SelectParameters["id"].DefaultValue = ActivityID.ToString();
            ObjectDataSource_UpFiles.SelectParameters["dirName"].DefaultValue = Server.MapPath(Path.Combine("~/UpFiles", ActivityID.ToString()));

            //報名者資訊
            ObjectDataSource_RegisterPersonInfo.SelectParameters["emp_id"].DefaultValue = clsAuth.ID;//預設登入者

            //所有報名者資訊
            ObjectDataSource_RegisterPeoplenfo.SelectParameters["activity_id"].DefaultValue = ActivityID.ToString();
            ObjectDataSource_RegisterPeoplenfo.SelectParameters["emp_id"].DefaultValue = RegistBy;//由登入者所報名(含登入者本人)

            //注意事項
            Literal_notice.Text = myActivatyVO.notice.Replace("\r\n", "<br />");

            FormView_fixA.DataBind();
            ACMS.BO.CustomFieldBO myCustFieldBo = new ACMS.BO.CustomFieldBO();
            if (myCustFieldBo.SelectByActivity_id(ActivityID).Count > 0)
            {
                Session["ShowPanel"] = true;

            }
        }
        catch (Exception ex)
        {
            WriteErrorLog("GetDefault", ex.Message, "0");

        }
        //FormView_fixA.FindControl("tr_person_fix1").Visible = (myActivatyVO.is_showperson_fix1 == "Y");
        //FormView_fixA.FindControl("tr_person_fix2").Visible = (myActivatyVO.is_showperson_fix2 == "Y");

        //(FormView_fixA.FindControl("tr_person_fix2").FindControl("lblAf2Start") as Label).Text = myActivatyVO.personextcount_min.ToString();
        //(FormView_fixA.FindControl("tr_person_fix2").FindControl("lblAf2End") as Label).Text = myActivatyVO.personextcount_max.ToString();

        //RangeValidator myRangeValidator = (FormView_fixA.FindControl("tr_person_fix2").FindControl("chk_txtperson_fix2_3") as RangeValidator);
        //myRangeValidator.MinimumValue = myActivatyVO.personextcount_min.ToString();
        //myRangeValidator.MaximumValue = myActivatyVO.personextcount_max.ToString();
    }
    protected void FormView_fixA_DataBound(object sender, EventArgs e)
    {
        ACMS.DAO.ActivatyDAO myActivatyDAO = new ACMS.DAO.ActivatyDAO();
        ACMS.VO.ActivatyVO myActivatyVO = myActivatyDAO.SelectActivatyByID(ActivityID);

        FormView_fixA.FindControl("tr_person_fix1").Visible = (myActivatyVO.is_showperson_fix1 == "Y");
        FormView_fixA.FindControl("lblID").Visible = (myActivatyVO.is_showperson_fix1 == "Y");

        FormView_fixA.FindControl("tr_person_fix2").Visible = (myActivatyVO.is_showperson_fix2 == "Y");
        FormView_fixA.FindControl("tr_person_fix21").Visible = (myActivatyVO.is_showperson_fix2 == "Y");

        (FormView_fixA.FindControl("tr_person_fix2").FindControl("lblAf2Start") as Label).Text = myActivatyVO.personextcount_min.ToString();
        (FormView_fixA.FindControl("tr_person_fix2").FindControl("lblAf2End") as Label).Text = myActivatyVO.personextcount_max.ToString();

        RangeValidator myRangeValidator = (FormView_fixA.FindControl("tr_person_fix2").FindControl("chk_txtperson_fix2_3") as RangeValidator);
        myRangeValidator.MinimumValue = myActivatyVO.personextcount_min.ToString();
        myRangeValidator.MaximumValue = myActivatyVO.personextcount_max.ToString();

        if (myActivatyVO.is_showperson_fix1 == "Y" || myActivatyVO.is_showperson_fix2 == "Y")
        {
            Session["ShowPanel"] = true;
        }
    }