Example #1
0
    //--------------------------------------------------------
    #endregion

    #region --------------dgComments_DeleteCommand--------------
    //---------------------------------------------------------
    //dgComments_DeleteCommand
    //---------------------------------------------------------
    protected void dgComments_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        int commentID = Convert.ToInt32(dgComments.DataKeys[e.Item.ItemIndex]);
        ItemsCommentsEntity  comments = ItemsCommentsFactory.GetObject(commentID);
        ExecuteCommandStatus status   = ItemsCommentsFactory.Delete(commentID);

        if (status == ExecuteCommandStatus.Done)
        {
            General.MakeAlertSucess(lblResult, Resources.AdminText.DeletingOprationDone);
            //if one item in datagrid
            if (dgComments.Items.Count == 1)
            {
                --pager.CurrentPage;
            }
            LoadData();
        }
        else
        {
            General.MakeAlertError(lblResult, Resources.AdminText.DeletingOprationFaild);
        }
    }
Example #2
0
    //--------------------------------------------------------
    #endregion

    #region --------------dgComments_DeleteCommand--------------
    //---------------------------------------------------------
    //dgComments_DeleteCommand
    //---------------------------------------------------------
    protected void dgComments_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        int commentID = Convert.ToInt32(dgComments.DataKeys[e.Item.ItemIndex]);
        ItemsCommentsEntity  comments = ItemsCommentsFactory.GetObject(commentID);
        ExecuteCommandStatus status   = ItemsCommentsFactory.Delete(commentID);

        if (status == ExecuteCommandStatus.Done)
        {
            lblResult.CssClass = "lblResult_Done";
            lblResult.Text     = Resources.AdminText.DeletingOprationDone;
            //if one item in datagrid
            if (dgComments.Items.Count == 1)
            {
                --pager.CurrentPage;
            }
            LoadData();
        }
        else
        {
            lblResult.CssClass = "lblResult_Faild";
            lblResult.Text     = Resources.AdminText.DeletingOprationFaild;
        }
    }