示例#1
0
    private void EstDeptStgDataBinding(int ver_id, int estterm_ref_id, int est_dept_ref_id)
    {
        Biz_PDTAndAHPStgEstDeptDatas pdtAhpEstDept = new Biz_PDTAndAHPStgEstDeptDatas();
        DataSet ds = pdtAhpEstDept.GetPDTAndAHPEstDeptStgList(ver_id
                                                              , estterm_ref_id
                                                              , est_dept_ref_id
                                                              , "Y");

        DataGrid2.DataSource = ds;
        DataGrid2.DataBind();

        lblStgCount.Text = ds.Tables[0].Rows.Count.ToString();

        if (ds.Tables[0].Rows.Count <= 1)
        {
            DataGrid1.Visible = false;
            DataGrid3.Visible = false;
            iBtnSave.Visible  = false;
        }
        else
        {
            DataGrid1.Visible = true;
            DataGrid3.Visible = true;
            iBtnSave.Visible  = true;
        }
    }
示例#2
0
    private DataTable GetAHPPointDataTable()
    {
        int est_dept_ref_id = int.Parse(txtDeptID.Text);

        Biz_AHPEstDeptStgDatas       ahpEstDept    = new Biz_AHPEstDeptStgDatas();
        Biz_PDTAndAHPStgEstDeptDatas pdtAhpEstDept = new Biz_PDTAndAHPStgEstDeptDatas();
        DataSet ds = pdtAhpEstDept.GetPDTAndAHPEstDeptStgList(VER_ID
                                                              , ESTTERM_REF_ID
                                                              , est_dept_ref_id
                                                              , "Y");

        int stg_count = ds.Tables[0].Rows.Count;

        if (stg_count == 0 || stg_count == 1)
        {
            return(null);
        }

        DataTable dataTable = new DataTable();
        DataRow   dr        = null;

        dataTable.Columns.Add("VER_ID", typeof(int));
        dataTable.Columns.Add("ESTTERM_REF_ID", typeof(int));
        dataTable.Columns.Add("EST_DEPT_REF_ID", typeof(int));
        dataTable.Columns.Add("STG_REF_ID", typeof(int));
        dataTable.Columns.Add("STG_NAME", typeof(string));
        dataTable.Columns.Add("MULTIPLY", typeof(float));
        dataTable.Columns.Add("GEOMEAN", typeof(double));
        dataTable.Columns.Add("WEIGHT", typeof(float));
        dataTable.Columns.Add("SUM", typeof(float));
        dataTable.Columns.Add("WS", typeof(double));
        dataTable.Columns.Add("CI", typeof(float));
        dataTable.Columns.Add("CR", typeof(float));

        double total_geomean = 0;

        foreach (DataRow dataRow in ds.Tables[0].Rows)
        {
            double multi_point = ahpEstDept.GetAHPEstDeptStgMultiPlyPoint(VER_ID
                                                                          , ESTTERM_REF_ID
                                                                          , est_dept_ref_id
                                                                          , int.Parse(dataRow["STG_REF_ID"].ToString()));

            double sum_point = ahpEstDept.GetAHPEstDeptStgSumPoint(VER_ID
                                                                   , ESTTERM_REF_ID
                                                                   , est_dept_ref_id
                                                                   , int.Parse(dataRow["STG_REF_ID"].ToString()));

            if (multi_point == 0)
            {
                return(null);
            }

            dr = dataTable.NewRow();

            dr["VER_ID"]          = VER_ID;
            dr["ESTTERM_REF_ID"]  = ESTTERM_REF_ID;
            dr["EST_DEPT_REF_ID"] = est_dept_ref_id;
            dr["STG_REF_ID"]      = dataRow["STG_REF_ID"];
            dr["STG_NAME"]        = dataRow["STG_NAME"];
            dr["MULTIPLY"]        = multi_point;
            dr["GEOMEAN"]         = Math.Pow((double)multi_point, (double)1 / (double)stg_count);

            total_geomean += Convert.ToDouble(dr["GEOMEAN"]);

            dr["WEIGHT"] = 0;
            dr["SUM"]    = sum_point;
            dr["WS"]     = 0;
            dr["CI"]     = 0;
            dr["CR"]     = 0;
            dataTable.Rows.Add(dr);
        }

        double lambda_max = 0;
        double c_i        = 0;
        double rci        = 0;
        double ratio      = 0;

        float[] rciArr = new float[10];

        for (int i = 0; i < dataTable.Rows.Count; i++)
        {
            DataRow drRow = dataTable.Rows[i];

            drRow["WEIGHT"] = (double)drRow["GEOMEAN"] / total_geomean;
            drRow["WS"]     = double.Parse(drRow["WEIGHT"].ToString()) * double.Parse(drRow["SUM"].ToString());
            drRow["WEIGHT"] = Math.Round(double.Parse(drRow["WEIGHT"].ToString()) * 100.00, 2);

            lambda_max += double.Parse(drRow["WS"].ToString());
        }

        rciArr[0] = 0;
        rciArr[1] = 0;
        rciArr[2] = 0.58f;
        rciArr[3] = 0.9f;
        rciArr[4] = 1.12f;
        rciArr[5] = 1.24f;
        rciArr[6] = 1.32f;
        rciArr[7] = 1.41f;
        rciArr[8] = 1.45f;
        rciArr[9] = 1.49f;

        c_i   = (lambda_max - stg_count) / (stg_count - 1);
        rci   = rciArr[stg_count - 1];
        ratio = c_i / rci;

        for (int i = 0; i < dataTable.Rows.Count; i++)
        {
            DataRow drRow = dataTable.Rows[i];

            drRow["CI"] = c_i;
            drRow["CR"] = ratio;
        }

        if (Math.Round(c_i * 100.00, 2) > 10)
        {
            lblMsg.ForeColor = Color.Red;
            lblCI.ForeColor  = Color.Red;
            lblCR.ForeColor  = Color.Red;
            lblMsg.Text      = "귀하의 선택은 논리적 문제가 있으니<br>재 점검 바랍니다.";
        }
        else
        {
            lblMsg.ForeColor = Color.Blue;
            lblCI.ForeColor  = Color.Blue;
            lblCR.ForeColor  = Color.Blue;
            lblMsg.Text      = "귀하의 선택은 논리적 일관성이 있습니다.";
        }

        lblCI.Text = Convert.ToString(Math.Round(c_i * 100.00, 2)) + "%";
        lblCR.Text = Convert.ToString(Math.Round(ratio * 100.00, 2)) + "%";

        return(dataTable);
    }