コード例 #1
0
    protected void ActivityRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int activityId = 0;

        try
        {
            activityId = Convert.ToInt32(e.CommandArgument);
        }
        catch (Exception ex)
        {
            log.Error("Error getting object id", ex);
        }
        if (activityId <= 0)
        {
            SystemMessages.DisplaySystemErrorMessage(Resources.Organization.MessageNoComplete);
            return;
        }

        if (e.CommandName == "Restore")
        {
            try
            {
                TrashBLL.RestoreTrash(ActivityHF.Value, activityId);
            }
            catch (Exception ex)
            {
                SystemMessages.DisplaySystemErrorMessage(ex.Message);
                return;
            }
            ActivityRepeater.DataBind();
        }
        if (e.CommandName == "DeleteActivity")
        {
            try
            {
                ActivityBLL.DeletePermanently(activityId);
            }
            catch (Exception ex)
            {
                SystemMessages.DisplaySystemErrorMessage(ex.Message);
                return;
            }
            ActivityRepeater.DataBind();
        }
    }