Beispiel #1
0
    private void SetGridBind()
    {
        MicroBSC.BSC.Biz.Biz_Bsc_Est_Dept_Grade objGrade = new MicroBSC.BSC.Biz.Biz_Bsc_Est_Dept_Grade();
        DataSet rDs = objGrade.GetAllList(this.IEstTermRefID, PageUtility.GetIntByValueDropDownList(ddlDeptType));

        ugrdGradeList.Clear();
        ugrdGradeList.DataSource = rDs;
        ugrdGradeList.DataBind();

        if (PageUtility.GetIntByValueDropDownList(ddlDeptType) < 1)
        {
            iBtnUpdate.Visible   = false;
            ImgBtnAddRow.Visible = false;
        }
        else
        {
            iBtnUpdate.Visible   = true;
            ImgBtnAddRow.Visible = true;
        }
    }
Beispiel #2
0
    private int UpdateGrade()
    {
        UltraGridRow row;
        int          intTxrUser = gUserInfo.Emp_Ref_ID;
        int          intRtn     = 0;
        int          intRow     = ugrdGradeList.Rows.Count;

        MicroBSC.BSC.Biz.Biz_Bsc_Est_Dept_Grade objBSC = new MicroBSC.BSC.Biz.Biz_Bsc_Est_Dept_Grade();

        CheckBox        chkTempGradeYN;
        TemplatedColumn grade_col = (TemplatedColumn)ugrdGradeList.Columns.FromKey("MID_GRADE_YN");

        DropDownList    ddlTempYN;
        TemplatedColumn yn_col = (TemplatedColumn)ugrdGradeList.Columns.FromKey("USE_YN");


        for (int i = 0; i < intRow; i++)
        {
            row = ugrdGradeList.Rows[i];

            string iType           = Convert.ToString(row.Cells.FromKey("ITYPE").Value.ToString());
            int    iEstterm_ref_id = PageUtility.GetIntByValueDropDownList(ddlEstTermInfo);
            int    iEstDeptType    = (row.Cells.FromKey("EST_DEPT_TYPE").Value == null) ? 0 : Convert.ToInt32(row.Cells.FromKey("EST_DEPT_TYPE").Value.ToString());
            int    iGradeRefId     = (row.Cells.FromKey("GRADE_REF_ID").Value == null) ? 0 : Convert.ToInt32(row.Cells.FromKey("GRADE_REF_ID").Value.ToString());
            string iGradeName      = row.Cells.FromKey("GRADE_NAME").ToString();
            double iMinValue       = Convert.ToDouble(row.Cells.FromKey("MIN_VALUE").Value);
            double iMaxValue       = Convert.ToDouble(row.Cells.FromKey("MAX_VALUE").Value);

            chkTempGradeYN = (CheckBox)((CellItem)grade_col.CellItems[ugrdGradeList.Rows[i].BandIndex]).FindControl("chkMidGrade_YN");
            int iSort_order = Convert.ToInt32(row.Cells.FromKey("SORT_ORDER").Value.ToString());
            ddlTempYN = (DropDownList)((CellItem)yn_col.CellItems[ugrdGradeList.Rows[i].BandIndex]).FindControl("ddlUse_YN");
            int iuser = intTxrUser;


            if (iType == "U")
            {
                intRtn += objBSC.UpdateData(iEstterm_ref_id
                                            , iEstDeptType
                                            , iGradeRefId
                                            , iGradeName
                                            , iMinValue
                                            , iMaxValue
                                            , (chkTempGradeYN.Checked == true)? "Y": "N"
                                            , iSort_order
                                            , ddlTempYN.SelectedValue.ToString()
                                            , iuser);
            }
            else if (iType == "A")
            {
                intRtn += objBSC.InsertData(iEstterm_ref_id
                                            , iEstDeptType
                                            , iGradeRefId
                                            , iGradeName
                                            , iMinValue
                                            , iMaxValue
                                            , (chkTempGradeYN.Checked == true) ? "Y" : "N"
                                            , iSort_order
                                            , ddlTempYN.SelectedValue.ToString()
                                            , iuser);
            }
        }

        return(intRtn);
    }
Beispiel #3
0
        public DataSet GetEstDeptRank(int iestterm_ref_id, string iymd, int idept_type, string isum_type
                                      , int est_dept_id, string showChildDept, bool includeExtScore, int itxr_user)
        {
            Biz_Bsc_Est_Dept_Grade objGrd = new Biz_Bsc_Est_Dept_Grade();
            DataSet dsGrade = objGrd.GetAllList(iestterm_ref_id, idept_type);
            DataSet dsRank  = new DataSet();

            if (includeExtScore)
            {
                dsRank = base.GetEstDeptRankList(iestterm_ref_id, iymd, idept_type, isum_type, est_dept_id, showChildDept, includeExtScore, itxr_user);
            }
            else
            {
                dsRank = base.GetEstDeptRankList(iestterm_ref_id, iymd, idept_type, isum_type, est_dept_id, showChildDept, itxr_user);
            }


            dsRank.Tables[0].Columns.Add("RANK_PERCENT", typeof(double));
            dsRank.Tables[0].Columns.Add("DEPT_GRADE", typeof(string));

            int intRankRow = dsRank.Tables[0].Rows.Count;
            int intGrdeRow = dsGrade.Tables[0].Rows.Count;

            if (intGrdeRow < 1)
            {
                return(dsRank);
            }

            double currRank = 0;
            double lastRank = 0;

            double minValue = 0;
            double maxValue = 0;

            double grdValue = 0;
            double midValue = 0;

            grdValue = Math.Round((double.Parse(intRankRow.ToString()) / double.Parse(intGrdeRow.ToString())), 0);

            grdValue = (grdValue < 1) ? 1 : grdValue;
            midValue = (intGrdeRow * grdValue - intRankRow);


            //int intMidRank = -1;
            //for (int i = 0; i < intGrdeRow; i++)
            //{
            //    if (dsGrade.Tables[0].Rows[i]["MID_GRADE_YN"].ToString() == "Y")
            //    {
            //        intMidRank = i;
            //    }

            //    if (intMidRank < i)
            //    {
            //        dsGrade.Tables[0].Rows[i]["MIN_VALUE"] = (i + 1) * grdValue;
            //    }
            //    else if (intMidRank == i)
            //    {
            //        dsGrade.Tables[0].Rows[i]["MIN_VALUE"] = ((i + 1) * grdValue) + midValue * -1;
            //    }
            //    else
            //    {
            //        dsGrade.Tables[0].Rows[i]["MIN_VALUE"] = ((i + 1) * grdValue) + midValue * -1;
            //    }

            //    if (intMidRank >= i)
            //    {
            //        intMidRank += 1;
            //    }
            //}

            //for (int i = 0; i < intRankRow; i++)
            //{
            //    currRank = Convert.ToDouble(dsRank.Tables[0].Rows[i]["RANK_ID"].ToString());
            //    dsRank.Tables[0].Rows[i]["RANK_PERCENT"] = currRank ;

            //    for (int j = 0; j < intGrdeRow; j++)
            //    {
            //        minValue = Convert.ToDouble(dsGrade.Tables[0].Rows[j]["MIN_VALUE"].ToString());

            //        if (currRank <= minValue)
            //        {
            //            dsRank.Tables[0].Rows[i]["DEPT_GRADE"] = dsGrade.Tables[0].Rows[j]["GRADE_NAME"].ToString();
            //            break;
            //        }
            //    }
            //}

            if (intRankRow > 0)
            {
                try
                {
                    lastRank = Convert.ToDouble(dsRank.Tables[0].Rows[intRankRow - 1]["RANK_ID"].ToString());
                }
                catch
                {
                    lastRank = 0;
                }

                if (intRankRow <= intGrdeRow)
                {
                    for (int i = 0; i < intRankRow; i++)
                    {
                        dsRank.Tables[0].Rows[i]["DEPT_GRADE"] = dsGrade.Tables[0].Rows[i]["GRADE_NAME"].ToString();
                    }
                }
                else
                {
                    for (int i = 0; i < intRankRow; i++)
                    {
                        currRank = (lastRank == 0 ? 0 : Math.Round(((i + 1) / lastRank) * 100, 4));
                        dsRank.Tables[0].Rows[i]["RANK_PERCENT"] = currRank;
                        double dScore = Convert.ToDouble(dsRank.Tables[0].Rows[i]["SCORE"].ToString());

                        for (int j = 0; j < intGrdeRow; j++)
                        {
                            minValue = Convert.ToDouble(dsGrade.Tables[0].Rows[j]["MIN_VALUE"].ToString());
                            maxValue = Convert.ToDouble(dsGrade.Tables[0].Rows[j]["MAX_VALUE"].ToString());

                            if (dScore >= minValue && dScore <= maxValue)
                            {
                                dsRank.Tables[0].Rows[i]["DEPT_GRADE"] = dsGrade.Tables[0].Rows[j]["GRADE_NAME"].ToString();
                                break;
                            }
                        }
                    }
                }
            }

            return(dsRank);
        }