当前位置:跳过导航链接计算机毕业设计首页 : C#计算机毕业设计 : 详细内容

C#商品进销存销售管理系统(程序下载)(10)

来源:xiaoniu168.com 作者:本站原创 添加时间:2014-12-04 点击数:45338

计算机毕业设计介绍:

7.4进销存管理模块设计
进货管理模块下设三个菜单分别为采购进货、采购退货和采购查询;销售管理模块下设三个菜单分别为客户退货、商品销售和销售查询;库存管理模块下设三个菜单分别为库存报警、库存查询和库存调拨。由于本系统的主要功能是销售报表查询,故此处只列出销售管理模块的销售查询的界面设计、前台代码及后台代码。
7.4.2后台代码
由于系统的销售信息查询界面的前台代码所占篇幅较长并和其他模块的前代代码相似,所以此处只列出后台代码。系统的销售管理模块下的销售查询界面设计的后台代码如下:
namespace ERP之商品进销存销售报表系统.SellManage
{
    public partial class GoodsQuery : System.Web.UI.Page
    {
        //创建对象
        SqlConnection sqlcon;
        SqlCommand sqlcom;
        //数据库连接字符串
        string strCon = ConfigurationManager.ConnectionStrings["ERP之进销存销售报表ConnectionString"].ToString();
        protected void Page_Load(object sender, EventArgs e)
        {
        }
        //出发查询条件一的按钮事件
        protected void Button5_Click(object sender, EventArgs e)
        {
            string mystr = ConfigurationManager.ConnectionStrings["ERP之进销存销售报表ConnectionString"].ToString();
            SqlConnection conn = new SqlConnection(mystr);
            conn.Open();
            string strSql = "select * from 销售信息表 where (商品名称 LIKE '%" + this.TextBox1.Text.Trim() + "%' or 商品类型 LIKE '%" + this.TextBox2.Text.Trim() + "%') ORDER BY [销售单号] DESC";
            SqlCommand cmd = new SqlCommand(strSql, conn);
            DataTable dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(dt);
            conn.Close();
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
//向数据库中插入一条新记录项并在GridView中显示
        protected void Button11_Click(object sender, EventArgs e)
        {
            try
            {string mystr = ConfigurationManager.ConnectionStrings["ERP之进销存销售报表ConnectionString"].ToString();
                SqlConnection conn = new SqlConnection(mystr);
                conn.Open();
                string strSql = "insert into 销售信息表 (销售单号,商品名称,商品类型,销售日期,销售区域,员工ID,员工姓名,客户编码,第一季度,第二季度,第三季度,第四季度,销售数量,进货单价,销售单价,应收金额,实收金额,备注)"+ "VALUES('" + this.TextBox9.Text + "','" + this.TextBox10.Text + "','" + this.TextBox11.Text + "','" + this.TextBox12.Text + "','" + this.TextBox13.Text + "','"+ this.TextBox14.Text + "','" + this.TextBox15.Text + "','" + this.TextBox16.Text + "','" + this.TextBox23.Text + "','" + this.TextBox24.Text + "','"+ this.TextBox25.Text + "','" + this.TextBox26.Text + "','" + this.TextBox17.Text + "','" + this.TextBox18.Text + "','" + this.TextBox19.Text + "','"+ this.TextBox20.Text + "','" + this.TextBox21.Text + "','" + this.TextBox22.Text + "')";
                SqlCommand cmd = new SqlCommand(strSql, conn);
                DataTable dt = new DataTable();
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(dt);
                conn.Close();
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            catch
            {
                //如果记录存在则弹出提示
                Response.Write("");
            }
        }
//数据绑定
        public void bind()
        {string sqlstr = "select * from 销售信息表 where(商品名称 LIKE '%" + this.TextBox1.Text.Trim() + "%' or 商品类型 LIKE '%" + this.TextBox2.Text.Trim() + "%'or 销售区域 LIKE '%" + this.TextBox3.Text.Trim() + "%'or 销售日期 LIKE '%" + this.TextBox4.Text.Trim() + "%'or 员工ID LIKE '%" + this.TextBox5.Text.Trim() + "%'or 员工姓名 LIKE '%" + this.TextBox6.Text.Trim() + "%'or 进货单价 LIKE '%" + this.TextBox7.Text.Trim() + "%' or 销售单价 LIKE '%" + this.TextBox8.Text.Trim() + "%') ORDER BY [销售单号] DESC";
            sqlcon = new SqlConnection(strCon);
            SqlDataAdapter myda = new SqlDataAdapter(sqlstr, sqlcon);
            DataSet myds = new DataSet();
            sqlcon.Open();//打开数据库连接
            myda.Fill(myds, "销售信息表");
            GridView1.DataSource = myds;
            GridView1.DataKeyNames = new string[] { "销售单号" };            GridView1.DataBind();
            sqlcon.Close();//关闭数据库连接}}}

〖资料来源:计算机毕业论文 www.xiaoniu168.com

第11页为计算机毕业论文部分......

【联系方式】

【本站信誉】

用心做计算机毕业设计论文网