コード例 #1
0
        // ------------------------ NewRowCopy ----------------------------------
        public virtual AcLoadMasterRow NewRowCopy(AcLoadMasterRow InRow)
        {
            AcLoadMasterRow row = NewRow( );

            row.Fill(InRow);
            return(row);
        }
コード例 #2
0
        // ------------------------- AcLoadMaster.Chain ----------------------------
        // chain to row by OnlineId key
        public virtual AcLoadMasterRow Chain(Web.AcPage InPage, string InLoadId)
        {
            AcLoadMasterRow row  = null;
            SqlConnection   conn = null;
            SqlCommand      cmd;
            SqlDataReader   reader = null;
            bool            rc;

            try
            {
                conn = InPage.GetDatabaseConnection( );

                cmd             = new SqlCommand( );
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add(new SqlParameter("@LoadId", InLoadId));
                cmd.CommandText =
                    "SELECT *" +
                    " FROM " + TableName +
                    " WHERE LoadId = @LoadId";

                reader = cmd.ExecuteReader();
                rc     = reader.Read();

                // no rows
                if (rc == false)
                {
                    throw (new LoadMasterException("LoadId " + InLoadId +
                                                   " is not found in AcLoadMaster table"));
                }

                // got a row. extract each column from the reader.
                row                = NewRow( );
                row.LoadId         = reader.GetString(0);
                row.SessionId      = reader.GetString(1);
                row.Seqn           = reader.GetInt32(2);
                row.PageName       = reader.GetString(3);
                row.PageFileName   = reader.GetString(4);
                row.PageDirPath    = reader.GetString(5);
                row.LoadTs         = reader.GetDateTime(6);
                row.LastPostbackTs = reader.GetDateTime(7);
                row.PostbackCx     = reader.GetInt32(8);
                row.ReferrerLoadId = reader.GetString(9);
                row.RawUrl         = reader.GetString(10);
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close( );
                }
                if (reader != null)
                {
                    reader.Close( );
                }
            }
            return(row);
        }
コード例 #3
0
        // -------------------------- Update --------------------------
        public virtual void Update(
            AcPage InPage,
            string InLoadId,
            AcLoadMasterRow InNewRow)
        {
            SqlConnection conn = null;
            SqlCommand    cmd  = new SqlCommand( );

            try
            {
                conn            = InPage.GetDatabaseConnection( );
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add(new SqlParameter("@WhereLoadId", InLoadId));
                cmd.Parameters.Add(new SqlParameter("@LoadId", InNewRow.LoadId));
                cmd.Parameters.Add(new SqlParameter("@SessionId", InNewRow.SessionId));
                cmd.Parameters.Add(new SqlParameter("@Seqn", InNewRow.Seqn));
                cmd.Parameters.Add(new SqlParameter("@PageName", InNewRow.PageName));
                cmd.Parameters.Add(new SqlParameter("@PageFileName", InNewRow.PageFileName));
                cmd.Parameters.Add(new SqlParameter("@PageDirPath", InNewRow.PageDirPath));
                cmd.Parameters.Add(new SqlParameter("@LoadTs", InNewRow.LoadTs));
                cmd.Parameters.Add(new SqlParameter("@LastPostbackTs", InNewRow.LastPostbackTs));
                cmd.Parameters.Add(new SqlParameter("@PostbackCx", InNewRow.PostbackCx));
                cmd.Parameters.Add(new SqlParameter("@ReferrerLoadId", InNewRow.ReferrerLoadId));
                cmd.Parameters.Add(new SqlParameter("@RawUrl", InNewRow.RawUrl));


                cmd.CommandText =
                    "UPDATE " + TableName +
                    " SET LoadId = @LoadId, " +
                    "SessionId = @SessionId, " +
                    "Seqn = @Seqn, " +
                    "PageName = @PageName, " +
                    "PageFileName = @PageFileName, " +
                    "PageDirPath = @PageDirPath, " +
                    "LoadTs = @LoadTs, " +
                    "LastPostbackTs = @LastPostbackTs, " +
                    "PostbackCx = @PostbackCx, " +
                    "ReferrerLoadId = @ReferrerLoadId, " +
                    "RawUrl = @RawUrl" +
                    " WHERE LoadId = @WhereLoadId";
                cmd.ExecuteNonQuery( );
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close( );
                }
            }
        }
コード例 #4
0
 public void Fill(AcLoadMasterRow InRow)
 {
     mLoadId         = InRow.mLoadId;
     mSessionId      = InRow.mSessionId;
     mSeqn           = InRow.mSeqn;
     mPageName       = InRow.mPageName;
     mPageFileName   = InRow.mPageFileName;
     mPageDirPath    = InRow.mPageDirPath;
     mLoadTs         = InRow.mLoadTs;
     mLastPostbackTs = InRow.mLastPostbackTs;
     mPostbackCx     = InRow.mPostbackCx;
     mReferrerLoadId = InRow.mReferrerLoadId;
     mRawUrl         = InRow.mRawUrl;
 }
コード例 #5
0
        // -------------------------- Add --------------------------------
        public virtual AcLoadMasterRow Add(
            AcPage InPage,
            AcLoadMasterRow InRow)
        {
            SqlConnection conn = null;

            // assign a LoadId
            if (InRow.LoadId == null)
            {
                InRow.LoadId = System.Guid.NewGuid( ).ToString( );
            }

            try
            {
                conn = InPage.GetDatabaseConnection( );
                SqlCommand cmd = new SqlCommand();

                cmd.Connection  = conn;
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add(new SqlParameter("@LoadId", InRow.LoadId));
                cmd.Parameters.Add(new SqlParameter("@SessionId", InRow.SessionId));
                cmd.Parameters.Add(new SqlParameter("@Seqn", InRow.Seqn));
                cmd.Parameters.Add(new SqlParameter("@PageName", InRow.PageName));
                cmd.Parameters.Add(new SqlParameter("@PageFileName", InRow.PageFileName));
                cmd.Parameters.Add(new SqlParameter("@PageDirPath", InRow.PageDirPath));
                cmd.Parameters.Add(new SqlParameter("@LoadTs", InRow.LoadTs));
                cmd.Parameters.Add(new SqlParameter("@LastPostbackTs", InRow.LastPostbackTs));
                cmd.Parameters.Add(new SqlParameter("@PostbackCx", InRow.PostbackCx));
                cmd.Parameters.Add(new SqlParameter("@ReferrerLoadId", InRow.ReferrerLoadId));
                cmd.Parameters.Add(new SqlParameter("@RawUrl", InRow.RawUrl));

                cmd.CommandText =
                    "INSERT " + TableName + " ( " +
                    "LoadId, SessionId, Seqn, PageName, PageFileName, PageDirPath, " +
                    "LoadTs, LastPostbackTs, PostbackCx, ReferrerLoadId, RawUrl ) " +
                    "Values( @LoadId, @SessionId, @Seqn, @PageName, @PageFileName, @PageDirPath, " +
                    "@LoadTs, @LastPostbackTs, @PostbackCx, @ReferrerLoadId, @RawUrl )";
                cmd.ExecuteNonQuery();
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close( );
                }
            }
            return(InRow);
        }