コード例 #1
0
ファイル: Comments.ascx.cs プロジェクト: elshiekh5/Giras
    //--------------------------------------------------------
    #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);
        }
    }
コード例 #2
0
ファイル: Comments.ascx.cs プロジェクト: elshiekh5/CMS.V6
    //--------------------------------------------------------
    #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;
        }
    }