Пример #1
0
        protected void BindGridGuest()
        {
            Maticsoft.BLL.tGuestBook BLL = new Maticsoft.BLL.tGuestBook();

            Grid.RecordCount = BLL.GetRecordCount("");
            Grid.DataSource  = BLL.GetListByPage("", " Leave_time desc,Id desc ", Grid.PageIndex * Grid.PageSize, (Grid.PageIndex + 1) * Grid.PageSize);

            Grid.DataBind();
        }
Пример #2
0
        protected void btnSelect_Click(object sender, EventArgs e)
        {
            string txtVal = this.txtValue.Text.Trim();

            if (txtVal == "")
            {
                return;
            }

            Maticsoft.BLL.tGuestBook BLL = new Maticsoft.BLL.tGuestBook();

            Grid.RecordCount = BLL.GetRecordCount(String.Format(" Leave_name   like '%{0}%' ", txtVal));
            Grid.DataSource  = BLL.GetListByPage(String.Format(" Leave_name  like '%{0}%' ", txtVal), " Leave_time desc,Id desc ", Grid.PageIndex * Grid.PageSize, (Grid.PageIndex + 1) * Grid.PageSize);

            Grid.DataBind();
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnClose.OnClientClick = ActiveWindow.GetHideReference();

                Calendar1.SelectedDate = DateTime.Now;

                if (!String.IsNullOrEmpty(Request.QueryString["Id"]))
                {
                    Maticsoft.BLL.tGuestBook   bll   = new Maticsoft.BLL.tGuestBook();
                    Maticsoft.Model.tGuestBook model = bll.GetModel(int.Parse(Request.QueryString["Id"]));
                    GuestContent.Text      = model.GuestContent;
                    ReplayContent.Text     = model.ReplayContent;
                    Calendar1.SelectedDate = (model.Replay_time == null?DateTime.Now:model.Replay_time);
                }
            }
        }
Пример #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.tGuestBook bll = new Maticsoft.BLL.tGuestBook();

            if (Calendar1.SelectedDate == null)
            {
                Calendar1.SelectedDate = DateTime.Now;
            }

            if (!String.IsNullOrEmpty(Request.QueryString["Id"]))
            {
                Maticsoft.Model.tGuestBook model = bll.GetModel(int.Parse(Request.QueryString["Id"]));

                model.ReplayContent = ReplayContent.Text;

                model.Replay_time = Calendar1.SelectedDate;

                bll.Update(model);
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
        }
Пример #5
0
        protected void GridDpt_RowCommand(object sender, GridCommandEventArgs e)
        {
            int Id = GetSelectedDataKeyID(Grid);


            if (e.CommandName == "Delete")
            {
                Maticsoft.BLL.tGuestBook BLL = new Maticsoft.BLL.tGuestBook();

                if (BLL.Delete(Id) == true)
                {
                    BindGridGuest();
                    Alert.ShowInTop("删除成功!");
                }
                else
                {
                    Alert.ShowInTop("删除失败!");
                }
            }
            if (e.CommandName == "Edit")
            {
                PageContext.RegisterStartupScript(Window1.GetShowReference("Add_Guest.aspx?Id=" + Id));
            }
        }