예제 #1
0
        private void LoadData(string strType)
        {
            if (strType == "1")
            {
                string strID = Request.QueryString["value"];//操作ID
                zlzw.BLL.MessageListBLL     messageListBLL   = new zlzw.BLL.MessageListBLL();
                zlzw.Model.MessageListModal messageListModal = messageListBLL.GetModel(int.Parse(Get_MessageID(strID)));
                txbPublishUserName.Text        = messageListModal.PublishUserName;          //发布者姓名
                txbPublishContent.Text         = messageListModal.PublishContent;           //发布内容
                txbReplyContent.Text           = messageListModal.ReplyContent;             //回复内容
                txbPublishDate.Text            = messageListModal.PublishDate.ToString();   //发布日期
                drpReplyUserGUID.SelectedValue = messageListModal.ReplyUserGUID.ToString(); //回复人ID
                txbReplyDate.Text = messageListModal.ReplyDate.ToString();                  //回复日期
                if (messageListModal.IsReply == 1)
                {
                    ckbIsReply.Checked = true;
                }
                else
                {
                    ckbIsReply.Checked = false;
                }

                ViewState["MessageGUID"] = messageListModal.MessageGUID.ToString();
                ToolbarText2.Text        = "编辑一个管理员账号";
            }
            btnClose.OnClientClick = ActiveWindow.GetConfirmHideReference();
        }
예제 #2
0
        private int Load_MessageListRecordCount()
        {
            zlzw.BLL.MessageListBLL messageListBLL = new zlzw.BLL.MessageListBLL();
            DataTable dt = messageListBLL.GetList("IsEnable=1 and IsReply=1").Tables[0];

            return(dt.Rows.Count);
        }
예제 #3
0
        private string Get_MessageID(string strMessageGUID)
        {
            zlzw.BLL.MessageListBLL messageListBLL = new zlzw.BLL.MessageListBLL();
            DataTable dt = messageListBLL.GetList("MessageGUID='" + strMessageGUID + "'").Tables[0];

            return(dt.Rows[0]["MessageID"].ToString());
        }
예제 #4
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            if (grid1.SelectedRowIndexArray != null && grid1.SelectedRowIndexArray.Length > 0)
            {
                string strSelectID = "0";
                for (int i = 0, count = grid1.SelectedRowIndexArray.Length; i < count; i++)
                {
                    int rowIndex = grid1.SelectedRowIndexArray[i];
                    foreach (object key in grid1.DataKeys[rowIndex])
                    {
                        strSelectID = key.ToString();
                    }
                }
                #region  除逻辑

                zlzw.BLL.MessageListBLL     messageListBLL   = new zlzw.BLL.MessageListBLL();
                zlzw.Model.MessageListModal messageListModal = messageListBLL.GetModel(int.Parse(Get_MessageID(strSelectID)));
                messageListModal.IsEnable = 0;
                messageListBLL.Update(messageListModal);
                MessageList_BindGrid();

                #endregion
            }
            else
            {
                return;
            }
        }
예제 #5
0
        private void MessageList_BindGrid()
        {
            zlzw.BLL.MessageListBLL messageListBLL = new zlzw.BLL.MessageListBLL();
            DataTable dt = messageListBLL.GetList(grid1.PageSize, grid1.PageIndex + 1, "*", "PublishDate", 0, "desc", "IsEnable=1").Tables[0];

            grid1.DataSource = dt;
            grid1.DataBind();
        }
예제 #6
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["Type"] == "1")
            {
                //编辑保存
                zlzw.Model.MessageListModal messageListModal = new zlzw.Model.MessageListModal();
                messageListModal.PublishUserName = txbPublishUserName.Text;                  //发布者姓名
                messageListModal.PublishContent  = txbPublishContent.Text;                   //发布内容
                messageListModal.PublishDate     = DateTime.Parse(txbPublishDate.Text);      //发布日期
                messageListModal.ReplyUserGUID   = new Guid(drpReplyUserGUID.SelectedValue); //回复人ID
                messageListModal.ReplyDate       = DateTime.Parse(txbReplyDate.Text);        //回复日期
                messageListModal.ReplyContent    = txbReplyContent.Text;                     //回复内容
                messageListModal.MessageGUID     = new Guid(ViewState["MessageGUID"].ToString());
                messageListModal.IsEnable        = 1;
                if (ckbIsReply.Checked)
                {
                    messageListModal.IsReply = 1;
                }
                else
                {
                    messageListModal.IsReply = 0;
                }
                messageListModal.MessageID = int.Parse(Get_MessageID(Request.QueryString["value"]));
                zlzw.BLL.MessageListBLL messageListBLL = new zlzw.BLL.MessageListBLL();
                messageListBLL.Update(messageListModal);
            }
            else
            {
                //添加保存

                zlzw.Model.MessageListModal messageListModal = new zlzw.Model.MessageListModal();
                messageListModal.PublishUserName = txbPublishUserName.Text;                  //发布者姓名
                messageListModal.PublishContent  = txbPublishContent.Text;                   //发布内容
                messageListModal.PublishDate     = DateTime.Parse(txbPublishDate.Text);      //发布日期
                messageListModal.ReplyUserGUID   = new Guid(drpReplyUserGUID.SelectedValue); //回复人ID
                messageListModal.ReplyDate       = DateTime.Parse(txbReplyDate.Text);        //回复日期
                messageListModal.ReplyContent    = txbReplyContent.Text;                     //回复内容
                messageListModal.MessageGUID     = Guid.NewGuid();
                messageListModal.IsEnable        = 1;
                if (ckbIsReply.Checked)
                {
                    messageListModal.IsReply = 1;
                }
                else
                {
                    messageListModal.IsReply = 0;
                }
                zlzw.BLL.MessageListBLL messageListBLL = new zlzw.BLL.MessageListBLL();
                messageListBLL.Add(messageListModal);
            }

            // 2. Close this window and Refresh parent window
            PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
        }
예제 #7
0
        private void Load_MessageList()
        {
            int nPageIndex = AspNetPager1.CurrentPageIndex;
            int nPageSize  = AspNetPager1.PageSize = 5;

            zlzw.BLL.MessageListBLL messageListBLL = new zlzw.BLL.MessageListBLL();
            DataTable dt = messageListBLL.GetList(nPageSize, nPageIndex, "*", "PublishDate", 0, "desc", "IsEnable=1 and IsReply=1").Tables[0];

            Repeater1.DataSource = dt;
            Repeater1.DataBind();
        }
예제 #8
0
        /// <summary>
        /// 获取总页数
        /// </summary>
        /// <returns></returns>
        private int Get_MessageListTotalCount()
        {
            zlzw.BLL.MessageListBLL messageListBLL = new zlzw.BLL.MessageListBLL();
            DataTable dt = messageListBLL.GetList("IsEnable=1").Tables[0];

            if (dt.Rows.Count > 0)
            {
                return(dt.Rows.Count);
            }
            else
            {
                return(0);
            }
        }
예제 #9
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         zlzw.Model.MessageListModal messageListModal = new zlzw.Model.MessageListModal();
         messageListModal.MessageGUID     = Guid.NewGuid();
         messageListModal.PublishUserName = search.Value;
         messageListModal.PublishContent  = textarea.Value;
         messageListModal.PublishDate     = DateTime.Now;
         messageListModal.IsReply         = 0;
         messageListModal.IsEnable        = 0;
         zlzw.BLL.MessageListBLL messageListBLL = new zlzw.BLL.MessageListBLL();
         messageListBLL.Add(messageListModal);
         search.Value   = "";
         textarea.Value = "";
         ClientScript.RegisterStartupScript(Page.GetType(), "SuccessInfo", "<script type='text/javascript'>alert('留言成功,请等待管理员的审核');</script>");
     }
     catch (Exception exp)
     {
         ClientScript.RegisterStartupScript(Page.GetType(), "errorInfo", "<script type='text/javascript'>alert('留言失败,请稍后重试');</script>");
     }
 }