Example #1
0
        /// <summary>
        /// Bind the Data to the Page.
        /// </summary>
        private void BindHistoryData()
        {
            // history
            DataTable historyTable = new DataTable();

            historyTable.Columns.Add("Time");
            historyTable.Columns.Add("Type");
            historyTable.Columns.Add("UserFullName");
            historyTable.Columns.Add("Image");
            historyTable.Columns.Add("NewRights");

            try
            {
                // history
                ChangeEntrySet changes = web.GetChanges(ifolderID, itemID, HistoryPagging.Index, HistoryPagging.PageSize);
                HistoryPagging.Count = changes.Items.Length;
                HistoryPagging.Total = changes.Total;

                foreach (ChangeEntry change in changes.Items)
                {
                    DataRow row = historyTable.NewRow();

                    row["Time"]         = WebUtility.FormatDateTime(change.Time, rm);
                    row["Type"]         = WebUtility.FormatChangeAction(change.Action, rm);
                    row["UserFullName"] = change.UserFullName;
                    row["Image"]        = change.Action.ToString().ToLower();

                    if ((change.Type == ChangeEntryType.Member) && (change.Action != ChangeEntryAction.Delete))
                    {
                        row["NewRights"] = WebUtility.FormatRights(change.MemberNewRights, rm);
                    }
                    else
                    {
                        row["NewRights"] = "";
                    }

                    historyTable.Rows.Add(row);
                }
            }
            catch (SoapException ex)
            {
                if (!HandleException(ex))
                {
                    throw;
                }
            }

            // bind
            HistoryData.DataSource = historyTable;
            HistoryData.DataBind();
        }
Example #2
0
        /// <summary>
        /// Bind the Data to the Page.
        /// </summary>
        private void BindHistoryData()
        {
            // history
            DataTable historyTable = new DataTable();

            historyTable.Columns.Add("ID");
            historyTable.Columns.Add("iFolderID");
            historyTable.Columns.Add("Time");
            historyTable.Columns.Add("Name");
            historyTable.Columns.Add("ShortName");
            historyTable.Columns.Add("ShortenedName");
            historyTable.Columns.Add("Type");
            historyTable.Columns.Add("Action");
            historyTable.Columns.Add("UserFullName");
            historyTable.Columns.Add("TypeImage");
            historyTable.Columns.Add("ActionImage");
            historyTable.Columns.Add("NewRights");

            try
            {
                // ifolder
                iFolder ifolder = web.GetiFolder(ifolderID);

                // history
                ChangeEntrySet changes = web.GetChanges(ifolderID, null, HistoryPagging.Index, HistoryPagging.PageSize);
                HistoryPagging.Count = changes.Items.Length;
                HistoryPagging.Total = changes.Total;

                string tempname = null;

                foreach (ChangeEntry change in changes.Items)
                {
                    DataRow row = historyTable.NewRow();
                    row["ID"]        = change.ID;
                    row["iFolderID"] = ifolderID;
                    row["Time"]      = WebUtility.FormatDateTime(change.Time, rm);
                    row["Name"]      = change.Name;
                    string NameWithoutDir  = WebUtility.GetFileName(change.Name);
                    int    ShortenedLength = 70;
                    if (NameWithoutDir.Length > ShortenedLength)
                    {
                        tempname = web.GetShortenedName(NameWithoutDir, ShortenedLength);
                    }
                    row["ShortName"]     = NameWithoutDir;
                    row["ShortenedName"] = (NameWithoutDir.Length > ShortenedLength)  ? tempname.ToString() : NameWithoutDir;
                    row["Type"]          = change.Type.ToString();
                    row["Action"]        = WebUtility.FormatChangeAction(change.Action, rm);
                    row["UserFullName"]  = change.UserFullName;
                    row["TypeImage"]     = change.Type.ToString().ToLower();
                    row["ActionImage"]   = change.Action.ToString().ToLower();

                    if ((change.Type == ChangeEntryType.Member) && (change.Action != ChangeEntryAction.Delete))
                    {
                        row["NewRights"] = String.Format("({0})", WebUtility.FormatRights(change.MemberNewRights, rm));
                    }
                    else
                    {
                        row["NewRights"] = "";
                    }

                    historyTable.Rows.Add(row);
                }
            }
            catch (NullReferenceException ex)
            {
                Message.Text = GetString("HISTORYNOTAVAILABLE");
            }
            catch (SoapException ex)
            {
                if (!HandleException(ex))
                {
                    throw;
                }
            }

            // bind
            HistoryData.DataSource = historyTable;
            HistoryData.DataBind();
        }