Пример #1
0
    protected bool doSave()
    {
        Biz_Est_Pos_Weight bizEstPosWeight = new Biz_Est_Pos_Weight();
        DataTable          dt = bizEstPosWeight.Get_Est_Pos_Weight_Tbl_Scheme();



        for (int i = 0; i < UltraWebGrid1.Rows.Count; i++)
        {
            double total_weight = 0; //가중치 합계
            double weight       = 0; //부서 가중치



            for (int j = 0; j < DEPT_TYPE_REF_ID.Length; j++)
            {
                DataRow dr = dt.NewRow();

                string colName = string.Format("WEIGHT_{0}", DEPT_TYPE_REF_ID[j]);

                TemplatedColumn tc = (TemplatedColumn)UltraWebGrid1.Columns.FromKey("i" + colName);
                Infragistics.WebUI.WebDataInput.WebNumericEdit ne = (Infragistics.WebUI.WebDataInput.WebNumericEdit)((CellItem)tc.CellItems[i]).FindControl("WEIGHT");
                weight = DataTypeUtility.GetToDouble(ne.Value);

                total_weight += weight;


                dr["COMP_ID"]          = COMP_ID;
                dr["ESTTERM_REF_ID"]   = ESTTERM_REF_ID;
                dr["EST_ID"]           = EST_ID;
                dr["SEQ"]              = i;
                dr["POS_ID"]           = UltraWebGrid1.Rows[i].Cells.FromKey("POS_ID").Value;
                dr["POS_VALUE"]        = UltraWebGrid1.Rows[i].Cells.FromKey("POS_VALUE").Value;
                dr["DEPT_TYPE_REF_ID"] = DEPT_TYPE_REF_ID[j];
                dr["WEIGHT"]           = weight;

                dt.Rows.Add(dr);
            }


            if (total_weight != 100)
            {
                this.ltrScript.Text = JSHelper.GetAlertScript("본부 가중치와 팀 가중치의 합은 100이 되어야 합니다.");
                return(false);
            }
        }


        //dt를 넘겨서 db에 저장
        int affectedRow = bizEstPosWeight.Add_Est_Pos_Weight(COMP_ID
                                                             , ESTTERM_REF_ID
                                                             , EST_ID
                                                             , dt
                                                             , POS_ID
                                                             , gUserInfo.Emp_Ref_ID);

        return(affectedRow > 0 ? true : false);
    }
Пример #2
0
    protected void UltraWebGrid1_InitializeRow(object sender, RowEventArgs e)
    {
        double total_weight = 0; //가중치 합계
        double weight       = 0; //부서 가중치


        //가중치 입력 필드에 바인드
        for (int i = 0; i < DEPT_TYPE_REF_ID.Length; i++)
        {
            string          colName = string.Format("WEIGHT_{0}", DEPT_TYPE_REF_ID[i]);
            TemplatedColumn tc      = (TemplatedColumn)UltraWebGrid1.Columns.FromKey("i" + colName);
            Infragistics.WebUI.WebDataInput.WebNumericEdit ne = (Infragistics.WebUI.WebDataInput.WebNumericEdit)((CellItem)tc.CellItems[e.Row.Index]).FindControl("WEIGHT");

            weight   = DataTypeUtility.GetToDouble(e.Row.Cells.FromKey(colName).Value);
            ne.Value = weight;

            total_weight += weight;
        }


        e.Row.Cells.FromKey("TOTAL_WEIGHT").Value = total_weight;
    }