Beispiel #1
0
 // Used by Janitor.Fody
 private void DisposeManaged()
 {
     CellsCollection.Clear();
     ColumnsCollection.Clear();
     RowsCollection.Clear();
     MergedRanges.RemoveAll();
 }
 public void Dispose()
 {
     CellsCollection.Clear();
     ColumnsCollection.Clear();
     RowsCollection.Clear();
     MergedRanges.RemoveAll();
 }
Beispiel #3
0
    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();
    }
Beispiel #4
0
    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 = "";
        }
    }
Beispiel #5
0
 public void CreateCells(List <CellData> cellsDataList)
 {
     foreach (var cellData in cellsDataList)
     {
         CellsCollection.Add(new CellBlock(_mainBlockViewModel, cellData));
         CellsCollection.Last().PropertyChanged += RowBlockViewModel_PropertyChanged;
         CellsCollection.Last().SelectMode       = _mainBlockViewModel.SelectMode;
     }
 }
Beispiel #6
0
        public void Initialize(FieldSettings settings)
        {
            SetFieldSettings(settings);
            collectionCells = new CellsCollection <TCell>();
            countLabels     = MineCount;
            int count = CellCount;

            InitializeCells(count);
            SetMines(count, countLabels);
            SetLinks(count);
            SetVisualParameters();
            SendFieldMessage(FieldMessage.Initialized);
            SendFieldMessage(FieldMessage.RegenerationNeeded);
        }
Beispiel #7
0
    // 점수그래프 적용하기
    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"]);
        }
    }
        private void ultraGrid1_AfterRowUpdate(object sender, RowEventArgs e)
        {
            if (this.ultraGrid1.ActiveRow.IsAddRow)
            {
                return;
            }
            CellsCollection row = null;

            if (this.ultraGrid1.ActiveRow != null)
            {
                row = this.ultraGrid1.ActiveRow.Cells;
                row["SiteID"].Value           = VWA4Common.GlobalSettings.CurrentSiteID;
                row["PeriodUniqueName"].Value = "Month";
                if (row["PeriodStartDate"].Value == null)
                {
                    MessageBox.Show("Period start date is required.");
                    return;
                }
            }

            //ultraGrid1.UpdateData();
            if (row != null)
            {
                decimal fca = row["FoodCostActual"].Value != DBNull.Value ? Convert.ToDecimal(row["FoodCostActual"].Value) : Convert.ToDecimal(0.00);
                decimal fcb = row["FoodCostBudget"].Value != DBNull.Value ? Convert.ToDecimal(row["FoodCostBudget"].Value) : Convert.ToDecimal(0.00);
                decimal fra = row["FoodRevenueActual"].Value != DBNull.Value ? Convert.ToDecimal(row["FoodRevenueActual"].Value) : Convert.ToDecimal(0.00);
                decimal frb = row["FoodRevenueBudget"].Value != DBNull.Value ? Convert.ToDecimal(row["FoodRevenueBudget"].Value) : Convert.ToDecimal(0.00);
                int     mca = row["MealCountActual"].Value != DBNull.Value ? Convert.ToInt32(row["MealCountActual"].Value) : 0;
                int     mcb = row["MealCountBudget"].Value != DBNull.Value ? Convert.ToInt32(row["MealCountBudget"].Value) : 0;

                this.updateFinancialData(fca, fcb, fra, frb, mca, mcb, row["PeriodUniqueName"].Value.ToString(), DateTime.Parse(row["PeriodStartDate"].Value.ToString()));
            }

            if (this.ultraGrid1.ActiveRow != null && this.ultraGrid1.ActiveRow.Cells["ID"].Value != DBNull.Value)
            {
                ultraGrid1.DataSource = VWA4Common.DB.Retrieve(sql);
                Initialized           = true;
                ultraGrid1.Refresh();
            }

            // Check the task complete
            VWA4Common.UtilitiesInstance utils = new VWA4Common.UtilitiesInstance();
            utils.setTaskCheck(DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek), true, "entermonthlyfinancials");
        }
Beispiel #9
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (brush != null)
         {
             brush.Dispose();
             brush = null;
         }
         if (bitMap != null)
         {
             bitMap.Dispose();
             bitMap = null;
         }
         if (cells != null)
         {
             cells.Clear();
             cells = null;
         }
     }
 }
Beispiel #10
0
    // 상태값 이미지 적용하기
    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]);
            }
        }
    }
Beispiel #11
0
    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 = "";
        }
    }
Beispiel #12
0
        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;
                    }
                }
            }
        }
Beispiel #13
0
    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 = "";
        }
    }
Beispiel #14
0
    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;
            }
        }
    }
Beispiel #15
0
 /// <summary>
 /// Costruttore vuoto. Crea l'oggetto inizializzando a vuote le collezioni di righe, colonne e celle.
 /// </summary>
 public Range()
 {
     _rows  = new RowsCollection(this);
     _cols  = new ColumnsCollection(this);
     _cells = new CellsCollection(this);
 }
Beispiel #16
0
 public GDISelector()
 {
     cells = new CellsCollection <ICell>();
 }
Beispiel #17
0
 protected Cell()
 {
     Closed      = true;
     state       = DefaultCellState;
     aroundCells = new CellsCollection <ICell>();
 }
Beispiel #18
0
    // 등급 조정 적용하기
    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 = "&nbsp;";//"<font color='red'>조정권한 없음</font>";
            }
        }
        else
        {
            cells.FromKey(column).Value = "<font color='red'>컬럼정보 없음</font>";
        }
    }
Beispiel #19
0
        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;";
                        }
                    }
                }
            }
        }
Beispiel #20
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;
        }
    }