/// <summary>デリート</summary> private void btnDelete1_Click(object sender, EventArgs e) { // 色のクリア this.ClearColor1(); // 主キーが無ければ、何もしない。 if (txtSupplierID.Text == "") { MessageBox.Show("主キー(SupplierID)を入力してください。"); return; } // 引数 TestParameterValue testParameterValue = new TestParameterValue( this.Name, ((Button)sender).Name, "Delete", "SQL", this.myUserInfo); testParameterValue.field1 = txtSupplierID.Text; // SupplierID txtSupplierID.BackColor = Color.LightYellow; // B層呼び出し LayerB_Static lb = new LayerB_Static(); TestReturnValue testReturnValue = (TestReturnValue)lb.DoBusinessLogic(testParameterValue, DbEnum.IsolationLevelEnum.ReadCommitted); // コミット BaseLogic2CS.CommitAndClose(); // データグリッドを更新 this.btnSelectAll1_Click(sender, e); }
/// <summary>インサート</summary> private void btnInsert1_Click(object sender, EventArgs e) { // 色のクリア this.ClearColor1(); // 引数 TestParameterValue testParameterValue = new TestParameterValue( this.Name, ((Button)sender).Name, "Insert", "SQL", this.myUserInfo); testParameterValue.field1 = ""; // SupplierID testParameterValue.field2 = txtCompanyName.Text; // CompanyName txtCompanyName.BackColor = Color.LightYellow; testParameterValue.field3 = txtContactName.Text; // ContactName txtContactName.BackColor = Color.LightYellow; testParameterValue.field4 = txtContactTitle.Text; // ContactTitle txtContactTitle.BackColor = Color.LightYellow; testParameterValue.field5 = txtAddress.Text; // Address txtAddress.BackColor = Color.LightYellow; testParameterValue.field6 = txtCity.Text; // City txtCity.BackColor = Color.LightYellow; testParameterValue.field7 = txtRegion.Text; // Region txtRegion.BackColor = Color.LightYellow; testParameterValue.field8 = txtPostalCode.Text; // PostalCode txtPostalCode.BackColor = Color.LightYellow; testParameterValue.field9 = txtCountry.Text; // Country txtCountry.BackColor = Color.LightYellow; testParameterValue.field10 = txtPhone.Text; // Phone txtPhone.BackColor = Color.LightYellow; testParameterValue.field11 = txtFax.Text; // Fax txtFax.BackColor = Color.LightYellow; testParameterValue.field12 = txtHomePage.Text; // HomePage txtHomePage.BackColor = Color.LightYellow; // B層呼び出し LayerB_Static lb = new LayerB_Static(); TestReturnValue testReturnValue = (TestReturnValue)lb.DoBusinessLogic(testParameterValue, DbEnum.IsolationLevelEnum.ReadCommitted); // コミット BaseLogic2CS.CommitAndClose(); // データグリッドを更新 this.btnSelectAll1_Click(sender,e); }
/// <summary>アップデート</summary> private void btnUpdate1_Click(object sender, EventArgs e) { // 色のクリア this.ClearColor1(); // 主キーが無ければ、何もしない。 if (txtSupplierID.Text == "") { MessageBox.Show("主キー(SupplierID)を入力してください。"); return; } // 引数 TestParameterValue testParameterValue = new TestParameterValue( this.Name, ((Button)sender).Name, "Update", "SQL", this.myUserInfo); testParameterValue.field1 = txtSupplierID.Text; // SupplierID txtSupplierID.BackColor = Color.LightYellow; testParameterValue.field2_ForUpd = txtCompanyName.Text; // CompanyName txtCompanyName.BackColor = Color.LightYellow; testParameterValue.field3_ForUpd = txtContactName.Text; // ContactName txtContactName.BackColor = Color.LightYellow; testParameterValue.field4_ForUpd = txtContactTitle.Text; // ContactTitle txtContactTitle.BackColor = Color.LightYellow; testParameterValue.field5_ForUpd = txtAddress.Text; // Address txtAddress.BackColor = Color.LightYellow; testParameterValue.field6_ForUpd = txtCity.Text; // City txtCity.BackColor = Color.LightYellow; testParameterValue.field7_ForUpd = txtRegion.Text; // Region txtRegion.BackColor = Color.LightYellow; testParameterValue.field8_ForUpd = txtPostalCode.Text; // PostalCode txtPostalCode.BackColor = Color.LightYellow; testParameterValue.field9_ForUpd = txtCountry.Text; // Country txtCountry.BackColor = Color.LightYellow; testParameterValue.field10_ForUpd = txtPhone.Text; // Phone txtPhone.BackColor = Color.LightYellow; testParameterValue.field11_ForUpd = txtFax.Text; // Fax txtFax.BackColor = Color.LightYellow; testParameterValue.field12_ForUpd = txtHomePage.Text; // HomePage txtHomePage.BackColor = Color.LightYellow; // B層呼び出し LayerB_Static lb = new LayerB_Static(); TestReturnValue testReturnValue = (TestReturnValue)lb.DoBusinessLogic(testParameterValue, DbEnum.IsolationLevelEnum.ReadCommitted); // コミット BaseLogic2CS.CommitAndClose(); // データグリッドを更新 this.btnSelectAll1_Click(sender, e); }
/// <summary>Suppliersテーブルの取得</summary> private DataTable GetSuppliers(string controlId) { // 引数 TestParameterValue testParameterValue = new TestParameterValue( this.Name, controlId, "SelectAll", "SQL", this.myUserInfo); // B層呼び出し LayerB_Static lb = new LayerB_Static(); TestReturnValue testReturnValue = (TestReturnValue)lb.DoBusinessLogic(testParameterValue, DbEnum.IsolationLevelEnum.ReadCommitted); // コミット BaseLogic2CS.CommitAndClose(); // 戻り値 return (DataTable)testReturnValue.dt; }