Beispiel #1
0
    private void BindingRelGroupPosInfo(int comp_id, string rel_grp_id, string est_id, int estterm_ref_id)
    {
        Biz_RelGroupPositionInfos relGroupPosInfo = new Biz_RelGroupPositionInfos();
        DataSet ds = relGroupPosInfo.GetRelGroupPosInfo(comp_id, "", rel_grp_id, est_id, estterm_ref_id);

        uwgRelGrpPosInfo.DataSource = ds;
        uwgRelGrpPosInfo.DataBind();

        BindOptValue(comp_id, rel_grp_id, est_id, estterm_ref_id);

        //lblRowCount.Text              = ds.Tables[0].Rows.Count.ToString();
    }
Beispiel #2
0
    /// <summary>
    /// 상대그룹 아이디에 따른 상대그룹 대상자 WHERE String 를 반환한다.
    /// </summary>
    /// <param name="comp_id"></param>
    /// <param name="est_id"></param>
    /// <param name="estterm_ref_id"></param>
    /// <param name="rel_grp_id">상대그룹 아이디</param>
    /// <param name="tbl_alias">테이블 별칭</param>
    /// <returns></returns>
    public static string GetRelGroupWhereString(int comp_id
                                                , string est_id
                                                , int estterm_ref_id
                                                , string rel_grp_id
                                                , string tbl_alias)
    {
        StringBuilder sbSentence = new StringBuilder();

        Biz_RelGroupPositionInfos bizInfos = new Biz_RelGroupPositionInfos();
        DataSet dsInfos = bizInfos.GetRelGroupPosInfo(comp_id
                                                      , ""
                                                      , rel_grp_id
                                                      , est_id
                                                      , estterm_ref_id);

        for (int i = 0; i < dsInfos.Tables[0].Rows.Count; i++)
        {
            string rel_grp_pos_id = dsInfos.Tables[0].Rows[i]["REL_GRP_POS_ID"].ToString();
            string optInfos       = dsInfos.Tables[0].Rows[i]["OPT_VALUE"].ToString();

            Biz_RelGroupPositionDatas bizdatas = new Biz_RelGroupPositionDatas();
            DataSet dsDatas = bizdatas.GetRelGroupPosData(comp_id
                                                          , ""
                                                          , rel_grp_id
                                                          , rel_grp_pos_id
                                                          , est_id
                                                          , estterm_ref_id);
            if (i == 0 && dsDatas.Tables[0].Rows.Count > 0)
            {
                optInfos = optInfos.ToUpper().Replace("OR", "").Replace("AND", "").Replace("END", "");
            }

            if (dsDatas.Tables[0].Rows.Count > 0)
            {
                sbSentence.Append(string.Format(" {0} ( ", optInfos));
            }

            for (int k = 0; k < dsDatas.Tables[0].Rows.Count; k++)
            {
                string optDatas  = dsDatas.Tables[0].Rows[k]["OPT_VALUE"].ToString();
                string pos_id    = dsDatas.Tables[0].Rows[k]["POS_ID"].ToString();
                string pos_value = dsDatas.Tables[0].Rows[k]["POS_VALUE"].ToString();

                if (k == 0)
                {
                    optDatas = optDatas.ToUpper().Replace("OR", "").Replace("AND", "").Replace("END", "");
                }

                sbSentence.Append(string.Format(" {0} " + tbl_alias + ".TGT_POS_{1}_ID = '{2}' ", optDatas, pos_id, pos_value));
            }

            if (dsDatas.Tables[0].Rows.Count > 0)
            {
                sbSentence.Append(" ) ");
            }
        }

        Biz_RelGroupDepts bizDept = new MicroBSC.Estimation.Biz.Biz_RelGroupDepts();
        DataSet           ds      = bizDept.GetRelGroupDept(comp_id
                                                            , rel_grp_id
                                                            , 0
                                                            , est_id
                                                            , estterm_ref_id);

        if (ds.Tables[0].Rows.Count > 0)
        {
            bool   isFirst  = true;
            string deptcode = "";

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                if (isFirst)
                {
                    isFirst   = false;
                    deptcode += row["DEPT_REF_ID"].ToString();
                }
                else
                {
                    deptcode += "," + row["DEPT_REF_ID"].ToString();
                }
            }

            string opr = (sbSentence.Length > 0) ? " AND " : string.Empty;
            sbSentence.Append(string.Format(opr + tbl_alias + ".TGT_DEPT_ID IN ( {0} ) ", deptcode));
        }

        return(sbSentence.ToString());
    }