Beispiel #1
0
    //-----------------------------------------------
    #endregion


    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (MoversFW.Components.UrlManager.ChechIsValidIntegerParameter("CommentID"))
        {
            if (!Page.IsValid)
            {
                return;
            }
            ItemsCommentsEntity comments = new ItemsCommentsEntity();
            comments.CommentID    = Convert.ToInt32(Request.QueryString["CommentID"]);
            comments.SenderName   = txtSenderName.Text;
            comments.SenderEmail  = txtSenderEmail.Text;
            comments.CommentTitle = txtCommentTitle.Text;
            comments.CommentText  = txtCommentText.Text;
            comments.IsActive     = cbIsActive.Checked;
            ExecuteCommandStatus status = ItemsCommentsFactory.Update(comments);

            if (status == ExecuteCommandStatus.Done)
            {
                //------------------------------------------------
                if (BaseModuleType == ModuleBaseTypes.Items)
                {
                    Response.Redirect("/AdminCP/Items/" + Identifire + "/Comments/" + pageFile);
                }
                else if (BaseModuleType == ModuleBaseTypes.Messages)
                {
                    Response.Redirect("/AdminCP/Messages/" + Identifire + "/Comments/" + pageFile);
                }
                //------------------------------------------------
            }
            else
            {
                lblResult.CssClass = "lblResult_Faild";
                lblResult.Text     = Resources.AdminText.SavingDataFaild;
            }
        }
        else
        {
            //------------------------------------------------
            if (BaseModuleType == ModuleBaseTypes.Items)
            {
                Response.Redirect("/AdminCP/Items/" + Identifire + "/Comments/" + pageFile);
            }
            else if (BaseModuleType == ModuleBaseTypes.Messages)
            {
                Response.Redirect("/AdminCP/Messages/" + Identifire + "/Comments/" + pageFile);
            }

            //------------------------------------------------
        }
    }
Beispiel #2
0
    //-----------------------------------------------
    #endregion

    #region ---------------LoadData---------------
    //-----------------------------------------------
    //LoadData
    //-----------------------------------------------
    protected void LoadData()
    {
        if (MoversFW.Components.UrlManager.ChechIsValidIntegerParameter("CommentID"))
        {
            int commentID = Convert.ToInt32(Request.QueryString["CommentID"]);
            ItemsCommentsEntity comments = ItemsCommentsFactory.GetObject(commentID);
            if (comments != null)
            {
                txtSenderName.Text   = comments.SenderName;
                lblDate.Text         = comments.SendingDate.ToString();
                txtSenderEmail.Text  = comments.SenderEmail;
                txtCommentTitle.Text = comments.CommentTitle;
                txtCommentText.Text  = comments.CommentText;
                cbIsActive.Checked   = comments.IsActive;
            }
            else
            {
                //------------------------------------------------
                if (BaseModuleType == ModuleBaseTypes.Items)
                {
                    Response.Redirect("/AdminCP/Items/" + Identifire + "/Comments/" + pageFile);
                }

                else if (BaseModuleType == ModuleBaseTypes.Messages)
                {
                    Response.Redirect("/AdminCP/Messages/" + Identifire + "/Comments/" + pageFile);
                }

                //------------------------------------------------
            }
        }
        else
        {
            //------------------------------------------------
            if (BaseModuleType == ModuleBaseTypes.Items)
            {
                Response.Redirect("/AdminCP/Items/" + Identifire + "/Comments/" + pageFile);
            }
            else if (BaseModuleType == ModuleBaseTypes.Messages)
            {
                Response.Redirect("/AdminCP/Messages/" + Identifire + "/Comments/" + pageFile);
            }
            //------------------------------------------------
        }
    }
Beispiel #3
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);
        }
    }
Beispiel #4
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;
        }
    }