/// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        string strWhere = this.StrWhere;
        if (this.titleAuthorSearch.Text.Trim() != "")
        {
            strWhere += " and (title like '%" + this.titleAuthorSearch.Text.Trim().Replace("'", "''")
                + "%' or author like '%" + this.titleAuthorSearch.Text.Trim().Replace("'", "''") + "%')";
        }
        if (this.isIndexShow.SelectedValue != "")
        {
            strWhere += " and isIndexShow = " + this.isIndexShow.SelectedValue;
        }

        LAnnounceBB announceBB = new LAnnounceBB();
        DataSet ds = new DataSet();

        try
        {
            ds = announceBB.GetVList(strWhere);
            DataView dv = new DataView(ds.Tables[0], "", "isIndexShow DESC,updtDt DESC", DataViewRowState.CurrentRows);
            this.grid.DataSource = dv;
            this.grid.DataBind();
            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            announceBB.Dispose();
        }
    }
 /// <summary>
 /// 展示数据
 /// </summary>
 /// <param name="id">记录Id</param>
 private void ShowInfo(int id)
 {
     LAnnounceBB announceBB = new LAnnounceBB();
     vLAnnounceData model = new vLAnnounceData();
     try
     {
         model = announceBB.GetVModel(id);
         this.title.Text = model.title;
         this.content.Text = model.content;
         if (model.downFileNm != null)
         {
             this.fileNms.Text = model.downFileNm.Replace("|", "<br />");
         }
         this.author.Text = model.author;
         if (model.isIndexShow)
         {
             this.isIndexShow.Text = "已发布";
         }
         else
         {
             this.isIndexShow.Text = "未发布";
         }
     }
     finally
     {
         announceBB.Dispose();
     }
 }
示例#3
0
    protected void btnRelease_Click(object sender, EventArgs e)
    {
        if (!Save()) return;
        LAnnounceData model = new LAnnounceData();
        LAnnounceBB announceBB = new LAnnounceBB();
        try
        {
            if (this.IdValue != null && this.IdValue != 0)
            {
                model = announceBB.GetModel(this.IdValue);
                model.isIndexShow = true;
                model.updtEmpId = this.currentUser.empId;
                model.updtDt = DateTime.Now.ToString();
                announceBB.ModifyRecord(model);
            }
            else
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "alert('发布失败!');", true);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            announceBB.Dispose();
        }

        Response.Redirect("LAnnounceList.aspx?itemNo=" + this.itemNo + "&pTypeNo=main", false);
    }
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        bool retChecked = false;
        LAnnounceBB announceBB = new LAnnounceBB();
        try
        {
            //获取选中的数据Id
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
                if (chkId.Checked == true)
                {
                    retChecked = true;
                    int id = int.Parse(chkId.ValidationGroup);
                    announceBB.DeleteRecord(id);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            announceBB.Dispose();
        }

        if (retChecked)
        {
            this.BindGrid();
        }
    }
 protected void btnRelease_Click(object sender, EventArgs e)
 {
     //获取选中的数据Id
     foreach (GridViewRow gvrow in this.grid.Rows)
     {
         CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
         string id = "";
         if (chkId.Checked == true)
         {
             id = chkId.ValidationGroup;
             LAnnounceBB announceBB = new LAnnounceBB();
             try
             {
                 LAnnounceData model = new LAnnounceData();
                 model = announceBB.GetModel(int.Parse(id));
                 if (model.isIndexShow)
                 {
                     this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"此通知已经发布!\");", true);
                 }
                 else
                 {
                     model.isIndexShow = true;
                     announceBB.ModifyRecord(model);
                     this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"发布成功!\");", true);
                 }
             }
             finally
             {
                 announceBB.Dispose();
             }
             this.BindGrid();
             return;
         }
     }
     this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条记录!\");", true);
     return;
 }
示例#6
0
    /// <summary>
    /// 展示数据
    /// </summary>
    /// <param name="id">记录Id</param>
    private void ShowInfo(int id)
    {
        LAnnounceBB announceBB = new LAnnounceBB();
        vLAnnounceData model = new vLAnnounceData();
        try
        {
            model = announceBB.GetVModel(id);
            this.title.Text = model.title;
            this.content.Text = model.content;
            this.fileIds.Value = model.fileIds;
            if (model.preFileNm != null)
            {
                this.fileNms.Text = model.preFileNm.Replace("|", "<br />");
            }
            this.author.Text = model.author;
            if (model.isIndexShow)
            {
                this.isIndexShow.Text = "已发布";
                this.btnRelease.Enabled = false;
                this.btnUnRelease.Enabled = true;
            }
            else
            {
                this.isIndexShow.Text = "未发布";
                this.btnRelease.Enabled = true;
                this.btnUnRelease.Enabled = false;
            }

        }
        finally
        {
            announceBB.Dispose();
        }
    }
示例#7
0
 protected bool Save()
 {
     if (!this.Validata()) return false;
     LAnnounceData model = new LAnnounceData();
     LAnnounceBB announceBB = new LAnnounceBB();
     try
     {
         if (this.State == "1")
         {
             this.SetModel(ref model);
             this.IdValue = announceBB.AddRecord(model);
         }
         else if (this.State == "2")
         {
             model = announceBB.GetModel(this.IdValue);
             this.SetModel(ref model);
             announceBB.ModifyRecord(model);
         }
         return true;
     }
     catch (Exception ex)
     {
         this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
         return false;
     }
     finally
     {
         announceBB.Dispose();
     }
 }