£¨ÕûÀí£©Êý¾Ý¿â¿Î³ÌÉè¼Æ-²Ö¿â¹ÜÀíϵͳ - ͼÎÄ ÏÂÔر¾ÎÄ

¾«Æ·Îĵµ

} } }

}

3.2³ö¿â¹ÜÀí½çÃæ

using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text;

using System.Windows.Forms; using System.Data.SqlClient;

namespace XRX.GoodsManage {

public partial class OutManage : Form {

int a = 0, aa = 0, bb = 0; public OutManage() {

InitializeComponent(); }

¾«Æ·Îĵµ

¾«Æ·Îĵµ

private void btnAdd_Click(object sender, EventArgs e) {

DataBase db = new DataBase();

SqlParameter[] Pa = new SqlParameter[6];

Pa[0] = db.MakeInParam(\, SqlDbType.Int, 4, aa); Pa[1] = db.MakeInParam(\, SqlDbType.Int, 4, bb); Pa[2] = db.MakeInParam(\, SqlDbType.Int, 4, Convert.ToInt32(this.txtGSpec.Text));

Pa[3] = db.MakeInParam(\, SqlDbType.VarChar, 20, this.txtGIPrice.Text);

Pa[4] = db.MakeInParam(\, SqlDbType.VarChar, 20, this.dateTimePicker1.Value);

Pa[5] = db.MakeInParam(\, SqlDbType.VarChar, 20, this.txtISRemark.Text);

int b = db.ExecuteNonQuery(CommandType.StoredProcedure, \, Pa);

int Add = db.ExecuteNonQuery(CommandType.Text, \(StorageID,GoodsID,OutNum,OutUnit,OutDate,OutRemark) values ('\ + aa + \ + bb + \ + this.txtGSpec.Text + \ + this.txtGIPrice + \ + this.dateTimePicker1.Value + \ + this.txtISRemark.Text + \, null); if (Add == 1) {

MessageBox.Show(\Ìí¼Ó³ö¿âÐÅÏ¢³É¹¦\, \Ìí¼Ó³É¹¦\, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); aaa(); } else {

MessageBox.Show(\Ìí¼Ó³ö¿âÐÅϢʧ°Ü\, \Ìí¼Óʧ°Ü\, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }

}

private void btnDel_Click(object sender, EventArgs e) {

DataBase db = new DataBase();

int Delete = db.ExecuteNonQuery(CommandType.Text, \from OutInfo where OutOrder='\ + a + \, null); if (Delete == 1) {

MessageBox.Show(\ɾ³ýÈë¿âÐÅÏ¢³É¹¦\, \Ð޸ijɹ¦\, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); aaa();

¾«Æ·Îĵµ

¾«Æ·Îĵµ

} else {

MessageBox.Show(\ɾ³ýÈë¿âÐÅϢʧ°Ü\, \ÐÞ¸Äʧ°Ü\, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }

private void btnExit_Click(object sender, EventArgs e) {

this.Close(); }

private void OutManage_Load(object sender, EventArgs e) {

aaa(); }

private void aaa() {

DataBase db = new DataBase();

DataSet ds = db.GetDs(CommandType.StoredProcedure, \, null);

this.dgvISManage.DataSource = ds.Tables[0];

this.cboxSName.DataSource = ds.Tables[0].DefaultView; this.cboxSName.DisplayMember = \;

this.comboBox1.DataSource = ds.Tables[0].DefaultView; this.comboBox1.DisplayMember = \; this.dgvISManage.Columns[0].Visible = false; this.dgvISManage.Columns[1].HeaderText = \²Ö¿âÃû\; this.dgvISManage.Columns[2].HeaderText = \ÎïÆ·Ãû\; this.dgvISManage.Columns[3].HeaderText = \³ö¿âÊýÁ¿\; this.dgvISManage.Columns[4].HeaderText = \³ö¿âµ¥Î»\; this.dgvISManage.Columns[5].HeaderText = \³ö¿âÈÕÆÚ\; this.dgvISManage.Columns[6].HeaderText = \±¸×¢\; this.dgvISManage.Columns[1].Width = 100; this.dgvISManage.Columns[2].Width = 80; this.dgvISManage.Columns[3].Width = 80; this.dgvISManage.Columns[4].Width = 80; this.dgvISManage.Columns[5].Width = 80; this.dgvISManage.Columns[6].Width = 100; this.dgvISManage.ReadOnly = true;//Ö»¶Á dgvISManage.SelectionMode =

DataGridViewSelectionMode.FullRowSelect;//Ñ¡ÖÐÐÐ

this.dgvISManage.AllowUserToResizeRows = false;

¾«Æ·Îĵµ

¾«Æ·Îĵµ

this.dgvISManage.AllowUserToResizeColumns = false;//½ûÖ¹Í϶¯ this.dgvISManage.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;//Îı¾¾ÓÖÐ

this.dgvISManage.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;//±íÍ·¾ÓÖÐ }

private void dgvISManage_CellClick(object sender, DataGridViewCellEventArgs e) { try { a =

Convert.ToInt32(this.dgvISManage.Rows[e.RowIndex].Cells[0].Value.ToString());

this.cboxSName.Text =

this.dgvISManage.Rows[e.RowIndex].Cells[1].Value.ToString(); this.textBox1.Text =

this.dgvISManage.Rows[e.RowIndex].Cells[7].Value.ToString(); this.comboBox1.Text =

this.dgvISManage.Rows[e.RowIndex].Cells[2].Value.ToString(); this.txtGSpec.Text =

this.dgvISManage.Rows[e.RowIndex].Cells[3].Value.ToString(); this.dateTimePicker1.Value =

Convert.ToDateTime(this.dgvISManage.Rows[e.RowIndex].Cells[5].Value.ToString());

this.txtGIPrice.Text =

this.dgvISManage.Rows[e.RowIndex].Cells[4].Value.ToString(); this.txtISRemark.Text =

this.dgvISManage.Rows[e.RowIndex].Cells[6].Value.ToString(); }

catch { } }

private void cboxSName_SelectedIndexChanged(object sender, EventArgs e) {

DataBase db = new DataBase();

SqlDataReader dr = db.ExecuteReader(CommandType.Text, \StorageID from StorageInfo where StorageName ='\ + this.cboxSName.Text + \, null);

if (dr.Read())

aa = Convert.ToInt32(dr[\].ToString()); dr.Close();

SqlDataReader dr2 = db.ExecuteReader(CommandType.Text, \

¾«Æ·Îĵµ