Beispiel #1
0
    private DataTable GetRelGroupData(int comp_id, string est_id, int estterm_ref_id)
    {
        Biz_EmpInfos        empInfo      = new Biz_EmpInfos();
        Biz_RelGroupInfos   relGrpInfo   = new Biz_RelGroupInfos();
        Biz_RelGroupTgtMaps relGrpTgtMap = new Biz_RelGroupTgtMaps();
        DataTable           dataTable    = relGrpTgtMap.GetDataTableSchema();
        DataRow             dataRow      = null;
        DataTable           dtRelGrp     = relGrpInfo.GetRelGroupInfo(comp_id, "", est_id, estterm_ref_id).Tables[0];

        foreach (DataRow dataRowRelGrp in dtRelGrp.Rows)
        {
            DataTable dtTgt          = null;
            string    rel_grp_id     = dataRowRelGrp["REL_GRP_ID"].ToString();
            string    where_sentence = "";

            where_sentence = BizUtility.GetRelGroupWhereString(COMP_ID
                                                               , EST_ID
                                                               , ESTTERM_REF_ID
                                                               , rel_grp_id
                                                               , "TM");

            if (OwnerTypeMode == OwnerType.Dept)
            {
                dtTgt = empInfo.GetRelDeptList("WHERE", where_sentence, "TM").Tables[0];
            }
            else if (OwnerTypeMode == OwnerType.Emp_User)
            {
                dtTgt = empInfo.GetRelEmpList("WHERE", where_sentence, "TM").Tables[0];
            }

            foreach (DataRow dataRowTgt in dtTgt.Rows)
            {
                dataRow = dataTable.NewRow();

                dataRow["COMP_ID"]        = comp_id;
                dataRow["REL_GRP_ID"]     = rel_grp_id;
                dataRow["EST_ID"]         = est_id;
                dataRow["ESTTERM_REF_ID"] = estterm_ref_id;
                dataRow["TGT_DEPT_ID"]    = dataRowTgt["TGT_DEPT_ID"];
                dataRow["TGT_EMP_ID"]     = dataRowTgt["TGT_EMP_ID"];
                dataRow["DATE"]           = DateTime.Now;
                dataRow["USER"]           = EMP_REF_ID;

                dataTable.Rows.Add(dataRow);
            }
        }

        return(dataTable);
    }
Beispiel #2
0
    protected void ibnRelGrpTgtMap_Click(object sender, ImageClickEventArgs e)
    {
        DataTable dtRelGrpData = GetRelGroupData(COMP_ID, EST_ID, ESTTERM_REF_ID);
        DataTable dtValid      = null;

        if (dtRelGrpData.Rows.Count == 0)
        {
            ltrScript.Text = JSHelper.GetAlertScript("상대그룹에 포함된 사원정보가 없습니다.");
            return;
        }

        dtValid = DataTypeUtility.GetGroupByDataTable(dtRelGrpData
                                                      , "TGT_EMP_ID"
                                                      , new string[] { "TGT_DEPT_ID", "TGT_EMP_ID" }
                                                      , "TGT_EMP_ID");

        int duplicate_emp_id_cnt = dtValid.Select("CNT_TGT_EMP_ID > 1").Length;

        if (duplicate_emp_id_cnt > 0)
        {
            ltrScript.Text = JSHelper.GetAlertScript(string.Format("{0}건의 부서 or 사원이 상대그룹으로 중복되어 있습니다.", duplicate_emp_id_cnt));
            return;
        }

        Biz_RelGroupTgtMaps relGrpTgtMap = new Biz_RelGroupTgtMaps();
        bool isOK = relGrpTgtMap.AddRelGroupEmpMap(dtRelGrpData);

        if (isOK)
        {
            ltrScript.Text = JSHelper.GetAlertScript("정상적으로 상대그룹 대상자를 반영하였습니다.");
        }
        else
        {
            ltrScript.Text = JSHelper.GetAlertScript("처리 중 오류가 발생하였습니다.");
        }
    }