Exemplo n.º 1
0
        //报警删除
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string key1 = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
            string key2 = GridView1.DataKeys[e.RowIndex].Values[1].ToString();

            int flag = DataOperate.deleteInvoiceInfo(key1, key2);

            if (flag > 0)
            {
                string invoiceType = this.DropDownList1.SelectedValue.ToString();
                //起始日期
                string startDate = this.startDate.Text;
                //结束日期
                string endDate = this.endDate.Text;
                //string endDate = this.DropDownList_DepotType.SelectedValue;
                //填充数据源
                //GridView1.DataSource = CheckStatBll.getCheckStatByCondition(materialType, depotId, depotType, goodsName);
                string  operatorID = Request.LogonUserIdentity.Name;
                DataSet ds         = DataOperate.exportInvoiceInfo(invoiceType, startDate, endDate, operatorID);
                DataSet ds1        = DataOperate.queryInvoiceInfo(invoiceType, startDate, endDate, operatorID);
                GridView1.DataSource   = ds1.Tables[0];
                GridView1.DataKeyNames = new string[] { "InvoiceCode", "InvoiceNumber" };//主键
                GridView1.DataBind();
                GridView2.DataSource = ds.Tables[1];
                GridView2.DataBind();
                Response.Write("<script language=javascript>alert('删除发票代码:" + key1 + ",号码:" + key2 + "记录成功!');</script>");
            }
            else
            {
                Response.Write("<script language=javascript>alert('删除发票记录失败!');</script>");
            }
        }
Exemplo n.º 2
0
        protected void search_Click(object sender, EventArgs e)
        {
            //发票类型代码:00所有/01专票/04普票
            string invoiceType = this.DropDownList1.SelectedValue.ToString();
            //起始日期
            string startDate = this.startDate.Text;
            //结束日期
            string endDate    = this.endDate.Text;
            string operatorID = Request.LogonUserIdentity.Name;

            if (invoiceType != "" && startDate != "" && endDate != "" && operatorID != "")
            {
                DataSet ds = DataOperate.queryInvoiceInfo(invoiceType, startDate, endDate, operatorID);
                GridView1.DataSource   = ds.Tables[0];
                GridView1.DataKeyNames = new string[] { "InvoiceCode", "InvoiceNumber" };//主键
                GridView1.DataBind();
                if (!(ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
                {
                    Response.Write("<script language=javascript>alert('该时间段内没有该类型发票!');</script>");
                }
            }
            else
            {
                Response.Write("<script language=javascript>alert('请完善查询起止日期!');</script>");
            }
        }
Exemplo n.º 3
0
        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            //GridView1.PageIndex = e.NewPageIndex;
            //GridView1.DataBind();
            // 得到该控件
            GridView theGrid      = sender as GridView;
            int      newPageIndex = 0;

            if (e.NewPageIndex == -3)
            {
                //点击了Go按钮
                TextBox txtNewPageIndex = null;

                //GridView较DataGrid提供了更多的API,获取分页块可以使用BottomPagerRow 或者TopPagerRow,当然还增加了HeaderRow和FooterRow
                GridViewRow pagerRow = theGrid.BottomPagerRow;

                if (pagerRow != null)
                {
                    //得到text控件
                    txtNewPageIndex = pagerRow.FindControl("txtNewPageIndex") as TextBox;
                }
                if (txtNewPageIndex != null)
                {
                    //得到索引
                    newPageIndex = int.Parse(txtNewPageIndex.Text) - 1;
                }
            }
            else
            {
                //点击了其他的按钮
                newPageIndex = e.NewPageIndex;
            }
            //防止新索引溢出
            newPageIndex = newPageIndex < 0 ? 0 : newPageIndex;
            newPageIndex = newPageIndex >= theGrid.PageCount ? theGrid.PageCount - 1 : newPageIndex;

            //得到新的值
            theGrid.PageIndex = newPageIndex;

            //发票类型代码:00所有/01专票/04普票
            string invoiceType = this.DropDownList1.SelectedValue.ToString();
            //起始日期
            string startDate = this.startDate.Text;
            //结束日期
            string endDate    = this.endDate.Text;
            string operatorID = Request.LogonUserIdentity.Name;

            if (invoiceType != "" && startDate != "" && endDate != "" && operatorID != "")
            {
                //重新绑定
                DataSet ds = DataOperate.queryInvoiceInfo(invoiceType, startDate, endDate, operatorID);
                GridView1.DataSource   = ds.Tables[0];
                GridView1.DataKeyNames = new string[] { "InvoiceCode", "InvoiceNumber" };//主键
                theGrid.DataBind();
                if (!(ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
                {
                    Response.Write("<script language=javascript>alert('该时间段内没有该类型发票!');</script>");
                }
            }
            else
            {
                Response.Write("<script language=javascript>alert('请完善查询起止日期!');</script>");
            }
        }