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(); }
//人員切換之後指定EmpID protected void RadioButton1_CheckedChanged(object sender, EventArgs e) { RadioButton RadioButton1 = sender as RadioButton; RadioButton1.Checked = true; GridView_RegisterPeoplinfo.SelectedIndex = (RadioButton1.NamingContainer as GridViewRow).RowIndex; EmpID = GridView_RegisterPeoplinfo.DataKeys[GridView_RegisterPeoplinfo.SelectedIndex].Value.ToString(); //載入個人資訊 //個人固定欄位 ObjectDataSource_fixA.SelectParameters["activity_id"].DefaultValue = ActivityID.ToString(); ObjectDataSource_fixA.SelectParameters["emp_id"].DefaultValue = EmpID; FormView_fixA.DataBind(); //載入動態欄位資料 ACMS.DAO.CustomFieldValueDAO myCustomFieldValueDAO = new ACMS.DAO.CustomFieldValueDAO(); List <ACMS.VO.CustomFieldValueVO> myCustomFieldValueVOList = myCustomFieldValueDAO.SelectCustomFieldValue(ActivityID, EmpID); foreach (ACMS.VO.CustomFieldValueVO myCustomFieldValueVO in myCustomFieldValueVOList) { if (myCustomFieldValueVO.field_control.ToUpper() == "TEXTBOX") { TextBox MyControl = new TextBox(); MyControl.ID = string.Format("txt{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TextBox).Text = myCustomFieldValueVO.field_value; } else if (myCustomFieldValueVO.field_control.ToUpper() == "TEXTBOXLIST") { TCheckBoxList MyControl = new TCheckBoxList(); MyControl.ID = string.Format("plh{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; CheckBoxList1_SelectedIndexChanged((PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList), null); } else if (myCustomFieldValueVO.field_control.ToUpper() == "CHECKBOXLIST") { TCheckBoxList MyControl = new TCheckBoxList(); MyControl.ID = string.Format("cbl{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; } else if (myCustomFieldValueVO.field_control.ToUpper() == "RADIOBUTTONLIST") { TRadioButtonList MyControl = new TRadioButtonList(); MyControl.ID = string.Format("radl{0}", myCustomFieldValueVO.field_id); (MyControl as TRadioButtonList).ClearSelection(); (PlaceHolder1.FindControl(MyControl.ID) as TRadioButtonList).SelectedValue = myCustomFieldValueVO.field_value; } } }