private void RunDeleteData() { My.MyDatabase MyDb = new My.MyDatabase(); SIS.Configuration.ClsCompanyConfig CCC = new Configuration.ClsCompanyConfig(); CCC.CompanyID = txtCompanyID.Text; CCC.CNAME = txtCNAME.Text; CCC.ENAME = txtENAME.Text; CCC.UnifiedBusinessNo = mtbUnifiedBusinessNo.Text; SIS.DBClass.DBClassCompanyInfo DBCCI = new DBClass.DBClassCompanyInfo(); if (MyDb.AuthPK(CCC.CompanyID, "CompanyID", "CompanyInfo") == true) { if (DBCCI.DeleteOneData(CCC.CompanyID)) { MessageBox.Show("刪除[" + CCC.CompanyID + "-" + CCC.CNAME + "]公司資料成功", "刪除公司資料", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadDefaultValue(); } else { MessageBox.Show("刪除[" + CCC.CompanyID + "-" + CCC.CNAME + "]公司資料失敗", "刪除公司資料", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("對不起,資料庫不存在[ " + CCC.CompanyID + "-" + CCC.CNAME + " ]公司資料!!(資料不存在)", "資料刪除"); } }
private void RunUpdateData() { My.MyDatabase MyDb = new My.MyDatabase(); SIS.Configuration.ClsCompanyConfig CCC = new Configuration.ClsCompanyConfig(); CCC.CompanyID = txtCompanyID.Text; CCC.CNAME = txtCNAME.Text; CCC.ENAME = txtENAME.Text; CCC.UnifiedBusinessNo = mtbUnifiedBusinessNo.Text; CCC.CompanyType = cboCompanyType.Text; CCC.Owner = txtOwner.Text; CCC.Contact = txtContact.Text; CCC.Phone = mtbPhone.Text; CCC.MobilePhone = mtbMobilePhone.Text; CCC.Fax = mtbFax.Text; CCC.Address = txtAddress.Text; CCC.WebSite = txtWebSite.Text; CCC.Notes = rtbNotes.Text; SIS.DBClass.DBClassCompanyInfo DBCCI = new DBClass.DBClassCompanyInfo(); if (MyDb.AuthPK(CCC.CompanyID, "CompanyID", "CompanyInfo") == true) { if (DBCCI.Update(CCC)) { MessageBox.Show("更新[" + CCC.CompanyID + "-" + CCC.CNAME + "]公司資料成功", "更新公司資料", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadDefaultValue(); } else { MessageBox.Show("更新[" + CCC.CompanyID + "-" + CCC.CNAME + "]公司資料失敗", "更新公司資料", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("對不起,資料庫不存在[ " + CCC.CompanyID + "-" + CCC.CNAME + " ]公司資料!!(資料不存在)", "資料更新"); } }