Exemplo n.º 1
0
    protected void ugrdEstQuestion_InitializeRow(object sender, RowEventArgs e)
    {
        string q_sbj_id = DataTypeUtility.GetString(e.Row.Cells.FromKey("Q_SBJ_ID").Value);


        //자기평가 결과
        //DataTable ItemDt = new MicroBSC.Integration.EST.Biz.Biz_Est_Question_Data().SelectEstQuestionDataSelfPoint(Q_OBJ_ID, q_sbj_id);


        Biz_QuestionDatas questionDatas = new Biz_QuestionDatas(COMP_ID
                                                                , EST_ID
                                                                , ESTTERM_REF_ID
                                                                , ESTTERM_SUB_ID
                                                                , ESTTERM_STEP_ID
                                                                , TGT_DEPT_ID
                                                                , TGT_EMP_ID
                                                                , TGT_DEPT_ID
                                                                , TGT_EMP_ID
                                                                , q_sbj_id);


        Biz_QuestionItems questionItems = new Biz_QuestionItems();
        DataTable         ItemDt        = questionItems.GetQuestionItem(questionDatas.Q_Itm_ID, q_sbj_id, Q_OBJ_ID).Tables[0];


        UltraGridCell uc = e.Row.Cells.FromKey("Q_ITEM_NAME_SELF");

        uc.Value = ItemDt.Rows[0]["Q_ITEM_NAME"].ToString();

        UltraGridCell ugItemNo = e.Row.Cells.FromKey("Q_ITM_ID");

        ugItemNo.Value = ItemDt.Rows[0]["Q_ITM_ID"].ToString();

        UltraGridCell ugobjId = e.Row.Cells.FromKey("Q_OBJ_ID");

        ugobjId.Value = ItemDt.Rows[0]["Q_OBJ_ID"].ToString();


        //다면평가 결과
        DataTable dtPoint = new MicroBSC.Integration.EST.Biz.Biz_Est_Question_Data().SelectEstQuestionDataSelfPointResultPoint(
            ESTTERM_REF_ID, ESTTERM_SUB_ID, ESTTERM_STEP_ID, Q_OBJ_ID, TGT_EMP_ID, "3O");


        int    count = 0;
        double sum   = 0;

        for (int i = 0; i < dtPoint.Rows.Count; i++)
        {
            if (dtPoint.Rows[i]["Q_SBJ_ID"].ToString().Equals(q_sbj_id))
            {
                UltraGridCell ugc = e.Row.Cells.FromKey((dtPoint.Rows[i]["EST_EMP_ID"].ToString()));
                ugc.Value = dtPoint.Rows[i]["POINT"].ToString();
                sum      += double.Parse(dtPoint.Rows[i]["POINT"].ToString());
                count++;
            }
        }

        //다면평가 평균
        UltraGridCell ugAv = e.Row.Cells.FromKey("Q_AVERAGE");

        if (count == 0)
        {
            ugAv.Value = "-";
        }
        else
        {
            ugAv.Value = Math.Round(sum / count, 2);
        }


        //1차 평가 결과
        questionDatas = new Biz_QuestionDatas(COMP_ID
                                              , EST_ID
                                              , ESTTERM_REF_ID
                                              , ESTTERM_SUB_ID
                                              , ESTTERM_STEP_ID
                                              , EST_DEPT_ID
                                              , EST_EMP_ID
                                              , TGT_DEPT_ID
                                              , TGT_EMP_ID
                                              , q_sbj_id);

        TemplatedColumn tc = (TemplatedColumn)e.Row.Band.Columns.FromKey("Q_FIRST");

        Infragistics.WebUI.WebDataInput.WebNumericEdit ne = (Infragistics.WebUI.WebDataInput.WebNumericEdit)((CellItem)tc.CellItems[e.Row.Index]).FindControl("Q_FIRST");
        ne.Value = DataTypeUtility.GetToDouble(questionDatas.Point);

        if (STATUS_ID.Equals("E"))
        {
            ne.ReadOnly = true;
        }
    }
Exemplo n.º 2
0
    protected void ugrdEstQuestion_InitializeLayout(object sender, LayoutEventArgs e)
    {
        UltraGridColumn col_est_1st = e.Layout.Bands[0].Columns.FromKey("Q_FIRST");

        UltraGridColumn col = new UltraGridColumn();

        col.Header.Caption = "자기평가결과";
        col.Width          = Unit.Pixel(100);
        col.Key            = "Q_ITEM_NAME_SELF";
        e.Layout.Bands[0].Columns.Insert(col_est_1st.Index, col);


        //다면평가 평가자 수
        DataTable pointDt = new MicroBSC.Integration.EST.Biz.Biz_Est_Question_Data().SelectEstQuestionDataSelfPointResultCount(
            ESTTERM_REF_ID, ESTTERM_SUB_ID, ESTTERM_STEP_ID, Q_OBJ_ID, TGT_EMP_ID, "3O");


        System.Collections.ArrayList est_emp_list = new ArrayList();
        for (int i = 0; i < pointDt.Rows.Count; i++)
        {
            UltraGridColumn cols = new UltraGridColumn();
            cols.Header.Caption            = "평가" + (i + 1).ToString();
            cols.Width                     = Unit.Pixel(50);
            cols.Key                       = pointDt.Rows[i]["EST_EMP_ID"].ToString();
            cols.CellStyle.HorizontalAlign = HorizontalAlign.Right;
            cols.Footer.Total              = SummaryInfo.Avg;
            cols.Footer.Formula            = "##,##0.00";

            e.Layout.Bands[0].Columns.Insert(col_est_1st.Index, cols);
            est_emp_list.Add(cols.Key);
        }

        UltraGridColumn colEverage = new UltraGridColumn();

        colEverage.Header.Caption            = est_emp_list.Count > 0 ? "평균" : "다면평가 평균";
        colEverage.Width                     = est_emp_list.Count > 0 ? Unit.Pixel(50) : Unit.Pixel(100);
        colEverage.Key                       = "Q_AVERAGE";
        colEverage.CellStyle.HorizontalAlign = HorizontalAlign.Right;
        colEverage.Format                    = "##,##0.00";
        e.Layout.Bands[0].Columns.Insert(col_est_1st.Index, colEverage);


        //TemplatedColumn colFirst = new TemplatedColumn();
        //colFirst.Header.Caption = "1차평가";
        //colFirst.Key = "Q_FIRST";
        //colFirst.AllowUpdate = AllowUpdate.Yes;
        //colFirst.DefaultValue = 0;
        //colFirst.Width = 10;
        //colFirst.CellStyle.BackColor = System.Drawing.Color.MintCream;
        //colFirst.DataType = "System.Int32";
        //e.Layout.Bands[0].Columns.Add(colFirst);

        UltraGridColumn hidenItem = new UltraGridColumn();

        hidenItem.Key    = "Q_ITM_ID";
        hidenItem.Hidden = true;
        e.Layout.Bands[0].Columns.Insert(col_est_1st.Index, hidenItem);

        UltraGridColumn hidenobjId = new UltraGridColumn();

        hidenobjId.Key    = "Q_OBJ_ID";
        hidenobjId.Hidden = true;
        e.Layout.Bands[0].Columns.Insert(col_est_1st.Index, hidenobjId);


        if (est_emp_list.Count > 0)
        {
            //모든 헤더 1씩 내림
            for (int i = 0; i < e.Layout.Bands[0].Columns.Count; i++)
            {
                e.Layout.Bands[0].Columns[i].Header.RowLayoutColumnInfo.OriginY = 1;
                e.Layout.Bands[0].Columns[i].Header.RowLayoutColumnInfo.OriginX = i;
            }


            //스팬헤더 추가
            int insert_pos = e.Layout.Bands[0].Columns.FromKey((string)est_emp_list[0]).Index;

            ColumnHeader ch = new ColumnHeader();
            ch.Caption = "다면평가 결과";
            ch.RowLayoutColumnInfo.OriginX = insert_pos - 1;
            ch.RowLayoutColumnInfo.OriginY = 0;
            ch.RowLayoutColumnInfo.SpanX   = est_emp_list.Count + 1;//평가자 수 컬럼 + 평균 컬럼

            e.Layout.Bands[0].HeaderLayout.Add(ch);

            //spanY
            for (int i = 0; i < e.Layout.Bands[0].Columns.Count; i++)
            {
                int flag = 0;

                for (int j = 0; j < est_emp_list.Count; j++)
                {
                    string key = e.Layout.Bands[0].Columns[i].Key;

                    if (key.Equals((string)est_emp_list[j]) || key.Equals("Q_AVERAGE"))
                    {
                        flag++;
                        break;
                    }
                }

                if (flag == 0)
                {
                    e.Layout.Bands[0].Columns[i].Header.RowLayoutColumnInfo.OriginY = 0;
                    e.Layout.Bands[0].Columns[i].Header.RowLayoutColumnInfo.SpanY   = 2;
                }
            }
        }



        e.Layout.Bands[0].Columns.FromKey("Q_DFN_NAME").Header.RowLayoutColumnInfo.SpanX = 2;
        e.Layout.Bands[0].Columns.FromKey("Q_DFN_NAME").Header.Caption = "항목";
        int shift_pos = e.Layout.Bands[0].Columns.FromKey("Q_DFN_NAME").Index;

        for (int i = shift_pos + 1; i < e.Layout.Bands[0].Columns.Count; i++)
        {
            e.Layout.Bands[0].Columns[i].Header.RowLayoutColumnInfo.OriginX -= 1;
        }



        ////머지된 셀의 색상 조정
        //for (int i = 0; i < e.Layout.Bands[0].Columns.Count; i++)
        //{
        //    if (e.Layout.Bands[0].Columns[i].MergeCells)
        //    {
        //        e.Layout.Bands[0].Columns[i].CellStyle.CssClass = "grid_merged_cell";
        //    }
        //}
    }