private void ReviewsimpleButton_Click(object sender, EventArgs e) { #region 製作簽核單 if (documentViewer1.DocumentSource != null) { documentViewer1.Controls.Clear(); } ReportFQ reportFQ = new ReportFQ(); reportFQ.PaperKind = System.Drawing.Printing.PaperKind.A4; string projectno = ProjectNOcomboBoxEdit.Text; string projectcode = ProjectCodecomboBoxEdit.Text; string buyno = BuyNOtextEdit.Text; string projectpurchaseer = SQLMethod.Count_dispatchdatatable()[0].projectleader; string branch = BranchtextEdit.Text; string project = SQLMethod.Count_dispatchdatatable()[0].ownername; string appdate = ApplicationdateEdit.Text; string buylimitdate = BuyLimitdateEdit.Text; string needdate = NeeddateEdit.Text; string pickup = PickuptextEdit.Text; string deliery = DeliverytextEdit.Text; bool devicecheck = false; bool materialcheck = false; bool constructioncheck = false; bool hangcheck = false; bool elsecheck = false; bool inagreement = false; bool noagreement = false; bool just = false; bool suggest = false; bool remark = checkEdit1.Checked; if (remark) { agreement = 1; } else { agreement = 0; } switch (comboBoxEdit1.SelectedIndex) { case 0: { devicecheck = true; } break; case 1: { materialcheck = true; } break; case 2: { constructioncheck = true; } break; case 3: { hangcheck = true; } break; case 4: { elsecheck = true; } break; } switch (comboBoxEdit2.SelectedIndex) { case 0: { inagreement = true; } break; case 1: { noagreement = true; } break; case 2: { just = true; } break; case 3: { suggest = true; } break; } reportFQ.Textchange(projectno, projectcode, buyno, projectpurchaseer, branch, project, appdate, buylimitdate, needdate, pickup, deliery, devicecheck, materialcheck, constructioncheck, hangcheck, elsecheck, inagreement, noagreement, just, suggest, remark); reportFQ.DataxrCrossTabChange(); reportFQ.CreateDocument(); documentViewer1.DocumentSource = reportFQ; #endregion #region 儲存進資料庫 pk = SQLMethod.Catch_signofflist().Count; if (pk != 0) { pk = pk + 1; } else { pk = 1; } countsignofflist = SQLMethod.Count_signofflist(ProjectCodecomboBoxEdit.Text, ProjectNOcomboBoxEdit.Text); if (countsignofflist.Count != 0) { string content = $"ProjectNO = '{projectno}',Code = '{projectcode.Substring(0, 1)}', ProjectCode = '{projectcode}',PurchaseNumber = '{buyno}',ApplicationSector = '{branch}',ApplicationDate = '{appdate}',PurchaseDate = '{buylimitdate}',NeedDate = '{needdate}',Receiver = '{pickup}',TradingLocation = '{deliery}',Content = '{comboBoxEdit1.Text}',Brand = '{comboBoxEdit2.Text}',[Check] = {agreement}"; SQLMethod.Update_signofflist(content, ProjectCodecomboBoxEdit.Text, ProjectNOcomboBoxEdit.Text); } else { string content = $"{pk},'{projectno}','{projectcode.Substring(0, 1)}', '{projectcode}','{buyno}','{branch}','{appdate}','{buylimitdate}','{needdate}','{pickup}','{deliery}','{comboBoxEdit1.Text}','{comboBoxEdit2.Text}',{agreement}"; SQLMethod.Insert_signofflist(content); } #endregion }