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

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

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

计算机毕业设计介绍:

7.3基本档案模块设计
基本档案管理模块包括“员工基本信息管理”和“往来单位信息管理”,完成相应的员工信息和往来单位信息的修改、增加和删除,并导出打印等操作,由于其功能相近,因此此处只列出员工信息管理模块的界面设计和后代代码实现。
7.3.2后台代码
系统基本档案模块下员工信息管理界面设计的后台代码:
namespace ERP之商品进销存销售报表系统.Basic
{
    public partial class EmployeeInformation : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
}
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
//弹出删除操作确认对话框
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Button MyButton = (Button)e.Row.FindControl("Button1");
                MyButton.OnClientClick = "return confirm('是否确认删除当前选择记录?')";
            }
        }
//将当前选中的GridView中的一条记录信息对应到相应的文本框
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.TextBox1.Text = this.GridView1.SelectedRow.Cells[2].Text.ToString();
            this.TextBox2.Text = this.GridView1.SelectedRow.Cells[3].Text.ToString();
            this.DropDownList1.Text = this.GridView1.SelectedRow.Cells[4].Text.ToString();
            this.TextBox3.Text = this.GridView1.SelectedRow.Cells[5].Text.ToString();
            this.TextBox4.Text = this.GridView1.SelectedRow.Cells[6].Text.ToString();
            this.TextBox5.Text = this.GridView1.SelectedRow.Cells[7].Text.ToString();
            this.TextBox6.Text = this.GridView1.SelectedRow.Cells[8].Text.ToString();
            this.TextBox7.Text = this.GridView1.SelectedRow.Cells[9].Text.ToString();
            this.TextBox8.Text = this.GridView1.SelectedRow.Cells[10].Text.ToString();
        }
//向数据库中插入一条新纪录
        protected void Button1_Click(object sender, EventArgs e)
        {
            //如果记录已经存在则提示用户记录已存在
            string strid = TextBox1.Text.Trim();
            string str = ConfigurationManager.ConnectionStrings["ERP之进销存销售报表ConnectionString"].ToString();
            SqlConnection cnn = new SqlConnection(str);
            cnn.Open();//打开数据库连接
            string mySql = "select * from 员工信息表 where 员工ID = '" + strid + "'";
            SqlDataAdapter da = new SqlDataAdapter(mySql, cnn);
            DataSet ds = new DataSet();
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count > 0)
            {
                Response.Write("");
            }
            else
            {
                this.SqlDataSource1.Insert();
            }
            cnn.Close();//关闭数据库连接
        }
        //更新数据库中的一条记录
        protected void Button2_Click(object sender, EventArgs e)
        {
            this.SqlDataSource1.Update();
        }
        ///


        /// 将GridView1中的数据导出到excel
        ///

        ///
        ///
        protected void Button7_Click(object sender, EventArgs e)
        {
            Export("application/ms-excel", "员工信息.xls");
        }
        ///
        /// 将GridView1中的数据导出到导出到word
        ///

        ///
        ///
        protected void Button6_Click(object sender, EventArgs e)
        {
            Export("application/ms-word", "员工信息.doc");
        }
        //将GridView中的数据导出函数
        private void Export(string FileType, string FileName)
        {Response.Charset = "GB2312";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = FileType;
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
            this.EnableViewState = false;
            StringWriter tw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(tw);
            GridView1.RenderControl(hw);
            Response.Write(tw.ToString());
            Response.End();
        }
        public override void VerifyRenderingInServerForm(Control control)
        {
        }

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

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

【联系方式】

【本站信誉】

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