public static void SetGradeByScale_ABS(DataTable dtScopeData , DataRowView drw , CellsCollection cells) { // 계산된 등급 컬럼에 절대평가의 범위 구간에 따라 해당하는 평가등급으로 반환한다. string columnName = "GRADE_CALC_ID"; string scaleColumnName = "SCALE_NAME"; cells.FromKey(scaleColumnName).Value = "절대평가"; if (dtScopeData.Rows.Count > 0) { double point = DataTypeUtility.GetToDouble(drw["POINT"]); DataRow[] drArrScope = dtScopeData.Select(string.Format(@"SCALE_ID = '{0}' AND START_SCOPE <= {1} AND END_SCOPE > {1}" , "ABS" , point)); if (drArrScope.Length > 0) { cells.FromKey(columnName).Value = drArrScope[0]["GRADE_ID"]; } else { cells.FromKey(columnName).Value = ""; } } else { cells.FromKey(columnName).Value = ""; } }
private void DeleteGroup(int activeRowIndex) { string containerGroup = dg.Rows[activeRowIndex].Cells.FromKey("Select").Title; lbError.Visible = false; bool success = true; if (dg != null && dg.Rows != null && dg.Rows.Count > 0) { for (int i = 0; i < dg.Rows.Count; i++) { CellsCollection cl = dg.Rows[i].Cells; if (cl.FromKey("Select").Style.CssClass != "ptbgroup" && cl.FromKey("ContainerGroupPath").Value.ToString() == containerGroup) { HyperCatalog.Business.InputFormContainer ifCObj = HyperCatalog.Business.InputFormContainer.GetByKey(Convert.ToInt32(cl.FromKey("InputFormContainerId").Value)); if (!ifCObj.Delete(HyperCatalog.Shared.SessionState.User.Id)) { success = false; lbError.CssClass = "hc_error"; lbError.Text += HyperCatalog.Business.InputFormContainer.LastError + "<br/>" + Environment.NewLine; lbError.Visible = true; } } } } UpdateDataView(); }
// 상태값 이미지 적용하기 public static void SetStatusImage(DataRowView drw , CellsCollection cells) { string column = "STATUS_IMG_PATH"; if (!cells.Exists(column)) { return; } if (drw.DataView.Table.Columns.Contains(column)) { if (drw[column] == DBNull.Value) { cells.FromKey(column).Value = string.Format("<img src='{0}'>", "../images/icon/color/red.gif"); } else { cells.FromKey(column).Value = string.Format("<img src='{0}'>", drw[column]); } } }
public static void SetGradeToPoint(DataTable dtScopeData , DataRowView drw , CellsCollection cells) { string columnName = "GRADE_TO_POINT_CALC"; string grade_id = drw["GRADE_ID"].ToString(); string scale_id = "ABS"; DataRow[] drArrScope = dtScopeData.Select(string.Format("SCALE_ID = '{0}' AND GRADE_ID = '{1}'" , scale_id , grade_id)); if (drArrScope.Length > 0) { cells.FromKey(columnName).Value = drArrScope[0]["GRADE_TO_POINT"]; } else { cells.FromKey(columnName).Value = ""; } }
// 점수그래프 적용하기 public static void SetPointBar(DataRowView drw , CellsCollection cells) { string column = "POINT_BAR"; if (!cells.Exists(column)) { return; } if (drw["POINT"] != DBNull.Value) { cells.FromKey(column).Value = string.Format("<img src='{0}' width='{1}%' height='8px'>" , "../images/bg/point_bar.gif" , drw["POINT"]); } }
protected void dgLinks_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { CellsCollection cells = e.Row.Cells; if (cells.FromKey("IsExcluded") != null && Convert.ToBoolean(cells.FromKey("IsExcluded").Value)) { e.Row.Delete(); } else { // Retrieve country code if (cells.FromKey("CountryCode") != null && cells.FromKey("ImageCountry") != null) { string countryCode = string.Empty; if (cells.FromKey("CountryCode") != null && cells.FromKey("CountryCode").Value != null) { countryCode = cells.FromKey("CountryCode").ToString(); } // Update image for current country if (countryCode.Length > 0 && cells.FromKey("ImageCountry") != null) { cells.FromKey("ImageCountry").Text = "<img title=\"" + countryCode + "\" src=\"/hc_v4/img/flags/" + countryCode.ToLower() + ".gif\">"; } } if (cells.FromKey("LinkFrom") != null) { bool linkFrom = Convert.ToBoolean(cells.FromKey("LinkFrom").Value); if (!linkFrom) // Hardware list { if (cells.FromKey("Name") != null && cells.FromKey("ItemName") != null && cells.FromKey("ItemName").Value != null) { cells.FromKey("Name").Text = cells.FromKey("ItemName").Value.ToString(); } if (cells.FromKey("SKU") != null && cells.FromKey("ItemSKU") != null && cells.FromKey("ItemSKU").Value != null) { cells.FromKey("SKU").Text = cells.FromKey("ItemSKU").Value.ToString(); } if (cells.FromKey("Class") != null && cells.FromKey("ClassName") != null && cells.FromKey("ClassName").Value != null) { cells.FromKey("Class").Text = cells.FromKey("ClassName").Value.ToString(); } } else // Companion list { if (cells.FromKey("Name") != null && cells.FromKey("SubItemName") != null && cells.FromKey("SubItemName").Value != null) { cells.FromKey("Name").Text = cells.FromKey("SubItemName").Value.ToString(); } if (cells.FromKey("SKU") != null && cells.FromKey("SubItemSKU") != null && cells.FromKey("SubItemSKU").Value != null) { cells.FromKey("SKU").Text = cells.FromKey("SubItemSKU").Value.ToString(); } if (cells.FromKey("Class") != null && cells.FromKey("SubClassName") != null && cells.FromKey("SubClassName").Value != null) { cells.FromKey("Class").Text = cells.FromKey("SubClassName").Value.ToString(); } } if (cells.FromKey("Name") != null) { cells.FromKey("Name").Style.Wrap = true; } if (cells.FromKey("SKU") != null) { cells.FromKey("SKU").Style.Wrap = true; } if (cells.FromKey("Class") != null) { cells.FromKey("Class").Style.Wrap = true; } } } }
protected void dg_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { CellsCollection cells = e.Row.Cells; string filter = txtFilter.Text.Trim(); bool keep = true; bool isMandatory = Convert.ToBoolean(cells.FromKey("IsMandatory").Value); bool isInherited = Convert.ToBoolean(cells.FromKey("Inherited").Value); bool isResource = Convert.ToBoolean(cells.FromKey("IsResource").Value); bool isBoolean = Convert.ToBoolean(cells.FromKey("IsBoolean").Value); bool readOnly = Convert.ToBoolean(cells.FromKey("ReadOnly").Value); if (filter.Length > 0) { keep = false; foreach (Infragistics.WebUI.UltraWebGrid.UltraGridCell c in cells) { if (!c.Column.Hidden && c.Value != null && c.Text != HyperCatalog.Business.Chunk.BlankValue) { if (c.Text.ToLower().IndexOf(filter.ToLower()) >= 0) { c.Text = Utils.CReplace(c.Text, filter, "<font color=red><b>" + filter + "</b></font>", 1); keep = true; } } } } if (!keep) { e.Row.Delete(); } else { //If RTL languages, ensure correct display if ((bool)cells.FromKey("Rtl").Value) { cells.FromKey("Value").Style.CustomRules = "direction: rtl;";//unicode-bidi:bidi-override;"; } // Update CultureCode column cells.FromKey("CultureCode").Text = SessionState.Culture.Code; // Container group string containerGroup = cells.FromKey("Path").Text; if (currentGroup != containerGroup) { currentGroup = containerGroup; groupCount++; } // Check if ReadOnly container if (readOnly) { cells.FromKey("ContainerName").Text = cells.FromKey("ContainerName").Text + " <img src='/hc_v4/img/ed_glasses.gif'/>"; } //Display Mandatory logo UltraGridCell aCell = cells.FromKey("Mandatory"); aCell.Style.CssClass = "ptb1"; aCell.Text = string.Empty; // by default if (isMandatory) { aCell.Style.CssClass = "SCM"; // Status Chunk Mandatory } // Update Item column aCell = cells.FromKey("ItemId"); if (aCell.Text != itemId.ToString()) { aCell.Value = itemId.ToString(); } //Display Status logo aCell = cells.FromKey("Status"); if (aCell.Value != null) { ChunkStatus cStatus = (ChunkStatus)Enum.Parse(typeof(ChunkStatus), HyperCatalog.Business.Chunk.GetStatusFromString(cells.FromKey("Status").Value.ToString()).ToString()); string status = HyperCatalog.Business.Chunk.GetStatusFromEnum(cStatus); aCell.Style.CssClass = "S" + status; aCell.Value = string.Empty; } // Check if value is inherited aCell = cells.FromKey("Value"); aCell.Style.CssClass = "ptb3"; // by default aCell.Style.Wrap = true; // by default if (isInherited) { aCell.Style.CssClass = "overw"; aCell.Style.Wrap = true; } // Ensure multiline is kept if (aCell.Value != null) { // if chunk is resource, try do display it if (isResource && aCell.Text != string.Empty) { try { string sUrl = aCell.Text; // Call HyperPublisher WebMethod to convert URL to absolute URL XmlDocument xmlInfo = new XmlDocument(); xmlInfo.LoadXml(HCPage.WSDam.ResourceGetByPath(sUrl)); System.Xml.XmlNode node = xmlInfo.DocumentElement; string fullPath = node.Attributes["uri"].InnerText; if (fullPath.ToLower().IndexOf("notfound") > 0 || fullPath == string.Empty) { fullPath = "/hc_v4/img/ed_notfound.gif"; } aCell.Text = "<img src='" + fullPath + "?thumbnail=1&size=40' title='" + aCell.Text + "' border=0/>"; } catch (Exception ex) { Trace.Warn("DAM", "Exception processing DAM: " + ex.Message); } } else { // BLANK Value is replace by Readable sentence if (aCell.Text == HyperCatalog.Business.Chunk.BlankValue) { aCell.Text = HyperCatalog.Business.Chunk.BlankText; aCell.Style.CustomRules = string.Empty; } else { if (isBoolean && aCell.Text != string.Empty) { try { if (Convert.ToBoolean(aCell.Value)) { aCell.Text = "Yes"; } else { aCell.Text = "No"; } } catch { } // Value is not boolean! } else { aCell.Text = UITools.HtmlEncode(aCell.Text); } } // Display Fallback on cultures if current Culture <> "master" string sourceCultureCode = cells.FromKey("SourceCode").Text; if (sourceCultureCode != SessionState.Culture.Code) { aCell.Style.CustomRules = aCell.Style.CustomRules + "color:blue;font:italic;"; } } } } }
// 등급 조정 적용하기 public static void SetCtrlGrade(DataRowView drw , CellsCollection cells , DataTable dtColumnInfo , DataTable dtCtrlInfo , DataTable dtCtrlEstDeptMap , DataTable dtCtrlGradeData , int cur_emp_id) { // 등급조정 컬럼 string column = "CTRL_GRADE"; if (!cells.Exists(column)) { return; } DataRow[] drArr = dtColumnInfo.Select(string.Format(@"COL_STYLE_ID = 'BIZ' AND VISIBLE_YN = 'Y' AND COL_KEY = '{0}'" , column)); if (drArr.Length > 0) { DataRow[] drArrCtrlGradeData = dtCtrlGradeData.Select(string.Format(@"TGT_DEPT_ID = {0} AND TGT_EMP_ID = {1}" , drw["TGT_DEPT_ID"] , drw["TGT_EMP_ID"]), "CTRL_SEQ DESC"); foreach (DataRow drData in drArrCtrlGradeData) { if (DataTypeUtility.GetValue(drData["CTRL_YN"]).Equals("Y")) { cells.FromKey(column).Value = "<b><font color='#929292'>조정확정 완료</font></b>"; return; } } DataRow[] drArrCtrlInfo = dtCtrlInfo.Select(string.Format(@"CTRL_EMP_ID = {0} AND POINT_GRADE_TYPE = 'GRD'", cur_emp_id)); // 조정정보가 존재하는지 체크 if (drArrCtrlInfo.Length > 0) { DataRow[] drArrCtrlEstDeptMap = dtCtrlEstDeptMap.Select(string.Format(@"CTRL_ID = '{0}' AND DEPT_REF_ID = {1}" , drArrCtrlInfo[0]["CTRL_ID"] , drw["TGT_DEPT_ID"])); // 조정정보에 따른 부서정보가 존재하는지 체크 if (drArrCtrlEstDeptMap.Length > 0 || DataTypeUtility.GetYNToBoolean(drArrCtrlInfo[0]["ALL_EST_DEPT_YN"].ToString()) == true) { cells.FromKey(column).Value = string.Format("<a href='#null' onclick=\"ViewCtrlPage('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}');\"><font color='#2080D0'>등급조정 가능</font></a>" , drArrCtrlInfo[0]["CTRL_ID"] , drw["COMP_ID"] , drw["EST_ID"] , drw["ESTTERM_REF_ID"] , drw["ESTTERM_SUB_ID"] , drw["ESTTERM_STEP_ID"] , drw["EST_DEPT_ID"] , drw["EST_EMP_ID"] , cur_emp_id , drw["TGT_DEPT_ID"] , drw["TGT_EMP_ID"] , "GRD"); } else { cells.FromKey(column).Value = "<font color='red'>권한부서 없음</font>"; } } else { cells.FromKey(column).Value = " ";//"<font color='red'>조정권한 없음</font>"; } } else { cells.FromKey(column).Value = "<font color='red'>컬럼정보 없음</font>"; } }
public static void SetGradeByScale_REL(DataTable dtScopeData , DataTable dtEstData , DataRowView drw , CellsCollection cells) { // 계산된 등급컬럼에 상대평가에 따라 현재의 등수를 총수로 나눠 // 상위%값을 받아서 등급의 범위 구간에 따라 최종 등급을 반환 받는다. string columnName = "GRADE_CALC_ID"; string scaleColumnName = "SCALE_NAME"; cells.FromKey(scaleColumnName).Value = "상대평가"; if (dtScopeData.Rows.Count > 0) { string rel_grp_id = DataTypeUtility.GetValue(drw["REL_GRP_ID"]); double total_cnt = 0; double self_rank = 0; double self_rank_pct = 0; if (rel_grp_id.Equals("")) { cells.FromKey(columnName).Value = ""; return; } DataRow[] dtArrEstDataByRelGrpID = dtEstData.Select(string.Format("REL_GRP_ID = '{0}'", rel_grp_id), "POINT DESC"); total_cnt = dtArrEstDataByRelGrpID.Length; DataRow dataRowSelf = null; for (int i = 0; i <= total_cnt - 1; i++) { dtArrEstDataByRelGrpID[i]["RANK"] = i + 1; if (DataTypeUtility.GetToInt32(drw["TGT_DEPT_ID"]) == DataTypeUtility.GetToInt32(dtArrEstDataByRelGrpID[i]["TGT_DEPT_ID"]) && DataTypeUtility.GetToInt32(drw["TGT_EMP_ID"]) == DataTypeUtility.GetToInt32(dtArrEstDataByRelGrpID[i]["TGT_EMP_ID"])) { self_rank = i + 1; dataRowSelf = dtArrEstDataByRelGrpID[i]; } } self_rank_pct = (self_rank / total_cnt) * 100.00; DataRow[] drArrScope = dtScopeData.Select(string.Format(@"SCALE_ID = '{0}' AND START_SCOPE <= {1} AND END_SCOPE > {1}" , "REL" , self_rank_pct)); if (drArrScope.Length > 0) { // 동점자 처리 내용 if (self_rank > 1) //---------------------------- { DataRow[] drArrUpEstData = dtEstData.Select(string.Format("REL_GRP_ID = '{0}' AND RANK = {1}" , rel_grp_id , self_rank - 1)); // 상위 랭킹이 존재하는지 체크 if (drArrUpEstData.Length > 0) { if ((DataTypeUtility.GetToDouble(dataRowSelf["POINT"]) == DataTypeUtility.GetToDouble(drArrUpEstData[0]["POINT"])) && (DataTypeUtility.GetValue(dataRowSelf[columnName]) != DataTypeUtility.GetValue(drArrUpEstData[0][columnName])) ) { dataRowSelf[columnName] = DataTypeUtility.GetValue(drArrUpEstData[0][columnName]); cells.FromKey(columnName).Value = DataTypeUtility.GetValue(drArrUpEstData[0][columnName]); } else { dataRowSelf[columnName] = drArrScope[0]["GRADE_ID"]; cells.FromKey(columnName).Value = drArrScope[0]["GRADE_ID"]; } } else { dataRowSelf[columnName] = drArrScope[0]["GRADE_ID"]; cells.FromKey(columnName).Value = drArrScope[0]["GRADE_ID"]; } } else { dataRowSelf[columnName] = drArrScope[0]["GRADE_ID"]; cells.FromKey(columnName).Value = drArrScope[0]["GRADE_ID"]; } }//---------------------------- else { cells.FromKey(columnName).Value = ""; } } else { cells.FromKey(columnName).Value = ""; } }
public static void SetWeightByDptPos(DataRow[] drArrColumnNames , int comp_id , DataTable dtWeightData , DataRowView drw , CellsCollection cells) { foreach (DataRow drColumnName in drArrColumnNames) { string columnName = drColumnName["COL_KEY"].ToString(); if (columnName.IndexOf("WEIGHT_") < 0) { continue; } string est_id = columnName.Replace("WEIGHT_", ""); Biz_EstInfos estChildInfo = new Biz_EstInfos(comp_id, est_id); if (estChildInfo.Weight_Type != null && estChildInfo.Weight_Type.Equals("DPT")) { DataRow[] drArr = dtWeightData.Select(string.Format("EST_ID = '{0}' AND DEPT_REF_ID = {1}", est_id, drw["TGT_DEPT_ID"])); if (drArr.Length > 0) { cells.FromKey(columnName).Value = DataTypeUtility.GetToDouble(drArr[0]["WEIGHT"]); } else { cells.FromKey(columnName).Value = 0; } } else if (estChildInfo.Weight_Type != null && estChildInfo.Weight_Type.Equals("POS")) { //1. 해당 Row의 부서 정보로 검색 //2. 부서_직급,직책에서 해당당 직급,직책으로 적용 //3. 마지막으로 직급,직책의 값 으로 가중치 적용 //해당 부서 중 직책, 직급을 선별 DataRow[] drArrEstPosDetail = dtWeightData.Select(string.Format("EST_ID = '{0}' AND DEPT_REF_ID = {1}", est_id, drw["TGT_DEPT_ID"]), "SEQ"); string weight = ""; //선별된 직책, 직급의 순서에 따라 foreach (DataRow drChildPosDetail in drArrEstPosDetail) { // 기본값이면 if (drChildPosDetail["POS_VALUE"].ToString().Equals("-")) { cells.FromKey(columnName).Value = DataTypeUtility.GetToDouble(drChildPosDetail["WEIGHT"]); break; } else // 선별된 직급 { if (drw[string.Format("TGT_POS_{0}_ID", drChildPosDetail["POS_ID"])].ToString().Equals(drChildPosDetail["POS_VALUE"].ToString())) { weight = DataTypeUtility.GetString(drChildPosDetail["WEIGHT"]); //cells.FromKey(columnName).Value = DataTypeUtility.GetToDouble(drChildPosDetail["WEIGHT"]); break; } } } if (weight.Length > 0) { cells.FromKey(columnName).Value = DataTypeUtility.GetToDouble(weight); } else { //직급별 가중치 테이블에 데이터가 없을 경우 } } else { cells.FromKey(columnName).Value = 0; } } }
protected void ugrdMBO_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { //CheckBox chkCheck; TemplatedColumn Col_Check = (TemplatedColumn)e.Row.Band.Columns.FromKey("selchk"); CheckBox chkCheck = (CheckBox)((CellItem)Col_Check.CellItems[e.Row.BandIndex]).FindControl("cBox"); //chkCheck.Enabled = (e.Row.Cells.FromKey("KPI_CLASS_REF_ID").Value.ToString() != "STG") ? false : true; //if (e.Row.Cells.FromKey("APPROVAL_STATUS").Value.ToString() == "Y") // chkCheck.Enabled = false; //if (e.Row.Cells.FromKey("CHAMPION_EMP_ID").Value.ToString() != gUserInfo.Emp_Ref_ID.ToString()) // chkCheck.Enabled = false; //if (((DataRowView)e.Data)["CHECK_YN"].ToString() == "N") // chkCheck.Enabled = false; //if (drv["COM_DEPT_REF_ID"].ToString() != this.IDEPT_ID.ToString()) // chkCheck.Enabled = false; //if (((DataRowView)e.Data)["APPROVAL_STATUS"].ToString() == "N") // chkCheck.Enabled = true; string estterm_ref_id = DataTypeUtility.GetValue(e.Row.Cells.FromKey("ESTTERM_REF_ID").Value); string kpi_code = DataTypeUtility.GetValue(e.Row.Cells.FromKey("KPI_CODE").Value); string kpi_name = DataTypeUtility.GetValue(e.Row.Cells.FromKey("KPI_NAME").Value); string onclick = "<a href='#null' onclick=\"doLinking_MBO('{0}','{1}','{2}')\">{3}</a>"; string link = string.Format(onclick, estterm_ref_id, kpi_code, ICCB2, kpi_name); e.Row.Cells.FromKey("KPI_NAME").Value = link; CellsCollection cells = e.Row.Cells; cells.FromKey("WEIGHT").Style.BackColor = System.Drawing.Color.MintCream; DataTable dt = DataTypeUtility.FilterSortDataTable(DT_KPI_WEIGHT, string.Format("KPI_REF_ID='{0}'", cells.FromKey("KPI_REF_ID"))); double weight; if (dt.Rows.Count > 0) { weight = DataTypeUtility.GetToDouble(dt.Rows[0]["WEIGHT"]); } else { weight = 0; } cells.FromKey("WEIGHT").Value = weight; string imgHTML = "<img src=\"{0}\" alt=\"\" />"; cells.FromKey("IMG_USE_YN").Value = (cells.FromKey("USE_YN").Value.ToString() == "Y") ? string.Format(imgHTML, "../images/icon_o.gif") : string.Format(imgHTML, "../images/icon_x.gif"); cells.FromKey("IMG_APPROVAL_STATUS").Value = (cells.FromKey("APPROVAL_STATUS").Value.ToString() == "Y") ? string.Format(imgHTML, "../images/icon_o.gif") : string.Format(imgHTML, "../images/icon_x.gif"); if (cells.FromKey("USE_YN").Value.ToString().Equals("N")) { cells.FromKey("WEIGHT").Value = "0"; cells.FromKey("WEIGHT").AllowEditing = AllowEditing.No; } }