⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reckoning.aspx.cs

📁 基于JSP+SQL Sever2000+Tomcat的网络服务器体系结构开发技术和对数据库技术的进一步了解以及对政府网站的调查研究
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class Stockpile_Reckoning : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Convert.ToString(Session["username"]) == "")
        {
            Response.Write("<script language=javascript>alert('请登录');location='../login.aspx'</script>");
            return;
        }
        if (!IsPostBack)
        {
            this.bind();
        }
    }
    public void bind()
    {
        string type=Request["type"];
        string typ="";
        switch (type)
        {
            case ("1"):
                type="进货信息";
                typ = "商品进货结账";
            break;
            case("2"):
                type="进货退货";
                typ = "进货退货结账";
            break;
            case ("3"):
                type = "销售信息";
                typ = "商品销售结账";
            break;
            case ("4"):
                type = "销售退货";
                typ = "销售退货结账";
            break;
            default:
                type="进货信息";
                typ = "商品进货结账";
            break;
        }
        Label1.Text = typ;
        SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
        strcon.Open();
        SqlDataAdapter sda = new SqlDataAdapter("select * from Reckoning where type='"+type+"' order by id desc", strcon);
        DataSet ds=new DataSet();
        sda.Fill(ds, "Reckoning");
        GridView1.DataSource = ds.Tables["Reckoning"];
        GridView1.DataKeyNames = new string[]{"id"};
        GridView1.DataBind();
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        this.bind();
    }
    protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        string id = GridView1.DataKeys[e.NewSelectedIndex].Value.ToString() ;
        Response.Write("<script>window.open('open.aspx?id=" + id + "&type=" + Request["type"] + "','','width=380,height=200,scrollbars=no')</script>");
    }

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if(e.Row.RowType==DataControlRowType.DataRow)
        {
            if ((e.Row.Cells[1].Text).Length > 6)
            {
                e.Row.Cells[1].Text = (e.Row.Cells[1].Text).Substring(0, 6) + "…";
            }
            if ((e.Row.Cells[2].Text).Length > 6)
            {
                e.Row.Cells[2].Text = (e.Row.Cells[2].Text).Substring(0, 6) + "…";
            }
            string id=e.Row.Cells[3].Text.ToString();
            stockClass sc=new stockClass();
            int not = sc.not(id);
            if (not == 0)
            {
                e.Row.Cells[3].Text = "<font color=red>已结款</font>";
                ((Button)(e.Row.Cells[6].Controls[0])).Enabled = false;
            }
            else
            {
                e.Row.Cells[3].Text = Convert.ToString(not);
            }
            SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
            strcon.Open();
            SqlCommand scd = new SqlCommand("select count(*) from tb_Reckoning where CommodityId=" + id, strcon);
            string count = Convert.ToString(Convert.ToInt32(scd.ExecuteScalar()) + 1);
            e.Row.Cells[4].Text = count;
            //单据编号
            string month=Convert.ToDateTime(((LinkButton)(e.Row.Cells[5].Controls[0])).Text).Month.ToString();
            if (month.Length < 2)
            {
                month = "0" + month;
            }
            string day = Convert.ToDateTime(((LinkButton)(e.Row.Cells[5].Controls[0])).Text).Day.ToString();
            if (day.Length < 2)
            {
                day = "0" + day;
            }
            string zero="";
            for (int i = 1; i < (10 - id.Length); i++)
            {
                zero = zero + "0";
            }
            string uid = zero + id;
            ((LinkButton)(e.Row.Cells[5].Controls[0])).Text = Convert.ToDateTime(((LinkButton)(e.Row.Cells[5].Controls[0])).Text).Year.ToString() + month + day + uid;
            if (e.Row.Cells[0].Text.ToString() == "进货信息" || e.Row.Cells[0].Text.ToString() == "进货退货")
            {
                ((LinkButton)(e.Row.Cells[5].Controls[0])).Attributes.Add("onclick", "window.open('Stock_open.aspx?id=" + id + "','','width=450,height=450,scrollbars=yes')");
            }
            else
            {
                ((LinkButton)(e.Row.Cells[5].Controls[0])).Attributes.Add("onclick", "window.open('Sell_open.aspx?id=" + id + "','','width=450,height=450,scrollbars=yes')");
            }

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -