protected void btnQuery_Click(object sender, EventArgs e)
    {
        //this.InitDataAndShow();

        ObjectDataSource1.SelectParameters["activity_id"].DefaultValue = activity_id;

        ObjectDataSource1.SelectParameters["DEPT_ID"].DefaultValue         = ddlDEPT_ID.SelectedItem.Text;
        ObjectDataSource1.SelectParameters["JOB_GRADE_GROUP"].DefaultValue = "999";
        //if (string.Compare(ddlJOB_GRADE_GROUP.SelectedValue, "") == 0)
        //{
        //    ObjectDataSource1.SelectParameters["JOB_GRADE_GROUP"].DefaultValue = "999";
        //}
        //else
        //{
        //    ObjectDataSource1.SelectParameters["JOB_GRADE_GROUP"].DefaultValue = ddlJOB_GRADE_GROUP.SelectedValue;
        //}
        ObjectDataSource1.SelectParameters["WINDOWS_ID"].DefaultValue  = txtWORK_ID.Text;
        ObjectDataSource1.SelectParameters["NATIVE_NAME"].DefaultValue = txtNATIVE_NAME.Text;
        // ObjectDataSource1.SelectParameters["SEX"].DefaultValue = rblSEX.SelectedValue;
        ObjectDataSource1.SelectParameters["SEX"].DefaultValue = "";
        ObjectDataSource1.SelectParameters["EXPERIENCE_START_DATE"].DefaultValue = "1900/1/1";

        ObjectDataSource1.SelectParameters["C_NAME"].DefaultValue    = ddlC_NAME.SelectedValue;
        ObjectDataSource1.SelectParameters["UnderDept"].DefaultValue = cbUnderDept.Checked.ToString();



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

        if (myActivityTeamMemberDAO.IsTeamBoss(new Guid(activity_id), emp_id))
        {
            IsTeamBoss = "1";
        }
        else
        {
            IsTeamBoss = "0";
        }
        GridView1.Visible = true;
        GridView1.DataBind();
        this.mpSearch.Show();
    }
Example #2
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string emp_id1 = "";
        string emp_id2 = "";
        string path    = Server.MapPath("~/UpFiles");

        //  先檢查是否低於下限

        int membersInt = 0;

        foreach (GridViewRow gvr in GridView1.Rows)
        {
            if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == false)
            {
                membersInt += 1;
            }
        }

        ACMS.BO.ActivatyBO aBO = new ACMS.BO.ActivatyBO();
        ACMS.VO.ActivatyVO aVO = aBO.SelectActivatyByActivatyID(new Guid(activity_id));

        if (membersInt < aVO.team_member_min)
        {
            // string sdoPostScript = "  __doPostBack('" + btnCancelAll1.ClientID + "','1');   ";
            // string ScriptAll = " if (confirm('取消報名則團隊人數將低於下限,是否要全隊取消報名?')==true) { alert ('1232456'); window.open('http://www.google.com.tw');" + sdoPostScript + "} ";
            //  string ScriptAll = " if (confirm('取消報名則團隊人數將低於下限,是否要全隊取消報名?')==true) { alert ('1232456')} ";

            //BasePage.RunClientScript (this.Page , ScriptAll);

            //clsMyObj.ShowMessage("若您取消報名則團隊人數將低於下限,因此系統將取消整個團隊的報名資格,若確定要取消報名,請點選「確定」按鈕後於下個視窗點選「確定取消報名」按鈕!");
            btnOK.Visible        = false;
            btnCancelAll.Visible = false;
            btnOK0.Visible       = true;
            lblMessage.Visible   = true;
            GridView1.Visible    = false;
            mpSearch.Show();
            return;
        }



        //已換隊長

        if (newBoss != "")
        {
            foreach (GridViewRow gvr in GridView1.Rows)
            {
                if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == true)
                {
                    if (GridView1.DataKeys[gvr.RowIndex].Value.ToString() == newBoss)
                    {
                        clsMyObj.ShowMessage("您為此隊隊長,請更換隊長,再進行取消!");
                        this.mpSearch.Show();
                        return;
                    }
                }
            }
            ACMS.DAO.ActivityTeamMemberDAO myActivityTeamMemberDAO = new ACMS.DAO.ActivityTeamMemberDAO();
            myActivityTeamMemberDAO.ChangeBoss(new Guid(activity_id), newBoss, emp_id);
        }

        foreach (GridViewRow gvr in GridView1.Rows)
        {
            if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == true && (gvr.FindControl("RadioButton1") as RadioButton).Checked == true)
            {
                clsMyObj.ShowMessage("您為此隊隊長,請更換隊長,再進行取消!");
                this.mpSearch.Show();
                return;
            }
        }



        foreach (GridViewRow gvr in GridView1.Rows)
        {
            if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == true)
            {
                emp_id1 += string.Format("{0},", GridView1.DataKeys[gvr.RowIndex].Value.ToString());
            }
            emp_id2 += string.Format("{0},", GridView1.DataKeys[gvr.RowIndex].Value.ToString());
        }

        if (emp_id1.EndsWith(","))
        {
            emp_id1 = emp_id1.Substring(0, emp_id1.Length - 1);
        }

        if (emp_id1 == "" && newBoss == "")
        {
            clsMyObj.ShowMessage("您未取消報名也未更換隊長,程式沒有修改任資料!");

            return;
        }

        MySingleton.AlterRegistResult MyResult = MySingleton.AlterRegistResult.CancelRegistSucess;
        if (!string.IsNullOrEmpty(emp_id1))
        {
            string aa = string.Format("{0}://{1}{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Authority, HttpContext.Current.Request.ApplicationPath).TrimEnd('/');

            //MySingleton.AlterRegistResult MyResult = MySingleton.GetMySingleton().AlterRegist_Team(null, null, null, MySingleton.AlterRegistType.CancelRegist, new Guid(activity_id), emp_id1, regist_deadline, cancelregist_deadline, ((Button)sender).Page.Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.IndexOf('/', 7)) + "/ACMS/WebForm/RegistActivity/RegistedActivityQuery.aspx", path);
            MyResult = MySingleton.GetMySingleton().AlterRegist_Team(null, null, null, MySingleton.AlterRegistType.CancelRegist, new Guid(activity_id), emp_id1, regist_deadline, cancelregist_deadline, aa + "/Default.aspx", path, "", aa + "/Default.aspx");
            //.ResolveUrl("~/WebForm/RegistActivity/RegistedActivityQuery.aspx"));

            GridView1.DataBind();
        }

        if (CancelTeamRegistClick != null)
        {
            this.Visible = false;
            CancelTeamRegistClick(this, e);
        }

        ACMS.DAO.ActivityRegistDAO regDao = new ACMS.DAO.ActivityRegistDAO();
        emp_id2 = emp_id2.TrimEnd(',');
        string members = regDao.AllTeamMemberByMembers(new Guid(activity_id), emp_id2);

        if (members == "")
        {
            clsMyObj.ShowMessage("已達人數下限,目前已取消該隊的報名資格");
            return;
        }
        if (MyResult == MySingleton.AlterRegistResult.CancelRegistSucess)
        {
            if (newBoss == "" && emp_id1 != "")
            {
                clsMyObj.ShowMessage("取消報名完成。");
            }
            if (newBoss != "" && emp_id1 != "")
            {
                clsMyObj.ShowMessage("更換隊長及取消報名完成。");
            }
            if (newBoss != "" && emp_id1 == "")
            {
                clsMyObj.ShowMessage("更換隊長完成。");
            }
        }
        else if (MyResult == MySingleton.AlterRegistResult.CancelRegistFail_DayOver)
        {
            clsMyObj.ShowMessage("取消報名截止日之後無法取消報名!。");
        }
        else if (MyResult == MySingleton.AlterRegistResult.CancelRegistFail)
        {
            clsMyObj.ShowMessage("取消報名失敗!。");
        }
    }
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        //this.InitDataAndShow();

        ObjectDataSource1.SelectParameters["activity_id"].DefaultValue = activity_id;

        ObjectDataSource1.SelectParameters["DEPT_ID"].DefaultValue = ddlDEPT_ID.SelectedItem.Text;
        ObjectDataSource1.SelectParameters["JOB_GRADE_GROUP"].DefaultValue = "999";
        //if (string.Compare(ddlJOB_GRADE_GROUP.SelectedValue, "") == 0)
        //{
        //    ObjectDataSource1.SelectParameters["JOB_GRADE_GROUP"].DefaultValue = "999";
        //}
        //else
        //{
        //    ObjectDataSource1.SelectParameters["JOB_GRADE_GROUP"].DefaultValue = ddlJOB_GRADE_GROUP.SelectedValue;
        //}
        ObjectDataSource1.SelectParameters["WINDOWS_ID"].DefaultValue = txtWORK_ID.Text;
        ObjectDataSource1.SelectParameters["NATIVE_NAME"].DefaultValue = txtNATIVE_NAME.Text;
           // ObjectDataSource1.SelectParameters["SEX"].DefaultValue = rblSEX.SelectedValue;
        ObjectDataSource1.SelectParameters["SEX"].DefaultValue = "";
        ObjectDataSource1.SelectParameters["EXPERIENCE_START_DATE"].DefaultValue = "1900/1/1";

        ObjectDataSource1.SelectParameters["C_NAME"].DefaultValue = ddlC_NAME.SelectedValue;
        ObjectDataSource1.SelectParameters["UnderDept"].DefaultValue = cbUnderDept.Checked.ToString();

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

        if (myActivityTeamMemberDAO.IsTeamBoss(new Guid(activity_id), emp_id))
        {
            IsTeamBoss = "1";
        }
        else
        {
            IsTeamBoss = "0";
        }
        GridView1.Visible = true;
        GridView1.DataBind();
        this.mpSearch.Show();
    }
    //編輯
    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");

        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string emp_id1 = "";
        string emp_id2 = "";
        string path = Server.MapPath("~/UpFiles");

        //  先檢查是否低於下限

        int membersInt = 0;

        foreach (GridViewRow gvr in GridView1.Rows)
        {
            if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == false)
            {
                membersInt += 1;
            }

        }

        ACMS.BO.ActivatyBO aBO = new ACMS.BO.ActivatyBO();
        ACMS.VO.ActivatyVO aVO = aBO.SelectActivatyByActivatyID(new Guid(activity_id));

        if (membersInt < aVO.team_member_min)
        {

           // string sdoPostScript = "  __doPostBack('" + btnCancelAll1.ClientID + "','1');   ";
           // string ScriptAll = " if (confirm('取消報名則團隊人數將低於下限,是否要全隊取消報名?')==true) { alert ('1232456'); window.open('http://www.google.com.tw');" + sdoPostScript + "} ";
          //  string ScriptAll = " if (confirm('取消報名則團隊人數將低於下限,是否要全隊取消報名?')==true) { alert ('1232456')} ";

            //BasePage.RunClientScript (this.Page , ScriptAll);

            //clsMyObj.ShowMessage("若您取消報名則團隊人數將低於下限,因此系統將取消整個團隊的報名資格,若確定要取消報名,請點選「確定」按鈕後於下個視窗點選「確定取消報名」按鈕!");
            btnOK.Visible = false;
            btnCancelAll.Visible = false;
            btnOK0.Visible = true;
            lblMessage.Visible = true;
            GridView1.Visible = false;
            mpSearch.Show();
            return;

        }

        //已換隊長

        if (newBoss != "")
        {
            foreach (GridViewRow gvr in GridView1.Rows)
            {
                if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == true)
                {
                    if (GridView1.DataKeys[gvr.RowIndex].Value.ToString() == newBoss)
                    {
                        clsMyObj.ShowMessage("您為此隊隊長,請更換隊長,再進行取消!");
                        this.mpSearch.Show();
                        return;
                    }

                }
            }
            ACMS.DAO.ActivityTeamMemberDAO myActivityTeamMemberDAO = new ACMS.DAO.ActivityTeamMemberDAO();
            myActivityTeamMemberDAO.ChangeBoss(new Guid(activity_id), newBoss, emp_id);

        }

        foreach (GridViewRow gvr in GridView1.Rows)
        {
            if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == true && (gvr.FindControl("RadioButton1") as RadioButton).Checked == true)
            {
                clsMyObj.ShowMessage("您為此隊隊長,請更換隊長,再進行取消!");
                    this.mpSearch.Show();
                    return;

            }
        }

        foreach (GridViewRow gvr in GridView1.Rows)
        {
            if ((gvr.FindControl("CheckBox1") as CheckBox).Checked == true)
            {
                emp_id1 += string.Format("{0},", GridView1.DataKeys[gvr.RowIndex].Value.ToString());
            }
            emp_id2 += string.Format("{0},", GridView1.DataKeys[gvr.RowIndex].Value.ToString());
        }

        if (emp_id1.EndsWith(","))
        {
            emp_id1 = emp_id1.Substring(0, emp_id1.Length - 1);
        }

        if (emp_id1 == "" && newBoss == "")
        {
            clsMyObj.ShowMessage("您未取消報名也未更換隊長,程式沒有修改任資料!");

            return;
        }

        MySingleton.AlterRegistResult MyResult = MySingleton.AlterRegistResult.CancelRegistSucess;
        if (!string.IsNullOrEmpty(emp_id1))
        {
            string aa = string.Format("{0}://{1}{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Authority, HttpContext.Current.Request.ApplicationPath).TrimEnd('/');

            //MySingleton.AlterRegistResult MyResult = MySingleton.GetMySingleton().AlterRegist_Team(null, null, null, MySingleton.AlterRegistType.CancelRegist, new Guid(activity_id), emp_id1, regist_deadline, cancelregist_deadline, ((Button)sender).Page.Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.IndexOf('/', 7)) + "/ACMS/WebForm/RegistActivity/RegistedActivityQuery.aspx", path);
            MyResult = MySingleton.GetMySingleton().AlterRegist_Team(null, null, null, MySingleton.AlterRegistType.CancelRegist, new Guid(activity_id), emp_id1, regist_deadline, cancelregist_deadline, aa + "/Default.aspx", path, "", aa + "/Default.aspx");
            //.ResolveUrl("~/WebForm/RegistActivity/RegistedActivityQuery.aspx"));

            GridView1.DataBind();

        }

        if (CancelTeamRegistClick != null)
        {
            this.Visible = false;
            CancelTeamRegistClick(this, e);
        }

        ACMS.DAO.ActivityRegistDAO regDao = new ACMS.DAO.ActivityRegistDAO ();
        emp_id2 = emp_id2.TrimEnd(',');
        string members = regDao.AllTeamMemberByMembers(new Guid(activity_id), emp_id2);

        if (members == "")
        {
            clsMyObj.ShowMessage("已達人數下限,目前已取消該隊的報名資格");
            return;
        }
        if (MyResult == MySingleton.AlterRegistResult.CancelRegistSucess)
        {
            if (newBoss == "" && emp_id1 != "")
            {
                clsMyObj.ShowMessage("取消報名完成。");

            }
            if (newBoss != "" && emp_id1 != "")
            {
                clsMyObj.ShowMessage("更換隊長及取消報名完成。");

            }
            if (newBoss != "" && emp_id1== "")
            {
                clsMyObj.ShowMessage("更換隊長完成。");

            }
        }
        else if (MyResult == MySingleton.AlterRegistResult.CancelRegistFail_DayOver)
        {
            clsMyObj.ShowMessage("取消報名截止日之後無法取消報名!。");
        }
        else if (MyResult == MySingleton.AlterRegistResult.CancelRegistFail)
        {
            clsMyObj.ShowMessage("取消報名失敗!。");
        }
    }