Exemple #1
0
        /// <summary>
        /// 刪除資料庫的某一筆資料
        /// </summary>
        private void RunDeleteData()
        {
            My.MyDatabase MyDb = new My.MyDatabase();
            SIS.Configuration.ClsManufacturerConfig CMC = new Configuration.ClsManufacturerConfig();
            CMC.ManufacturerID    = txtManufacturerID.Text;
            CMC.CNAME             = txtCNAME.Text;
            CMC.ENAME             = txtENAME.Text;
            CMC.UnifiedBusinessNo = mtbUnifiedBusinessNo.Text;

            SIS.DBClass.DBClassManufacturerInfo DBCMI = new DBClass.DBClassManufacturerInfo();

            if (MyDb.AuthPK(CMC.ManufacturerID, "ManufacturerID", "ManufacturerInfo") == true)
            {
                if (DBCMI.DeleteOneData(CMC.ManufacturerID))
                {
                    MessageBox.Show("刪除[" + CMC.ManufacturerID + "-" + CMC.CNAME +
                                    "]公司資料成功", "刪除廠商資料", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadDefaultValue();
                }
                else
                {
                    MessageBox.Show("刪除[" + CMC.ManufacturerID + "-" + CMC.CNAME +
                                    "]公司資料失敗", "刪除廠商資料", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("對不起,資料庫不存在[ " + CMC.ManufacturerID + "-" + CMC.CNAME +
                                " ]廠商資料!!(資料不存在)", "資料刪除");
            }
        }
Exemple #2
0
        /// <summary>
        /// 更新資料庫資料
        /// </summary>
        private void RunUpdateData()
        {
            My.MyDatabase MyDb = new My.MyDatabase();
            SIS.Configuration.ClsManufacturerConfig CMC = new Configuration.ClsManufacturerConfig();
            CMC.ManufacturerID    = txtManufacturerID.Text;
            CMC.CNAME             = txtCNAME.Text;
            CMC.ENAME             = txtENAME.Text;
            CMC.UnifiedBusinessNo = mtbUnifiedBusinessNo.Text;
            CMC.Owner             = txtOwner.Text;
            CMC.Contact           = txtContact.Text;
            CMC.Phone             = mtbPhone.Text;
            CMC.MobilePhone       = mtbMobilePhone.Text;
            CMC.Fax     = mtbFax.Text;
            CMC.Address = txtAddress.Text;
            CMC.WebSite = txtWebSite.Text;
            CMC.Notes   = rtbNotes.Text;

            SIS.DBClass.DBClassManufacturerInfo DBCMI = new DBClass.DBClassManufacturerInfo();

            if (MyDb.AuthPK(CMC.ManufacturerID, "ManufacturerID", "ManufacturerInfo") == true)
            {
                if (DBCMI.Update(CMC))
                {
                    MessageBox.Show("更新[" + CMC.ManufacturerID + "-" + CMC.CNAME +
                                    "]公司資料成功", "更新廠商資料", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadDefaultValue();
                }
                else
                {
                    MessageBox.Show("更新[" + CMC.ManufacturerID + "-" + CMC.CNAME +
                                    "]廠商資料失敗", "更新廠商資料", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("對不起,資料庫不存在[ " + CMC.ManufacturerID + "-" + CMC.CNAME +
                                " ]廠商資料!!(資料重複)", "資料更新");
            }
        }