www.pudn.com > MainPrj_CarShop.rar > frmInitial.cs
using System;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace MainPrj_CarShop
{
///
/// frmInitial 的摘要说明。
///
public class frmInitial : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txtCName;
private System.Windows.Forms.TextBox txtCAdd;
private System.Windows.Forms.TextBox txtCPhone;
private System.Windows.Forms.TextBox txtCWeb;
private System.Windows.Forms.TextBox txtInDepot;
private System.Windows.Forms.TextBox txtMove;
private System.Windows.Forms.TextBox txtStock;
private System.Windows.Forms.TextBox txtGet;
private System.Windows.Forms.TextBox txtSellS;
private System.Windows.Forms.TextBox txtSelling;
private System.Windows.Forms.TextBox txtPay;
private System.Windows.Forms.TextBox txtCommit;
private System.Windows.Forms.Button btnConfirm;
private System.Windows.Forms.Button btnCancel;
///
/// 必需的设计器变量。
///
private System.ComponentModel.Container components = null;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
private System.Data.SqlClient.SqlDataAdapter _sqlAdap;
private System.Data.SqlClient.SqlConnection _sqlCon;
private MainPrj_CarShop.dsOsINI _dsOsINI1;
private System.Data.SqlClient.SqlCommand _sqlCom;
private string _userID="";
public frmInitial(string userID)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
_userID=userID;
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
///
/// 清理所有正在使用的资源。
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
///
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
///
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.txtCName = new System.Windows.Forms.TextBox();
this._dsOsINI1 = new MainPrj_CarShop.dsOsINI();
this.label2 = new System.Windows.Forms.Label();
this.txtCAdd = new System.Windows.Forms.TextBox();
this.txtCPhone = new System.Windows.Forms.TextBox();
this.txtCWeb = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label();
this.txtPay = new System.Windows.Forms.TextBox();
this.txtSelling = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.txtSellS = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.txtGet = new System.Windows.Forms.TextBox();
this.txtStock = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.txtMove = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.txtInDepot = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.txtCommit = new System.Windows.Forms.TextBox();
this.btnConfirm = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this._sqlAdap = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this._sqlCon = new System.Data.SqlClient.SqlConnection();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this._sqlCom = new System.Data.SqlClient.SqlCommand();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this._dsOsINI1)).BeginInit();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.txtCName);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.txtCAdd);
this.groupBox1.Controls.Add(this.txtCPhone);
this.groupBox1.Controls.Add(this.txtCWeb);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(520, 168);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "公司信息";
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Location = new System.Drawing.Point(40, 66);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(42, 17);
this.label1.TabIndex = 5;
this.label1.Text = "地 址";
//
// txtCName
//
this.txtCName.BackColor = System.Drawing.Color.White;
this.txtCName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiName"));
this.txtCName.Location = new System.Drawing.Point(88, 32);
this.txtCName.Name = "txtCName";
this.txtCName.ReadOnly = true;
this.txtCName.Size = new System.Drawing.Size(400, 21);
this.txtCName.TabIndex = 4;
this.txtCName.Text = "";
//
// _dsOsINI1
//
this._dsOsINI1.DataSetName = "dsOsINI";
this._dsOsINI1.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.Location = new System.Drawing.Point(40, 34);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(42, 17);
this.label2.TabIndex = 3;
this.label2.Text = "名 称";
//
// txtCAdd
//
this.txtCAdd.BackColor = System.Drawing.Color.White;
this.txtCAdd.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiAdd"));
this.txtCAdd.Location = new System.Drawing.Point(88, 64);
this.txtCAdd.Name = "txtCAdd";
this.txtCAdd.ReadOnly = true;
this.txtCAdd.Size = new System.Drawing.Size(400, 21);
this.txtCAdd.TabIndex = 4;
this.txtCAdd.Text = "";
//
// txtCPhone
//
this.txtCPhone.BackColor = System.Drawing.Color.White;
this.txtCPhone.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiTel"));
this.txtCPhone.Location = new System.Drawing.Point(88, 96);
this.txtCPhone.Name = "txtCPhone";
this.txtCPhone.ReadOnly = true;
this.txtCPhone.Size = new System.Drawing.Size(400, 21);
this.txtCPhone.TabIndex = 4;
this.txtCPhone.Text = "";
//
// txtCWeb
//
this.txtCWeb.BackColor = System.Drawing.Color.White;
this.txtCWeb.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiWeb"));
this.txtCWeb.Location = new System.Drawing.Point(88, 128);
this.txtCWeb.Name = "txtCWeb";
this.txtCWeb.ReadOnly = true;
this.txtCWeb.Size = new System.Drawing.Size(400, 21);
this.txtCWeb.TabIndex = 4;
this.txtCWeb.Text = "";
//
// label3
//
this.label3.AutoSize = true;
this.label3.BackColor = System.Drawing.Color.Transparent;
this.label3.Location = new System.Drawing.Point(40, 98);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(42, 17);
this.label3.TabIndex = 5;
this.label3.Text = "电 话";
//
// label4
//
this.label4.AutoSize = true;
this.label4.BackColor = System.Drawing.Color.Transparent;
this.label4.Location = new System.Drawing.Point(40, 130);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(42, 17);
this.label4.TabIndex = 5;
this.label4.Text = "网 址";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.txtPay);
this.groupBox2.Controls.Add(this.txtSelling);
this.groupBox2.Controls.Add(this.label12);
this.groupBox2.Controls.Add(this.txtSellS);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.txtGet);
this.groupBox2.Controls.Add(this.txtStock);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.txtMove);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.txtInDepot);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.label14);
this.groupBox2.Controls.Add(this.label15);
this.groupBox2.Controls.Add(this.txtCommit);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox2.Location = new System.Drawing.Point(0, 168);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(520, 136);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "各种单据的起始单号";
//
// label7
//
this.label7.AutoSize = true;
this.label7.BackColor = System.Drawing.Color.Transparent;
this.label7.Location = new System.Drawing.Point(184, 60);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(42, 17);
this.label7.TabIndex = 22;
this.label7.Text = "收款单";
//
// txtPay
//
this.txtPay.BackColor = System.Drawing.Color.LightGoldenrodYellow;
this.txtPay.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiPayCode"));
this.txtPay.Location = new System.Drawing.Point(230, 88);
this.txtPay.Name = "txtPay";
this.txtPay.ReadOnly = true;
this.txtPay.Size = new System.Drawing.Size(96, 21);
this.txtPay.TabIndex = 21;
this.txtPay.Text = "";
//
// txtSelling
//
this.txtSelling.BackColor = System.Drawing.Color.LightGoldenrodYellow;
this.txtSelling.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiSellCode"));
this.txtSelling.Location = new System.Drawing.Point(390, 58);
this.txtSelling.Name = "txtSelling";
this.txtSelling.ReadOnly = true;
this.txtSelling.Size = new System.Drawing.Size(96, 21);
this.txtSelling.TabIndex = 19;
this.txtSelling.Text = "";
//
// label12
//
this.label12.AutoSize = true;
this.label12.BackColor = System.Drawing.Color.Transparent;
this.label12.Location = new System.Drawing.Point(344, 60);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(42, 17);
this.label12.TabIndex = 18;
this.label12.Text = "销售单";
//
// txtSellS
//
this.txtSellS.BackColor = System.Drawing.Color.LightGoldenrodYellow;
this.txtSellS.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiPreCode"));
this.txtSellS.Location = new System.Drawing.Point(390, 24);
this.txtSellS.Name = "txtSellS";
this.txtSellS.ReadOnly = true;
this.txtSellS.Size = new System.Drawing.Size(96, 21);
this.txtSellS.TabIndex = 17;
this.txtSellS.Text = "";
//
// label11
//
this.label11.AutoSize = true;
this.label11.BackColor = System.Drawing.Color.Transparent;
this.label11.Location = new System.Drawing.Point(336, 26);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(54, 17);
this.label11.TabIndex = 16;
this.label11.Text = "销售订单";
//
// txtGet
//
this.txtGet.BackColor = System.Drawing.Color.LightGoldenrodYellow;
this.txtGet.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiGatheringCode"));
this.txtGet.Location = new System.Drawing.Point(230, 58);
this.txtGet.Name = "txtGet";
this.txtGet.ReadOnly = true;
this.txtGet.Size = new System.Drawing.Size(96, 21);
this.txtGet.TabIndex = 15;
this.txtGet.Text = "";
//
// txtStock
//
this.txtStock.BackColor = System.Drawing.Color.LightGoldenrodYellow;
this.txtStock.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiStoCode"));
this.txtStock.Location = new System.Drawing.Point(230, 24);
this.txtStock.Name = "txtStock";
this.txtStock.ReadOnly = true;
this.txtStock.Size = new System.Drawing.Size(96, 21);
this.txtStock.TabIndex = 11;
this.txtStock.Text = "";
//
// label8
//
this.label8.AutoSize = true;
this.label8.BackColor = System.Drawing.Color.Transparent;
this.label8.Location = new System.Drawing.Point(176, 26);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(54, 17);
this.label8.TabIndex = 10;
this.label8.Text = "采购订单";
//
// txtMove
//
this.txtMove.BackColor = System.Drawing.Color.LightGoldenrodYellow;
this.txtMove.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiMoveCode"));
this.txtMove.Location = new System.Drawing.Point(72, 58);
this.txtMove.Name = "txtMove";
this.txtMove.ReadOnly = true;
this.txtMove.Size = new System.Drawing.Size(96, 21);
this.txtMove.TabIndex = 7;
this.txtMove.Text = "";
//
// label6
//
this.label6.AutoSize = true;
this.label6.BackColor = System.Drawing.Color.Transparent;
this.label6.Location = new System.Drawing.Point(24, 60);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(42, 17);
this.label6.TabIndex = 6;
this.label6.Text = "移库单";
//
// txtInDepot
//
this.txtInDepot.BackColor = System.Drawing.Color.LightGoldenrodYellow;
this.txtInDepot.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiInDepotCode"));
this.txtInDepot.Location = new System.Drawing.Point(72, 24);
this.txtInDepot.Name = "txtInDepot";
this.txtInDepot.ReadOnly = true;
this.txtInDepot.Size = new System.Drawing.Size(96, 21);
this.txtInDepot.TabIndex = 5;
this.txtInDepot.Text = "";
//
// label5
//
this.label5.AutoSize = true;
this.label5.BackColor = System.Drawing.Color.Transparent;
this.label5.Location = new System.Drawing.Point(24, 26);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(42, 17);
this.label5.TabIndex = 4;
this.label5.Text = "入库单";
//
// label14
//
this.label14.AutoSize = true;
this.label14.BackColor = System.Drawing.Color.Transparent;
this.label14.Location = new System.Drawing.Point(24, 90);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(42, 17);
this.label14.TabIndex = 8;
this.label14.Text = "代办单";
//
// label15
//
this.label15.AutoSize = true;
this.label15.BackColor = System.Drawing.Color.Transparent;
this.label15.Location = new System.Drawing.Point(184, 90);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(42, 17);
this.label15.TabIndex = 20;
this.label15.Text = "付款单";
//
// txtCommit
//
this.txtCommit.BackColor = System.Drawing.Color.LightGoldenrodYellow;
this.txtCommit.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._dsOsINI1, "tblOsInit.osiCommissionCode"));
this.txtCommit.Location = new System.Drawing.Point(72, 88);
this.txtCommit.Name = "txtCommit";
this.txtCommit.ReadOnly = true;
this.txtCommit.Size = new System.Drawing.Size(96, 21);
this.txtCommit.TabIndex = 9;
this.txtCommit.Text = "";
//
// btnConfirm
//
this.btnConfirm.BackColor = System.Drawing.Color.LightSteelBlue;
this.btnConfirm.Location = new System.Drawing.Point(304, 312);
this.btnConfirm.Name = "btnConfirm";
this.btnConfirm.Size = new System.Drawing.Size(75, 24);
this.btnConfirm.TabIndex = 2;
this.btnConfirm.Text = "确定(&E)";
this.btnConfirm.Click += new System.EventHandler(this.btnConfirm_Click);
//
// btnCancel
//
this.btnCancel.BackColor = System.Drawing.Color.LightSteelBlue;
this.btnCancel.Location = new System.Drawing.Point(408, 312);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "取消(&C)";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// _sqlAdap
//
this._sqlAdap.DeleteCommand = this.sqlDeleteCommand1;
this._sqlAdap.InsertCommand = this.sqlInsertCommand1;
this._sqlAdap.SelectCommand = this.sqlSelectCommand1;
this._sqlAdap.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "tblOsInit", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("osiCode", "osiCode"),
new System.Data.Common.DataColumnMapping("osiName", "osiName"),
new System.Data.Common.DataColumnMapping("osiAdd", "osiAdd"),
new System.Data.Common.DataColumnMapping("osiTel", "osiTel"),
new System.Data.Common.DataColumnMapping("osiWeb", "osiWeb"),
new System.Data.Common.DataColumnMapping("osiInDepotCode", "osiInDepotCode"),
new System.Data.Common.DataColumnMapping("osiMoveCode", "osiMoveCode"),
new System.Data.Common.DataColumnMapping("osiSellCode", "osiSellCode"),
new System.Data.Common.DataColumnMapping("osiGatheringCode", "osiGatheringCode"),
new System.Data.Common.DataColumnMapping("osiCommissionCode", "osiCommissionCode"),
new System.Data.Common.DataColumnMapping("osiPayCode", "osiPayCode"),
new System.Data.Common.DataColumnMapping("osiPreCode", "osiPreCode"),
new System.Data.Common.DataColumnMapping("osiStoCode", "osiStoCode")})});
this._sqlAdap.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM tblOsInit WHERE (osiCode = @Original_osiCode) AND (osiAdd = @Original_osiAdd) AND (osiCommissionCode = @Original_osiCommissionCode) AND (osiGatheringCode = @Original_osiGatheringCode) AND (osiInDepotCode = @Original_osiInDepotCode) AND (osiMoveCode = @Original_osiMoveCode) AND (osiName = @Original_osiName) AND (osiPayCode = @Original_osiPayCode) AND (osiPreCode = @Original_osiPreCode) AND (osiSellCode = @Original_osiSellCode) AND (osiStoCode = @Original_osiStoCode) AND (osiTel = @Original_osiTel) AND (osiWeb = @Original_osiWeb)";
this.sqlDeleteCommand1.Connection = this._sqlCon;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiCode", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiAdd", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiAdd", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiCommissionCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiCommissionCode", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiGatheringCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiGatheringCode", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiInDepotCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiInDepotCode", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiMoveCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiMoveCode", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiName", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiName", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiPayCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiPayCode", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiPreCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiPreCode", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiSellCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiSellCode", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiStoCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiStoCode", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiTel", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiTel", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiWeb", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiWeb", System.Data.DataRowVersion.Original, null));
//
// _sqlCon
//
this._sqlCon.ConnectionString = "workstation id=Nebular;packet size=4096;user id=sa;data source=\".\";persist securi" +
"ty info=False;initial catalog=dbCarsys";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = @"INSERT INTO tblOsInit(osiCode, osiName, osiAdd, osiTel, osiWeb, osiInDepotCode, osiMoveCode, osiSellCode, osiGatheringCode, osiCommissionCode, osiPayCode, osiPreCode, osiStoCode) VALUES (@osiCode, @osiName, @osiAdd, @osiTel, @osiWeb, @osiInDepotCode, @osiMoveCode, @osiSellCode, @osiGatheringCode, @osiCommissionCode, @osiPayCode, @osiPreCode, @osiStoCode); SELECT osiCode, osiName, osiAdd, osiTel, osiWeb, osiInDepotCode, osiMoveCode, osiSellCode, osiGatheringCode, osiCommissionCode, osiPayCode, osiPreCode, osiStoCode FROM tblOsInit WHERE (osiCode = @osiCode)";
this.sqlInsertCommand1.Connection = this._sqlCon;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiCode", System.Data.SqlDbType.VarChar, 10, "osiCode"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiName", System.Data.SqlDbType.VarChar, 100, "osiName"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiAdd", System.Data.SqlDbType.VarChar, 100, "osiAdd"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiTel", System.Data.SqlDbType.VarChar, 100, "osiTel"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiWeb", System.Data.SqlDbType.VarChar, 100, "osiWeb"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiInDepotCode", System.Data.SqlDbType.VarChar, 10, "osiInDepotCode"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiMoveCode", System.Data.SqlDbType.VarChar, 10, "osiMoveCode"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiSellCode", System.Data.SqlDbType.VarChar, 10, "osiSellCode"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiGatheringCode", System.Data.SqlDbType.VarChar, 10, "osiGatheringCode"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiCommissionCode", System.Data.SqlDbType.VarChar, 10, "osiCommissionCode"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiPayCode", System.Data.SqlDbType.VarChar, 10, "osiPayCode"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiPreCode", System.Data.SqlDbType.VarChar, 10, "osiPreCode"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiStoCode", System.Data.SqlDbType.VarChar, 10, "osiStoCode"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT osiCode, osiName, osiAdd, osiTel, osiWeb, osiInDepotCode, osiMoveCode, osi" +
"SellCode, osiGatheringCode, osiCommissionCode, osiPayCode, osiPreCode, osiStoCod" +
"e FROM tblOsInit";
this.sqlSelectCommand1.Connection = this._sqlCon;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE tblOsInit SET osiCode = @osiCode, osiName = @osiName, osiAdd = @osiAdd, osiTel = @osiTel, osiWeb = @osiWeb, osiInDepotCode = @osiInDepotCode, osiMoveCode = @osiMoveCode, osiSellCode = @osiSellCode, osiGatheringCode = @osiGatheringCode, osiCommissionCode = @osiCommissionCode, osiPayCode = @osiPayCode, osiPreCode = @osiPreCode, osiStoCode = @osiStoCode WHERE (osiCode = @Original_osiCode) AND (osiAdd = @Original_osiAdd) AND (osiCommissionCode = @Original_osiCommissionCode) AND (osiGatheringCode = @Original_osiGatheringCode) AND (osiInDepotCode = @Original_osiInDepotCode) AND (osiMoveCode = @Original_osiMoveCode) AND (osiName = @Original_osiName) AND (osiPayCode = @Original_osiPayCode) AND (osiPreCode = @Original_osiPreCode) AND (osiSellCode = @Original_osiSellCode) AND (osiStoCode = @Original_osiStoCode) AND (osiTel = @Original_osiTel) AND (osiWeb = @Original_osiWeb); SELECT osiCode, osiName, osiAdd, osiTel, osiWeb, osiInDepotCode, osiMoveCode, osiSellCode, osiGatheringCode, osiCommissionCode, osiPayCode, osiPreCode, osiStoCode FROM tblOsInit WHERE (osiCode = @osiCode)";
this.sqlUpdateCommand1.Connection = this._sqlCon;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiCode", System.Data.SqlDbType.VarChar, 10, "osiCode"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiName", System.Data.SqlDbType.VarChar, 100, "osiName"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiAdd", System.Data.SqlDbType.VarChar, 100, "osiAdd"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiTel", System.Data.SqlDbType.VarChar, 100, "osiTel"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiWeb", System.Data.SqlDbType.VarChar, 100, "osiWeb"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiInDepotCode", System.Data.SqlDbType.VarChar, 10, "osiInDepotCode"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiMoveCode", System.Data.SqlDbType.VarChar, 10, "osiMoveCode"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiSellCode", System.Data.SqlDbType.VarChar, 10, "osiSellCode"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiGatheringCode", System.Data.SqlDbType.VarChar, 10, "osiGatheringCode"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiCommissionCode", System.Data.SqlDbType.VarChar, 10, "osiCommissionCode"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiPayCode", System.Data.SqlDbType.VarChar, 10, "osiPayCode"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiPreCode", System.Data.SqlDbType.VarChar, 10, "osiPreCode"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@osiStoCode", System.Data.SqlDbType.VarChar, 10, "osiStoCode"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiCode", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiAdd", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiAdd", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiCommissionCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiCommissionCode", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiGatheringCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiGatheringCode", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiInDepotCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiInDepotCode", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiMoveCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiMoveCode", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiName", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiName", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiPayCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiPayCode", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiPreCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiPreCode", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiSellCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiSellCode", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiStoCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiStoCode", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiTel", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiTel", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_osiWeb", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "osiWeb", System.Data.DataRowVersion.Original, null));
//
// _sqlCom
//
this._sqlCom.CommandText = "SELECT uJob FROM tblUser WHERE (uCode = @userID)";
this._sqlCom.Connection = this._sqlCon;
this._sqlCom.Parameters.Add(new System.Data.SqlClient.SqlParameter("@userID", System.Data.SqlDbType.VarChar, 10, "uCode"));
//
// frmInitial
//
this.AcceptButton = this.btnConfirm;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(520, 341);
this.Controls.Add(this.btnConfirm);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnCancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmInitial";
this.Text = "设定系统初始参数";
this.Load += new System.EventHandler(this.frmInitial_Load);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this._dsOsINI1)).EndInit();
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void btnConfirm_Click(object sender, System.EventArgs e)
{
try
{
if(!CheckTextBox())
return;
foreach(DataRow row in this._dsOsINI1.tblOsInit.Rows)
{
row.EndEdit();
}
this._sqlCon.Open();
this._sqlAdap.Update(this._dsOsINI1);
this.Close();
}
catch(SqlException ex)
{
MessageBox.Show("数据库操作错误!","错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
catch(Exception et)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。","系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
finally
{
this._sqlCon.Close();
}
}
private bool CheckTextBox()
{
if(this.txtCName.Text=="")
{
MessageBox.Show("公司名称不得为空!");
this.txtCName.Focus();
return false;
}
if(this.txtCAdd.Text=="")
{
MessageBox.Show("公司地址不得为空!");
this.txtCAdd.Focus();
return false;
}
if(this.txtCPhone.Text=="")
{
MessageBox.Show("公司电话不得为空!");
this.txtCPhone.Focus();
return false;
}
if(this.txtCWeb.Text=="")
{
MessageBox.Show("公司网址不得为空!");
this.txtCWeb.Focus();
return false;
}
if(this.txtCommit.Text=="")
{
MessageBox.Show("代办单号不得为空!");
this.txtCommit.Focus();
return false;
}
if(this.txtGet.Text=="")
{
MessageBox.Show("受款单号不得为空!");
this.txtGet.Focus();
return false;
}
if(this.txtInDepot.Text=="")
{
MessageBox.Show("入库单号不得为空!");
this.txtInDepot.Focus();
return false;
}
if(this.txtMove.Text=="")
{
MessageBox.Show("移库单号不得为空!");
this.txtMove.Focus();
return false;
}
if(this.txtPay.Text=="")
{
MessageBox.Show("付款单号不得为空!");
this.txtPay.Focus();
return false;
}
if(this.txtSelling.Text=="")
{
MessageBox.Show("销售单号不得为空!");
this.txtSelling.Focus();
return false;
}
if(this.txtSellS.Text=="")
{
MessageBox.Show("销售订单号不得为空!");
this.txtSellS.Focus();
return false;
}
if(this.txtStock.Text=="")
{
MessageBox.Show("采购订单号不得为空!");
this.txtStock.Focus();
return false;
}
return true;
}
private bool _isModify=false;
private void frmInitial_Load(object sender, System.EventArgs e)
{
string job="";
try
{
this._sqlCon.Open();
this._sqlCom.Parameters[0].Value=this._userID;
job=(string)_sqlCom.ExecuteScalar();
this._sqlAdap.Fill(this._dsOsINI1);
if(job!="总经理"&&job!="系统管理员")
{
foreach (Control col in this.groupBox1.Controls)
{
if(col.GetType().ToString().IndexOf("TextBox")!=-1)
{
((TextBox)col).ReadOnly=true;
}
}
foreach (Control col in this.groupBox2.Controls)
{
if(col.GetType().ToString().IndexOf("TextBox")!=-1)
{
((TextBox)col).ReadOnly=true;
}
}
}else
{
if(this._dsOsINI1.tblOsInit.Count!=0)
{
foreach (Control col in this.groupBox1.Controls)
{
if(col.GetType().ToString().IndexOf("TextBox")!=-1)
{
((TextBox)col).ReadOnly=false;
}
}
foreach (Control col in this.groupBox2.Controls)
{
if(col.GetType().ToString().IndexOf("TextBox")!=-1)
{
((TextBox)col).ReadOnly=true;
}
}
_isModify=true;
}
else
{
foreach (Control col in this.groupBox1.Controls)
{
if(col.GetType().ToString().IndexOf("TextBox")!=-1)
{
((TextBox)col).ReadOnly=false;
}
}
foreach (Control col in this.groupBox2.Controls)
{
if(col.GetType().ToString().IndexOf("TextBox")!=-1)
{
((TextBox)col).ReadOnly=false;
}
}
_isModify=false;
}
}
}
catch(SqlException ex)
{
MessageBox.Show("数据库操作错误!","错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
catch(Exception et)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+et.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
this.Close();
}
finally
{
this._sqlCon.Close();
}
}
private void btnCancel_Click(object sender, System.EventArgs e)
{
try
{
this.Close();
}
catch(Exception et)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。","系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
this.Close();
}
}
}
}