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

        myActivityRegistVO.activity_id = ActivityID;
        myActivityRegistVO.emp_id = EmpID;//若是團員近來修改個人欄位時,此值會是團員ID,所以不能存ActivityRegist 只能存ActivityTeamMember
        myActivityRegistVO.regist_by = RegistBy;
        myActivityRegistVO.idno = "";
        myActivityRegistVO.team_name = txtteam_name.Text;
        myActivityRegistVO.ext_people = (txtext_people.Text == "" ? 0 : Convert.ToInt32(txtext_people.Text));

        return myActivityRegistVO;
    }
예제 #2
0
        //取得報名資訊-個人活動   為了組成個人固定欄位
        /// <summary>
        /// 取得報名資訊-個人活動   為了組成個人固定欄位
        /// </summary>
        /// <param name="activity_id">活動代號</param>
        /// <param name="emp_id">員工</param>
        /// <returns>取得報名資訊-個人活動   為了組成個人固定欄位</returns>
        public VO.ActivityRegistVO SelectActivityRegistByPK(Guid activity_id, string emp_id)
        {
            SqlParameter[] sqlParams = new SqlParameter[2];

            sqlParams[0] = new SqlParameter("@activity_id", SqlDbType.UniqueIdentifier);
            sqlParams[0].Value = activity_id;
            sqlParams[1] = new SqlParameter("@emp_id", SqlDbType.NVarChar, 100);
            sqlParams[1].Value = emp_id;

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("SELECT * ");
            sb.AppendLine("FROM ActivityRegist ");
            sb.AppendLine("WHERE 1=1 ");
            sb.AppendLine("AND activity_id=@activity_id ");
            sb.AppendLine("AND emp_id=@emp_id ");
            SqlConnection aconn = MyConn();
            SqlDataReader MyDataReader = SqlHelper.ExecuteReader(aconn, CommandType.Text, sb.ToString(), sqlParams);

            VO.ActivityRegistVO myActivityRegistVO = new ACMS.VO.ActivityRegistVO();

            while (MyDataReader.Read())
            {
                myActivityRegistVO.id = (int)MyDataReader["id"];
                myActivityRegistVO.activity_id = (Guid)MyDataReader["activity_id"];
                myActivityRegistVO.emp_id = (string)MyDataReader["emp_id"];
                myActivityRegistVO.regist_by = (string)MyDataReader["regist_by"];
                myActivityRegistVO.idno_type = (int)MyDataReader["idno_type"];
                myActivityRegistVO.idno = (string)MyDataReader["idno"];
                myActivityRegistVO.ext_people = (int?)(MyDataReader["ext_people"] == DBNull.Value ? null : MyDataReader["ext_people"]);
                myActivityRegistVO.createat = (DateTime)MyDataReader["createat"];
                myActivityRegistVO.check_status = (int)MyDataReader["check_status"];
                myActivityRegistVO.team_name = (string)MyDataReader["team_name"];
                //myActivityRegistVO.idno_ext = MyDataReader["idno_ext"].ToString();
            }
            MyDataReader.Close();
            aconn.Close();
            if (MyDataReader != null) MyDataReader.Dispose();
            if (aconn != null) aconn.Dispose();
            return myActivityRegistVO;
        }
    //編輯
    protected void GoThirdStep_Click(object sender, RegistGoSecondEventArgs e)
    {
        try
        {
            RegistActivity_Query1.Visible = false;
            Wizard1.Visible = true;

            //必要屬性
            MyFormMode = FormViewMode.Edit;
            ActivityID = new Guid(Session["activity_id"].ToString());

            //載入報名資訊
            ACMS.DAO.ActivityRegistDAO myActivityRegistDAO = new ACMS.DAO.ActivityRegistDAO();
            ACMS.VO.ActivityRegistVO myActivityRegistVO = new ACMS.VO.ActivityRegistVO();

            myActivityRegistVO = myActivityRegistDAO.SelectActivityRegistByMemberID(ActivityID, clsAuth.ID);

            EmpID = clsAuth.ID;
            RegistBy = myActivityRegistVO.regist_by;

            MyHiddenField.Value = ActivityID.ToString();

            txtteam_name.Text = myActivityRegistVO.team_name;
            txtext_people.Text = myActivityRegistVO.ext_people.ToString();

            //不是團長不可編輯
            if (EmpID != RegistBy)
            {
                txtteam_name.Enabled = false;
                txtext_people.Enabled = false;

                btnAddTeamMember.Visible = false;
                //自訂欄位
                PanelCustomFieldA1.Enabled = false;
            }

            //載入活動資訊
            GetActivityDefault();

            //編輯時,帶入資料庫資料

            ACMS.DAO.ActivityTeamMemberDAO myActivityTeamMemberDAO = new ACMS.DAO.ActivityTeamMemberDAO();

            Page_ActivityTeamMemberVOList = myActivityTeamMemberDAO.SelectActivityTeamMember(ActivityID, RegistBy);

            GridView_TemMember.DataSource = Page_ActivityTeamMemberVOList;
            GridView_TemMember.DataBind();

            Wizard1.MoveTo(Wizard1.WizardSteps[0]);
            try
            {
                ((Label)FormView_ActivatyDetails.FindControl("activity_startdateLabel")).Text = ((Label)FormView_ActivatyDetails.FindControl("activity_startdateLabel")).Text.Replace("-", "/").Replace("T", " ");
                ((Label)FormView_ActivatyDetails.FindControl("activity_enddateLabel")).Text = ((Label)FormView_ActivatyDetails.FindControl("activity_enddateLabel")).Text.Replace("-", "/").Replace("T", " ");
            }
            catch
            { }
            //if (((Label)FormView_ActivatyDetails.FindControl("limit_countLabel")).Text == "999999")
            //{
            //    ((Label)FormView_ActivatyDetails.FindControl("limit_countLabel")).Text = "無上限";
            //}
            //if (((Label)FormView_ActivatyDetails.FindControl("limit2_countLabel")).Text == "0")
            //{
            //    ((Label)FormView_ActivatyDetails.FindControl("limit2_countLabel")).Text = "無";
            //}

            // InitQueryBlock(ActivityID.ToString());

            //編輯時載入動態欄位資料
            GetDynamicValue();
        }
        catch (Exception ex)
        {
            WriteErrorLog("ThirdStep", ex.Message, "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;
    }