예제 #1
0
    public bool Create()
    {
        bool bReturn = false;

        if (m_Table == null) return bReturn;

        GenDetailTableHeader();

        int i, Start_SC = 1;
        string Style_SC;
        PccRow myRow;
        PccMsg myMsg;
        PccMsg myTempMsg;

        GetMenuAuth myAuth = new GetMenuAuth();

        if (m_myDTableData != null)
        {
            foreach (DataRow myDRow in m_myDTableData.Rows)
            {
                if (Start_SC % 2 == 0) Style_SC = m_RowClass1; else Style_SC = m_RowClass2;

                myRow = new PccRow("", HorizontalAlign.Center, VerticalAlign.Middle, 0);
                myRow.SetRowCss(Style_SC);

                string strData = "";

                for (i = 0; i < m_FieldsItem.Length; i++)
                {
                    if (m_FieldsItem[i] != "--NO--")
                    {
                        myMsg = new PccMsg(m_FieldsType[i]);

                        if (myMsg.Query("Type") != "Space")
                        {
                            if (Convert.IsDBNull(myDRow[m_FieldsItem[i]]))
                            {
                                strData = "";
                            }
                            else
                            {
                                if (m_TransFunc.Length != 0)
                                {
                                    try
                                    {
                                        strData = CallTrnasFunc(m_objThis, m_TransFunc[i], myDRow[m_FieldsItem[i]].ToString());
                                    }
                                    catch (Exception ex)
                                    {
                                        strData = myDRow[m_FieldsItem[i]].ToString() + ex.Message;
                                    }

                                }
                                else
                                {
                                    strData = myDRow[m_FieldsItem[i]].ToString();
                                }
                            }
                        }

                        switch (myMsg.Query("Type"))
                        {
                            case "Text":
                                //myRow.AddTextCell(myDRow[m_FieldsItem[i]].ToString(),m_FieldsPercent[i]);
                                //myRow.AddTextCell(strData,m_FieldsPercent[i]);
                                if (myMsg.Query("HAlign").Equals(string.Empty))
                                    myRow.AddTextCell(strData, m_FieldsPercent[i]);
                                else
                                {
                                    switch (myMsg.Query("HAlign"))
                                    {
                                        case "Center":
                                            myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Center);
                                            break;
                                        case "Right":
                                            if ((myMsg.Query("Round").Equals(string.Empty)) || (strData.Equals(string.Empty)))
                                            {
                                                myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Right);
                                            }
                                            else
                                            {
                                                int round = int.Parse(myMsg.Query("Round"));
                                                decimal temp = decimal.Parse(strData);
                                                temp = Math.Round(temp, round);
                                                myRow.AddTextCell(temp.ToString(), m_FieldsPercent[i], HorizontalAlign.Right);

                                            }
                                            break;
                                        case "Left":
                                            myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Left);
                                            break;
                                    }
                                }
                                break;
                            case "ImageButton":
                                break;
                            case "HyperLink":
                                break;
                            case "LinkButton":
                                break;
                            case "CheckBox":
                                myTempMsg = new PccMsg();
                                //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString());
                                myTempMsg.CreateFirstNode("Checked", strData);
                                myTempMsg.CreateFirstNode("Name", m_TableName);
                                myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString());
                                myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]);
                                break;
                            case "CheckBoxReadOnly":
                                myTempMsg = new PccMsg();
                                //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString());
                                myTempMsg.CreateFirstNode("Checked", strData);
                                myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName);
                                myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString());
                                myRow.AddCheckBoxReadOnlyCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]);
                                break;
                            case "CheckBoxByValue":
                                myTempMsg = new PccMsg();
                                //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString());
                                myTempMsg.CreateFirstNode("Checked", strData);
                                myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName);
                                myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString());
                                myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]);
                                break;
                            case "CheckBoxByValueJudgeUserRight":
                                myTempMsg = new PccMsg();
                                myTempMsg.CreateFirstNode("Checked", strData);
                                myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName);
                                myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString());
                                myAuth.Url = myDRow["menu_link"].ToString();
                                if (myAuth.GetAuth(m_FieldsItem[i]) == "Y")
                                    myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]);
                                else
                                    myRow.AddCheckBoxReadOnlyCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]);

                                break;
                            case "MultiLink":
                                myRow.AddMultiLinkCell(GenMultiLinkXML(myDRow, m_FieldsType[i]), m_FieldsPercent[i]);
                                break;
                            case "Space":
                                myRow.AddTextCell("", m_FieldsPercent[i]);
                                break;
                            default:
                                break;
                        }
                    }
                    else
                    {
                        myRow.AddTextCell(Start_SC.ToString(), m_FieldsPercent[i]);
                    }
                }

                m_Table.Controls.Add(myRow.Row);

                Start_SC += 1;
            }
        }
        else
        {
            foreach (DataRow myDRow in m_myRows)
            {
                if (Start_SC % 2 == 0) Style_SC = m_RowClass1; else Style_SC = m_RowClass2;

                myRow = new PccRow("", HorizontalAlign.Center, VerticalAlign.Middle, 0);
                myRow.SetRowCss(Style_SC);

                string strData = "";

                for (i = 0; i < m_FieldsItem.Length; i++)
                {
                    if (m_FieldsItem[i] != "--NO--")
                    {
                        myMsg = new PccMsg(m_FieldsType[i]);

                        if (myMsg.Query("Type") != "Space")
                        {
                            if (Convert.IsDBNull(myDRow[m_FieldsItem[i]]))
                            {
                                strData = "";
                            }
                            else
                            {
                                if (m_TransFunc.Length != 0)
                                {
                                    try
                                    {
                                        strData = CallTrnasFunc(m_objThis, m_TransFunc[i], myDRow[m_FieldsItem[i]].ToString());
                                    }
                                    catch (Exception ex)
                                    {
                                        strData = myDRow[m_FieldsItem[i]].ToString() + ex.Message;
                                    }

                                }
                                else
                                {
                                    strData = myDRow[m_FieldsItem[i]].ToString();
                                }
                            }
                        }

                        switch (myMsg.Query("Type"))
                        {
                            case "Text":
                                //myRow.AddTextCell(myDRow[m_FieldsItem[i]].ToString(),m_FieldsPercent[i]);
                                if (myMsg.Query("HAlign").Equals(string.Empty))
                                    myRow.AddTextCell(strData, m_FieldsPercent[i]);
                                else
                                {
                                    switch (myMsg.Query("HAlign"))
                                    {
                                        case "Center":
                                            myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Center);
                                            break;
                                        case "Right":
                                            if ((myMsg.Query("Round").Equals(string.Empty)) || (strData.Equals(string.Empty)))
                                            {
                                                myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Right);
                                            }
                                            else
                                            {
                                                int round = int.Parse(myMsg.Query("Round"));
                                                decimal temp = decimal.Parse(strData);
                                                temp = Math.Round(temp, round);
                                                myRow.AddTextCell(temp.ToString(), m_FieldsPercent[i], HorizontalAlign.Right);

                                            }
                                            break;
                                        case "Left":
                                            myRow.AddTextCell(strData, m_FieldsPercent[i], HorizontalAlign.Left);
                                            break;
                                    }
                                }

                                break;
                            case "ImageButton":
                                break;
                            case "HyperLink":
                                break;
                            case "LinkButton":
                                break;
                            case "CheckBox":
                                myTempMsg = new PccMsg();
                                //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString());
                                myTempMsg.CreateFirstNode("Checked", strData);
                                myTempMsg.CreateFirstNode("Name", m_TableName);
                                myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString());
                                myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]);
                                break;
                            case "CheckBoxReadOnly":
                                myTempMsg = new PccMsg();
                                //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString());
                                myTempMsg.CreateFirstNode("Checked", strData);
                                myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName);
                                myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString());
                                myRow.AddCheckBoxReadOnlyCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]);
                                break;
                            case "CheckBoxByValue":
                                myTempMsg = new PccMsg();
                                //myTempMsg.CreateFirstNode("Checked",myDRow[m_FieldsItem[i]].ToString());
                                myTempMsg.CreateFirstNode("Checked", strData);
                                myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName);
                                myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString());
                                myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]);
                                break;
                            case "CheckBoxByValueJudgeUserRight":
                                myTempMsg = new PccMsg();
                                myTempMsg.CreateFirstNode("Checked", strData);
                                myTempMsg.CreateFirstNode("Name", m_FieldsItem[i] + m_TableName);
                                myTempMsg.CreateFirstNode("Value", myDRow[myMsg.Query("Value")].ToString());
                                myAuth.Url = myDRow["menu_link"].ToString();
                                if (myAuth.GetAuth(m_FieldsItem[i]) == "Y")
                                    myRow.AddCheckBoxByValueCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]);
                                else
                                    myRow.AddCheckBoxReadOnlyCell(myTempMsg.GetXmlStr, m_FieldsPercent[i]);

                                break;
                            case "MultiLink":
                                myRow.AddMultiLinkCell(GenMultiLinkXML(myDRow, m_FieldsType[i]), m_FieldsPercent[i]);
                                break;
                            case "Space":
                                myRow.AddTextCell("", m_FieldsPercent[i]);
                                break;
                            default:
                                break;
                        }
                    }
                    else
                    {
                        myRow.AddTextCell(Start_SC.ToString(), m_FieldsPercent[i]);
                    }
                }

                m_Table.Controls.Add(myRow.Row);

                Start_SC += 1;
            }
        }

        bReturn = true;
        return bReturn;
    }