毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

C#药品管理系统源代码+论文 第3页

更新时间:2009-7-8:  来源:毕业论文
C#药品管理系统源代码+论文 第3页
protected void Page_Load(object sender, EventArgs e)
    {
        Server.Execute("Judge.aspx");//防止绕过登录进入系统
        if (!IsPostBack)
        {
            getmedInfo();//调用getmedInfo()函数,显示数据
       
        }
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)//修改数据
    {
        string medid = this.GridView1.DataKeys[e.RowIndex][0].ToString();
        string medName = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[0].Controls[0]).Text.ToString();
         string typeid= ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text.ToString();
         string cangkuid = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text.ToString();
         string ghsid = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text.ToString();
         string medCode = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text.ToString();
         string danwei = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[5].Controls[0]).Text.ToString();
         string guige= ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[6].Controls[0]).Text.ToString();
         string pizhunzihao = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[7].Controls[0]).Text.ToString();
         string kucun= ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[8].Controls[0]).Text.ToString();
         string jinjia = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[9].Controls[0]).Text.ToString();
         string shoujia = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[10].Controls[0]).Text.ToString();
         string shengchanshang= ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[11].Controls[0]).Text.ToString();
         string beizhu = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[12].Controls[0]).Text.ToString();
         updateMed(medid,typeid,cangkuid, ghsid, medName, medCode, danwei, guige, pizhunzihao, kucun, jinjia, shoujia, shengchanshang, beizhu);
         this.GridView1.EditIndex = -1;
         getmedInfo();
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)//请求编辑行
    {
        this.GridView1.EditIndex = e.NewEditIndex;
        getmedInfo();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)//删除行
    {
        string medid = this.GridView1.DataKeys[e.RowIndex][0].ToString();
        deletemedicine(medid);
        getmedInfo();
    }
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)//取消编辑行
    {
        this.GridView1.EditIndex = -1;
        getmedInfo();
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)//换页
    {
        this.GridView1.PageIndex = e.NewPageIndex;
        getmedInfo();
    }
    public const string sql_getmedInfo = "select * from MedInfo";
    public void getmedInfo()//函数,GridView绑定数据库
    {
        SqlConnection cn = DB.createCon();
        SqlCommand cmd = new SqlCommand(sql_getmedInfo, cn);
        SqlDataAdapter sda = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        cn.Open();
        sda.Fill(ds, "MedInfo");
        this.GridView1.DataSource = ds.Tables[0].DefaultView;
        this.DataBind();
        cn.Close();

    }
    public void deletemedicine(string medid) //函数,删除数据库指定元组
    {
        SqlConnection cn = DB.createCon();
www.youerw.com
    public void medquery(string medName)//查询函数
    {
        string sql_query = "select * from MedInfo where 药品名称='" + medName + "'";
        SqlConnection cn = DB.createCon();
        SqlCommand cmd = new SqlCommand(sql_query, cn);
        SqlDataAdapter sda = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        cn.Open();
        sda.Fill(ds, "MedInfo");
        this.GridView1.DataSource = ds.Tables[0].DefaultView;
        this.DataBind();
        cn.Close();

    }
    public void updateMed(string medid, string typeid, string cangkuid,string ghsid,string medName,string medCode,string danwei,string guige,string pizhunzihao,string kucun,string jinjia,string shoujia,string shengchanshang,string beizhu)//更新数据函数
    {
        SqlConnection cn = DB.createCon();
        SqlCommand cmd = new SqlCommand("update MedInfo set 类别编号='" + typeid + "',仓库编号='" +cangkuid+ "',供货商编号='" +ghsid+ "',药品名称='" +medName+ "',商品条码='" +medCode+ "',单位='" +danwei+ "',产品规格='" +guige+ "',批准字号='" +pizhunzihao+ "',库存量='" +kucun+ "',进价='" +jinjia+ "',售价='" +shoujia+ "',生产厂商='" +shengchanshang+ "',备注='" +beizhu+ "'where 药品编号='" +medid + "'", cn);
        cn.Open();
        cmd.ExecuteNonQuery();
        cn.Close();    }
    protected void btnchaxun_Click(object sender, EventArgs e)//触发查询
    {
        string medName = this.txtmedName.Text.Trim();
        medquery(medName);

上一页  [1] [2] [3] [4] 下一页

C#药品管理系统源代码+论文 第3页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。