Example #1
0
    protected DataSet UniGrid_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        // Where condition
        string where = null;

        int siteId = ValidationHelper.GetInteger(siteSelector.Value, 0);

        // Site dropdownlist
        if (siteId != 0)
        {
            where = "TaskSiteID = " + siteId;
        }
        else
        {
            where = "TaskSiteID IS NULL";
        }

        where = SqlHelperClass.AddWhereCondition(where, completeWhere);

        // Get the data
        DataSet resultSet = ExportTaskInfoProvider.SelectTaskList(siteId, string.Empty, where, currentOrder, currentTopN, columns, currentOffset, currentPageSize, ref totalRecords);

        // Set visibility of delete button
        lnkDeleteAll.Visible = (totalRecords > 0);
        return(resultSet);
    }
Example #2
0
 /// <summary>
 /// Handles the UniGrid's OnAction event.
 /// </summary>
 /// <param name="actionName">Name of item (button) that throws event</param>
 /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
 protected void uniGrid_OnAction(string actionName, object actionArgument)
 {
     if (actionName == "delete")
     {
         // delete ExportHistoryTaskInfo object from database
         ExportTaskInfoProvider.DeleteExportTaskInfo(Convert.ToInt32(actionArgument));
     }
 }
Example #3
0
    protected void lnkDeleteAll_Click(object sender, EventArgs e)
    {
        int siteId = ValidationHelper.GetInteger(siteSelector.Value, 0);

        ExportTaskInfoProvider.DeleteExportTasks(siteId);
        UniGrid.ReloadData();
        pnlUpdate.Update();
    }
    /// <summary>
    /// Bind the data.
    /// </summary>
    public void Bind()
    {
        sbAvailable = null;

        if (!string.IsNullOrEmpty(ObjectType))
        {
            pnlGrid.Visible = true;

            // Initialize strings
            btnAllTasks.Text  = GetString("ImportExport.All");
            btnNoneTasks.Text = GetString("export.none");
            lblTasks.Text     = GetString("Export.Tasks");

            // Get object info
            GeneralizedInfo info = CMSObjectHelper.GetReadOnlyObject(ObjectType);
            if (info != null)
            {
                plcGrid.Visible       = true;
                codeNameColumnName    = info.CodeNameColumn;
                displayNameColumnName = info.DisplayNameColumn;

                // Task fields
                TemplateField taskCheckBoxField = (TemplateField)gvTasks.Columns[0];
                taskCheckBoxField.HeaderText = GetString("General.Export");

                TemplateField titleField = (TemplateField)gvTasks.Columns[1];
                titleField.HeaderText = GetString("Export.TaskTitle");

                BoundField typeField = (BoundField)gvTasks.Columns[2];
                typeField.HeaderText = GetString("general.type");

                BoundField timeField = (BoundField)gvTasks.Columns[3];
                timeField.HeaderText = GetString("Export.TaskTime");

                // Load tasks
                int siteId = (SiteObject ? Settings.SiteId : 0);

                DataSet ds = ExportTaskInfoProvider.SelectTaskList(siteId, ObjectType, null, "TaskTime DESC", 0, null, CurrentOffset, CurrentPageSize, ref pagerForceNumberOfResults);

                // Set correct ID for direct page contol
                pagerElem.DirectPageControlID = ((float)pagerForceNumberOfResults / pagerElem.CurrentPageSize > 20.0f) ? "txtPage" : "drpPage";

                // Call page binding event
                if (OnPageBinding != null)
                {
                    OnPageBinding(this, null);
                }

                if (!DataHelper.DataSourceIsEmpty(ds) && (ValidationHelper.GetBoolean(Settings.GetSettings(ImportExportHelper.SETTINGS_TASKS), true)))
                {
                    plcTasks.Visible   = true;
                    gvTasks.DataSource = ds;
                    gvTasks.DataBind();
                }
                else
                {
                    plcTasks.Visible = false;
                }
            }
            else
            {
                plcGrid.Visible = false;
            }
        }
        else
        {
            pnlGrid.Visible = false;
        }
    }