//----------------------------------------------- #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); } //------------------------------------------------ } }
//-------------------------------------------------------- #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); } }
//-------------------------------------------------------- #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; } }