Пример #1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="connection">数据连接</param>
 public CPickOutPlanBC(SqlConnection connection)
 {
     this.connection = connection;
     this.pickOutPlanBB = new CPickOutPlanBB(this.connection);
     this.errorDiaryBB = new SErrorDiaryBB(this.connection);
     this.operatDiaryBB = new SOperatDiaryBB(this.connection);
 }
    /// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        SErrorDiaryBB errorDiaryBB = new SErrorDiaryBB();
        DataSet ds = new DataSet();

        try
        {
            string strWhere = this.StrWhere;
            if (this.operateStartDt.Text != "")
            {
                strWhere += " and operateDt>='" + this.operateStartDt.Text + "'";
            }
            if (this.operateEndDt.Text != "")
            {
                strWhere += " and operateDt<'" + Convert.ToDateTime(this.operateEndDt.Text).AddDays(1).ToString() + "'";
            }
            if (this.errorText.Text != "")
            {
                strWhere += " and errorText like '%" + this.errorText.Text + "%'";
            }
            ds = errorDiaryBB.GetVList(strWhere);
            this.grid.DataSource = ds.Tables[0];
            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
        {
            errorDiaryBB.Dispose();
        }
    }
Пример #3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public CPickOutPlanBC()
 {
     this.selfConn = true;
     this.connection = new SqlConnection(HS.Config.SqlDataObject.GetSqlConnectionString);
     this.connection.Open();
     this.pickOutPlanBB = new CPickOutPlanBB(this.connection);
     this.errorDiaryBB = new SErrorDiaryBB(this.connection);
     this.operatDiaryBB = new SOperatDiaryBB(this.connection);
 }
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        bool retChecked = false;
        SErrorDiaryBB errorDiaryBB = new SErrorDiaryBB();
        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);
                    errorDiaryBB.DeleteRecord(id);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            errorDiaryBB.Dispose();
        }

        if (retChecked)
        {
            this.BindGrid();
        }
    }