Example #1
0
    private void DeleteGroup(int activeRowIndex)
    {
        string containerGroup = dg.Rows[activeRowIndex].Cells.FromKey("Select").Title;

        lbError.Visible = false;
        bool success = true;

        if (dg != null && dg.Rows != null && dg.Rows.Count > 0)
        {
            for (int i = 0; i < dg.Rows.Count; i++)
            {
                CellsCollection cl = dg.Rows[i].Cells;
                if (cl.FromKey("Select").Style.CssClass != "ptbgroup" && cl.FromKey("ContainerGroupPath").Value.ToString() == containerGroup)
                {
                    HyperCatalog.Business.InputFormContainer ifCObj = HyperCatalog.Business.InputFormContainer.GetByKey(Convert.ToInt32(cl.FromKey("InputFormContainerId").Value));
                    if (!ifCObj.Delete(HyperCatalog.Shared.SessionState.User.Id))
                    {
                        success          = false;
                        lbError.CssClass = "hc_error";
                        lbError.Text    += HyperCatalog.Business.InputFormContainer.LastError + "<br/>" + Environment.NewLine;
                        lbError.Visible  = true;
                    }
                }
            }
        }
        UpdateDataView();
    }
Example #2
0
    /// <summary>
    /// Delete multiple containers on the grid
    /// </summary>
    private void Delete()
    {
        lbError.Visible = false;
        bool success = true;

        if (dg != null && dg.Rows != null && dg.Rows.Count > 0)
        {
            TemplatedColumn col = (TemplatedColumn)dg.Rows[0].Cells.FromKey("Select").Column;
            if (col != null)
            {
                for (int i = 0; i < col.CellItems.Count; i++)
                {
                    CellItem cellItem = (CellItem)col.CellItems[i];
                    Infragistics.WebUI.UltraWebGrid.UltraGridRow r = cellItem.Cell.Row;
                    CheckBox cb = (CheckBox)cellItem.FindControl("g_sd");
                    if (cb != null)
                    {
                        if (cb.Checked)
                        {
                            HyperCatalog.Business.InputFormContainer ifCObj = HyperCatalog.Business.InputFormContainer.GetByKey(Convert.ToInt32(r.Cells.FromKey("InputFormContainerId").Value));
                            success = ifCObj.Delete(HyperCatalog.Shared.SessionState.User.Id);
                            if (!success)
                            {
                                UpdateDataView();
                                lbError.CssClass = "hc_error";
                                lbError.Text     = HyperCatalog.Business.InputFormContainer.LastError;
                                lbError.Visible  = true;

                                break;
                            }
                        }
                    }
                }
            }
        }
        if (success)
        {
            UpdateDataView();
        }
    }