Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bizMulEstTargetPool = new Biz_Mul_Est_Target_Pool();

        if (!IsPostBack)
        {
            DropDownListCommom.BindComp(ddlCompID, lblCompTitle);
            DropDownListCommom.BindEstTerm(ddlEstTermRefID);
            DropDownListCommom.BindEstTermSubByYearYN(ddlEstTermSubID
                                                      , WebUtility.GetIntByValueDropDownList(ddlCompID)
                                                      , "N");

            DropDownListCommom.BindEstStyle(ddlEstList, WebUtility.GetIntByValueDropDownList(ddlCompID), "MUL");
        }


        COMP_ID        = WebUtility.GetIntByValueDropDownList(ddlCompID);
        EST_ID         = WebUtility.GetByValueDropDownList(ddlEstList);
        ESTTERM_REF_ID = WebUtility.GetIntByValueDropDownList(ddlEstTermRefID);
        ESTTERM_SUB_ID = WebUtility.GetIntByValueDropDownList(ddlEstTermSubID);


        ltrScript.Text = "";
    }
Exemple #2
0
    protected void ibnRandom_Click(object sender, ImageClickEventArgs e)
    {
        Biz_Mul_Est_Target_Pool bizMulEstTargetPool = new Biz_Mul_Est_Target_Pool();

        DataTable DT_dept_ref_id = UltraGridUtility.GetDataSetByCheckedBox(UltraWebGrid1, new string[] { "DEPT_REF_ID" }, "selchk", "cBox").Tables[0];

        StringBuilder dept_ref_id_list = new StringBuilder();


        //전체 직원 정보, 평가, 피평가 포함된 테이블 스키마 복사
        DataTable dtResult = DT_DEPTEMP.Clone();



        for (int i = 0; i < DT_dept_ref_id.Rows.Count; i++)
        {
            string dept_ref_id = DT_dept_ref_id.Rows[i]["DEPT_REF_ID"].ToString();
            if (dept_ref_id_list.Length > 0)
            {
                dept_ref_id_list.Append(", ");
            }
            dept_ref_id_list.Append(dept_ref_id);
        }


        //해당 부서들의 피평가자들 리스트
        DataTable DT_tgt_emp_id = DataTypeUtility.FilterSortDataTable(DT_DEPTEMP, string.Format(" EST_TYPE_TGT = 'TGT' AND DEPT_REF_ID IN ({0}) ", dept_ref_id_list.ToString()));



        //피평가자들의 모든 평가자 리스트
        DataTable DT_est_emp_id = bizMulEstTargetPool.Get_BaseEstEmpList(COMP_ID, EST_ID, ESTTERM_REF_ID, ESTTERM_SUB_ID, DT_tgt_emp_id);



        DT_est_emp_id.Columns.Add("TGT_DEPT_ID");
        DT_est_emp_id.Columns.Add("TGT_EMP_NAME");
        DT_est_emp_id.Columns.Add("TGT_CLASS_CODE");
        DT_est_emp_id.Columns.Add("TGT_CLS_NAME");
        DT_est_emp_id.Columns.Add("TGT_GRP_CODE");
        DT_est_emp_id.Columns.Add("TGT_GRP_NAME");
        DT_est_emp_id.Columns.Add("TGT_RANK_CODE");
        DT_est_emp_id.Columns.Add("TGT_RANK_NAME");
        DT_est_emp_id.Columns.Add("TGT_DUTY_CODE");
        DT_est_emp_id.Columns.Add("TGT_DUT_NAME");
        DT_est_emp_id.Columns.Add("TGT_KIND_CODE");
        DT_est_emp_id.Columns.Add("TGT_KND_NAME");

        StringBuilder est_tgt_list = new StringBuilder();

        for (int i = 0; i < DT_dept_ref_id.Rows.Count; i++)
        {
            string    c_dept_ref_id   = DT_dept_ref_id.Rows[i]["DEPT_REF_ID"].ToString();
            DataTable c_DT_tgt_emp_id = DataTypeUtility.FilterSortDataTable(DT_tgt_emp_id, string.Format("DEPT_REF_ID={0}", c_dept_ref_id));

            //선택된 부서의 피평가자 수만큼 루프
            for (int j = 0; j < c_DT_tgt_emp_id.Rows.Count; j++)
            {
                string tgt_dept_id         = c_DT_tgt_emp_id.Rows[j]["DEPT_REF_ID"].ToString();
                string tgt_emp_id          = c_DT_tgt_emp_id.Rows[j]["EMP_REF_ID"].ToString();
                string tgt_emp_name        = c_DT_tgt_emp_id.Rows[j]["EMP_NAME"].ToString();
                string position_class_code = c_DT_tgt_emp_id.Rows[j]["POSITION_CLASS_CODE"].ToString();
                string pos_cls_name        = c_DT_tgt_emp_id.Rows[j]["POS_CLS_NAME"].ToString();
                string position_grp_code   = c_DT_tgt_emp_id.Rows[j]["POSITION_GRP_CODE"].ToString();
                string pos_grp_name        = c_DT_tgt_emp_id.Rows[j]["POS_GRP_NAME"].ToString();
                string position_rank_code  = c_DT_tgt_emp_id.Rows[j]["POSITION_RANK_CODE"].ToString();
                string pos_rank_name       = c_DT_tgt_emp_id.Rows[j]["POS_RNK_NAME"].ToString();
                string position_duty_code  = c_DT_tgt_emp_id.Rows[j]["POSITION_DUTY_CODE"].ToString();
                string pos_dut_name        = c_DT_tgt_emp_id.Rows[j]["POS_DUT_NAME"].ToString();
                string position_kind_code  = c_DT_tgt_emp_id.Rows[j]["POSITION_KIND_CODE"].ToString();
                string pos_knd_name        = c_DT_tgt_emp_id.Rows[j]["POS_KND_NAME"].ToString();



                //해당 피평가자에 대한 평가자 리스트 추출
                string    filter_Extract_EstEmp = string.Format("TGT_EMP_ID={0} AND EST_EMP_ID <> {0}", tgt_emp_id);
                DataTable dtRandom = DataTypeUtility.FilterSortDataTable(DT_est_emp_id, filter_Extract_EstEmp);



                StringBuilder est_emp_list = new StringBuilder();

                if (dtRandom.Rows.Count > 0)
                {
                    for (int k = 0; k < EST_MAX_COUNT; k++)
                    {
                        int cntRandom = dtRandom.Rows.Count;


                        //행 감소를 체크
                        if (cntRandom == 0)
                        {
                            break;
                        }


                        //랜덤 인덱스
                        Random rnd    = new Random();
                        int    rndNum = rnd.Next();
                        int    rndIdx = rndNum % cntRandom;



                        //평가자 EMP_REF_ID
                        if (est_emp_list.Length > 0)
                        {
                            est_emp_list.Append(", ");
                        }
                        est_emp_list.Append(j.ToString() + "-" + dtRandom.Rows[rndIdx]["EMP_REF_ID"].ToString());



                        DataRow rowRandom = dtRandom.Rows[rndIdx];

                        rowRandom["TGT_DEPT_ID"]    = tgt_dept_id;
                        rowRandom["TGT_EMP_ID"]     = tgt_emp_id;
                        rowRandom["TGT_EMP_NAME"]   = tgt_emp_name;
                        rowRandom["TGT_CLASS_CODE"] = position_class_code;
                        rowRandom["TGT_CLS_NAME"]   = pos_cls_name;
                        rowRandom["TGT_GRP_CODE"]   = position_grp_code;
                        rowRandom["TGT_GRP_NAME"]   = pos_grp_name;
                        rowRandom["TGT_RANK_CODE"]  = position_rank_code;
                        rowRandom["TGT_RANK_NAME"]  = pos_rank_name;
                        rowRandom["TGT_DUTY_CODE"]  = position_duty_code;
                        rowRandom["TGT_DUT_NAME"]   = pos_dut_name;
                        rowRandom["TGT_KIND_CODE"]  = position_kind_code;
                        rowRandom["TGT_KND_NAME"]   = pos_knd_name;



                        //평가자 추가
                        dtResult.ImportRow(rowRandom);



                        //원본 데이터에서 사용한 데이터 삭제 확정
                        rowRandom.Delete();
                        dtRandom.AcceptChanges();
                    }



                    if (est_emp_list.Length > 0)
                    {
                        if (est_tgt_list.Length > 0)
                        {
                            est_tgt_list.Append(";");
                        }
                        est_tgt_list.Append(string.Format("{2}. {0}={1}", tgt_emp_id, est_emp_list.ToString(), i.ToString()));
                    }
                }
            }
        }

        if (dept_ref_id_list.Length == 0)
        {
            dept_ref_id_list.Append("-1");
        }


        DataTable dtEmp = DataTypeUtility.FilterSortDataTable(DT_DEPTEMP, string.Format(" DEPT_REF_ID  IN ({0})  ", dept_ref_id_list));

        MicroBSC.Integration.EST.Biz.Biz_Est_Emp_Est_Target_Map bizEstEmpEstTargetMap = new MicroBSC.Integration.EST.Biz.Biz_Est_Emp_Est_Target_Map();



        //해당 부서에 해당하는 직원이 피평가자로 있는 매핑 데이터를 모두 삭제 후 다시 추가
        string okMsg = bizEstEmpEstTargetMap.AddEmpEstTargetMapFromPool(dtEmp
                                                                        , dtResult
                                                                        , COMP_ID
                                                                        , EST_ID
                                                                        , ESTTERM_REF_ID
                                                                        , ESTTERM_SUB_ID
                                                                        , ConESTTERM_STEP_ID
                                                                        , ConDIRECTION_TYPE
                                                                        , "N"
                                                                        , DateTime.Now
                                                                        , this.gUserInfo.Emp_Ref_ID);

        if (okMsg.Length == 0)
        {
            ltrScript.Text = JSHelper.GetAlertScript("정상 처리 되었습니다.", false);

            DoBinding_Dept();
        }
        else
        {
            ltrScript.Text = JSHelper.GetAlertScript("실패하였습니다.", false);
        }
    }