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); }
protected void doBind() { string dept_type_ref_id_list = ""; for (int i = 0; i < DEPT_TYPE_REF_ID.Length; i++) { if (dept_type_ref_id_list.Length > 0) { dept_type_ref_id_list += ", "; } dept_type_ref_id_list += DEPT_TYPE_REF_ID[i]; } Biz_PositionInfos bizPosInfo = new Biz_PositionInfos(POS_ID); //종으로 출력된 부서타입별 가중치를 횡으로 변환 if (bizPosInfo.Position_Table_Name != null && bizPosInfo.Position_Table_Name.Trim().Length > 0) { Biz_Est_Pos_Weight bizEstPosWeight = new Biz_Est_Pos_Weight(); DataTable dt = bizEstPosWeight.Get_Est_Pos_Weight(POS_ID , bizPosInfo.Position_Table_Name , dept_type_ref_id_list , COMP_ID , ESTTERM_REF_ID , EST_ID); DataTable dt_result = DataTypeUtility.GetGroupByDataTable(dt, new string[] { "POS_ID", "POS_VALUE", "POS_VALUE_NAME" }); if (dt_result.Rows.Count > 0) { for (int i = 0; i < DEPT_TYPE_REF_ID.Length; i++) { int dept_type_ref_id = DEPT_TYPE_REF_ID[i]; string colName = string.Format("WEIGHT_{0}", dept_type_ref_id); dt_result.Columns.Add(colName); Biz_DeptTypeInfo bizDeptTypeInfo = new Biz_DeptTypeInfo(dept_type_ref_id); string dept_type_name = bizDeptTypeInfo.Itype_name; TemplatedColumn srcCol = (TemplatedColumn)UltraWebGrid1.Columns.FromKey("WEIGHT"); //컬럼 복사 후 추가 if (!UltraWebGrid1.Columns.Exists(colName)) { UltraGridColumn hdCol = new UltraGridColumn();//히든 컬럼 hdCol.BaseColumnName = colName; hdCol.Key = colName; hdCol.Hidden = true; UltraWebGrid1.Columns.Insert(srcCol.Index, hdCol); } if (!UltraWebGrid1.Columns.Exists("i" + colName)) { TemplatedColumn tgtCol = new TemplatedColumn();//입력 컬럼 tgtCol.CopyFrom(srcCol); tgtCol.BaseColumnName = "i" + colName; tgtCol.Key = "i" + colName; tgtCol.Hidden = false; tgtCol.Width = Unit.Pixel(80); tgtCol.Header.Caption = string.Format("{0} 가중치", dept_type_name); UltraWebGrid1.Columns.Insert(srcCol.Index, tgtCol); } DataTable dt_filtered_pos_weght = DataTypeUtility.FilterSortDataTable(dt, string.Format("DEPT_TYPE_REF_ID={0}", dept_type_ref_id)); if (dt_filtered_pos_weght.Rows.Count > 0) { for (int j = 0; j < dt_result.Rows.Count; j++) { string pos_value = DataTypeUtility.GetString(dt_result.Rows[j]["POS_VALUE"]); DataTable dt_pos_weight = DataTypeUtility.FilterSortDataTable(dt_filtered_pos_weght, string.Format("POS_VALUE='{0}'", pos_value)); if (dt_pos_weight.Rows.Count > 0) { double pos_weight = DataTypeUtility.GetToDouble(dt_pos_weight.Rows[0]["WEIGHT"]); dt_result.Rows[j][string.Format("WEIGHT_{0}", dept_type_ref_id)] = pos_weight; } else { dt_result.Rows[j][string.Format("WEIGHT_{0}", dept_type_ref_id)] = 0; } } } } } UltraWebGrid1.Clear(); UltraWebGrid1.DataSource = dt_result; UltraWebGrid1.DataBind(); } }
private void GridBidingData(int comp_id , string est_id , int estterm_ref_id , int estterm_sub_id , int estterm_step_id) { // 평가정보를 가져온다. Biz_EstInfos estInfo = new Biz_EstInfos(comp_id, est_id); // 해당평가가 존재하는지 여부 체크 if (!estInfo.IsExists(comp_id, est_id)) { ltrScript.Text = JSHelper.GetAlertScript("선택된 회사의 평가정보가 없습니다."); return; } Biz_Est_Data bizEstData = new Biz_Est_Data(); if (DT_EST_DATA == null) { DT_EST_DATA = bizEstData.Get_Est_Data_Pos_Weight(comp_id , est_id , estterm_ref_id , estterm_sub_id , estterm_step_id); } DT_EST_DATA = DataTypeUtility.FilterSortDataTable(DT_EST_DATA, "TGT_DEPT_ID=10");//경영혁신팀만 조회 if (DataTypeUtility.FilterSortDataTable(DT_EST_DATA, "DEPT_POINT IS NULL").Rows.Count > 0) { this.ltrScript.Text = JSHelper.GetAlertScript("점수가 입력되지 않은 부서가 존재합니다."); iBtnApplyWeight.Visible = false; } Biz_Est_Pos_Weight bizEstPosWeight = new Biz_Est_Pos_Weight(); DataTable dt = bizEstPosWeight.Get_Est_Pos_Weight(comp_id , estterm_ref_id , est_id , 0 , "" , "" , 0); if (dt.Rows.Count > 0) { dt = DataTypeUtility.GetGroupByDataTable(dt, new string[] { "POS_ID" }); POS_ID = DataTypeUtility.GetString(dt.Rows[0]["POS_ID"]); Biz_PositionInfos bizPosInfo = new Biz_PositionInfos(POS_ID); if (bizPosInfo.Position_Table_Name != null && bizPosInfo.Position_Table_Name.Trim().Length > 0) { DT_EST_POS_WEIGHT = bizEstPosWeight.Get_Est_Pos_Weight(POS_ID , bizPosInfo.Position_Table_Name , DEPT_TYPE_REF_ID_LIST , comp_id , estterm_ref_id , est_id); int current_page = UltraWebGrid1.DisplayLayout.Pager.CurrentPageIndex; int page_size = UltraWebGrid1.DisplayLayout.Pager.PageSize; double page_cnt = Math.Ceiling((double)DT_EST_DATA.Rows.Count / page_size); CURRENT_PAGE = current_page; PAGE_CNT = DataTypeUtility.GetToInt32(page_cnt); DataTable dt_est_data = DT_EST_DATA.Copy(); for (int i = 0; i < (current_page - 1) * page_size; i++) { dt_est_data.Rows.RemoveAt(0); } UltraWebGrid1.Clear(); UltraWebGrid1.DataSource = dt_est_data; UltraWebGrid1.DataBind(); lblRowCount.Text = DT_EST_DATA.Rows.Count.ToString("#,##0"); } } }