Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(_DBName))
        {
            DivQryCondition.Visible = false;
            DivQryResult.Visible    = false;
            labErrMsg.Visible       = true;
            labErrMsg.Text          = Util.getHtmlMessage(Util.HtmlMessageKind.ParaError, string.Format(SinoPac.WebExpress.Common.Properties.Resources.Msg_ParaNotFound1, "DBName"));
            return;
        }

        if (_AllowPurgeYN.ToUpper() == "Y")
        {
            btnPurgeTable.Visible = true;
        }
        else
        {
            btnPurgeTable.Visible = false;
        }

        if (!IsPostBack)
        {
            btnPurgeTable.ToolTip       = "清除[AppLog]所有資料";
            btnPurgeTable.OnClientClick = "return confirm('確定清除[" + _DBName + "]資料庫內,[AppLog]資料表的所有資料?');";

            LogType.ucSourceDictionary = _Dic_AppLogType;
            LogType.Refresh();
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 初始查詢條件
    /// </summary>
    protected void InitQryCondition()
    {
        labQryHeader.Text           = string.Format("[{0}] 查詢條件", _TableName);
        labQryResultHeader.Text     = string.Format("[{0}] 查詢結果", _TableName);
        btnPurgeTable.ToolTip       = string.Format("清除[{0}]所有資料", _TableName);
        btnPurgeTable.OnClientClick = string.Format("return confirm('確定清除[{0}]資料庫內,[{1}]資料表的所有資料?');", _DBName, _TableName);

        DataTable dtSchema = Util.getDataSchemaInfo(_DBName).Select(string.Format(" TABLE_NAME = '{0}' and TABLE_TYPE = 'BASE TABLE' ", _TableName)).CopyToDataTable();
        Dictionary <string, string> dicTable = Util.getDictionary(dtSchema, "COLUMN_NAME", "IS_PKEY");

        PageViewState["_TableFieldList"]   = Util.getArray(dicTable);
        PageViewState["_TablePKFieldList"] = dicTable.AsEnumerable().Where(r => r.Value == "Y").Select(k => k.Key).ToArray();

        Util_ucTextBox oTxt;
        CheckBox       oChk;

        for (int i = 0; i < 10; i++)
        {
            oTxt = (Util_ucTextBox)Util.FindControlEx(this.Page, string.Format("PKey{0}", (i + 1).ToString().PadLeft(2, '0')));
            oChk = (CheckBox)Util.FindControlEx(this.Page, string.Format("IsLikePKey{0}", (i + 1).ToString().PadLeft(2, '0')));
            if (oTxt != null)
            {
                oTxt.ucCaption  = "";
                oTxt.ucTextData = "";
                oTxt.Visible    = false;
                oChk.Visible    = false;
                oChk.Checked    = false;
            }
        }

        for (int i = 0; i < ((string[])PageViewState["_TablePKFieldList"]).Count(); i++)
        {
            oTxt = (Util_ucTextBox)Util.FindControlEx(this.Page, string.Format("PKey{0}", (i + 1).ToString().PadLeft(2, '0')));
            oChk = (CheckBox)Util.FindControlEx(this.Page, string.Format("IsLikePKey{0}", (i + 1).ToString().PadLeft(2, '0')));
            if (oTxt != null && ((string[])PageViewState["_TablePKFieldList"])[i] != "TableLogNo")
            {
                oTxt.ucCaptionWidth = 100;
                oTxt.ucWidth        = 150;
                oTxt.ucCaption      = ((string[])PageViewState["_TablePKFieldList"])[i];
                oTxt.ucTextData     = "";
                oTxt.Visible        = true;
                oChk.Visible        = true;
            }
        }

        LogType.ucSourceDictionary = _Dic_AppTableLogType;
        LogType.Refresh();

        if (_AllowPurgeYN.ToUpper() == "Y")
        {
            btnPurgeTable.Visible = true;
        }
        else
        {
            btnPurgeTable.Visible = false;
        }

        if (!Util.getRequestQueryString().IsNullOrEmpty("TableName"))
        {
            btnClearTableName.Visible = false;
        }
        else
        {
            btnClearTableName.Visible = true;
        }
    }