Ejemplo n.º 1
0
        private void RunDeleteData()
        {
            My.MyDatabase MyDb = new My.MyDatabase();
            SIS.Configuration.ClsCustomerConfig CCC = new Configuration.ClsCustomerConfig();
            CCC.CustomerID = txtCustomerID.Text;
            CCC.CNAME      = txtCNAME.Text;


            SIS.DBClass.DBClassCustomerInfo DBCCI = new DBClass.DBClassCustomerInfo();

            if (MyDb.AuthPK(CCC.CustomerID, "CustomerID", "CustomerInfo") == true)
            {
                if (DBCCI.DeleteOneData(CCC.CustomerID))
                {
                    MessageBox.Show("刪除[" + CCC.CustomerID + "-" + CCC.CNAME +
                                    "]客戶資料成功", "刪除客戶資料", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadDefaultValue();
                }
                else
                {
                    MessageBox.Show("刪除[" + CCC.CustomerID + "-" + CCC.CNAME +
                                    "]客戶資料失敗", "刪除客戶資料", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("對不起,資料庫不存在[ " + CCC.CustomerID + "-" + CCC.CNAME +
                                " ]客戶資料!!(資料重複)", "資料刪除");
            }
        }
Ejemplo n.º 2
0
        private void RunUpdateData()
        {
            My.MyDatabase MyDb = new My.MyDatabase();
            SIS.Configuration.ClsCustomerConfig CCC = new Configuration.ClsCustomerConfig();
            CCC.CustomerID = txtCustomerID.Text;
            CCC.CNAME      = txtCNAME.Text;
            CCC.ENAME      = txtENAME.Text;

            CCC.Photos = My.MyMethod.ImageToByte(PicPhotos.Image);

            CCC.Birthday     = dtpBirthday.Value.ToString("yyyy年MM月dd日");
            CCC.CustomerType = cboCustomerType.Text;
            CCC.Phone        = mtbPhone.Text;
            CCC.MobilePhone  = mtbMobilePhone.Text;
            CCC.Fax          = mtbFax.Text;
            CCC.Address      = txtAddress.Text;
            CCC.Notes        = rtbNotes.Text;

            SIS.DBClass.DBClassCustomerInfo DBCCI = new DBClass.DBClassCustomerInfo();

            if (MyDb.AuthPK(CCC.CustomerID, "CustomerID", "CustomerInfo") == true)
            {
                if (DBCCI.ParameterUpdateData(CCC))
                {
                    MessageBox.Show("更新[" + CCC.CustomerID + "-" + CCC.CNAME +
                                    "]客戶資料成功", "更新客戶資料", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadDefaultValue();
                }
                else
                {
                    MessageBox.Show("更新[" + CCC.CustomerID + "-" + CCC.CNAME +
                                    "]客戶資料失敗", "更新客戶資料", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("對不起,資料庫不存在[ " + CCC.CustomerID + "-" + CCC.CNAME +
                                " ]客戶資料!!(資料不存在)", "資料更新");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 將資料寫入資料庫中
        /// </summary>
        private void RunInsertData()
        {
            My.MyDatabase MyDb = new My.MyDatabase();
            SIS.Configuration.ClsCustomerConfig CCC = new Configuration.ClsCustomerConfig();
            CCC.CustomerID = txtCustomerID.Text;
            CCC.CNAME      = txtCNAME.Text;
            CCC.ENAME      = txtENAME.Text;
            string FilePath = Application.StartupPath + "\\Photos\\Customer\\" + "NoPicture.bmp";

            CCC.Photos       = My.MyFileIO.FileToByteArray(FilePath);
            CCC.Birthday     = dtpBirthday.Value.ToString("yyyy年MM月dd日");
            CCC.CustomerType = cboCustomerType.Text;
            CCC.Phone        = mtbPhone.Text;
            CCC.MobilePhone  = mtbMobilePhone.Text;
            CCC.Fax          = mtbFax.Text;
            CCC.Address      = txtAddress.Text;
            CCC.Notes        = rtbNotes.Text;

            SIS.DBClass.DBClassCustomerInfo DBCCI = new DBClass.DBClassCustomerInfo();

            if (MyDb.AuthPK(CCC.CustomerID, "CustomerID", "CustomerInfo") == false)
            {
                if (DBCCI.ParameterInsertData(CCC))
                {
                    MessageBox.Show("新增[" + CCC.CustomerID + "-" + CCC.CNAME +
                                    "]客戶資料成功", "新增客戶資料", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadDefaultValue();
                }
                else
                {
                    MessageBox.Show("新增[" + CCC.CustomerID + "-" + CCC.CNAME +
                                    "]客戶資料失敗", "新增客戶資料", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("對不起,資料庫已存在[ " + CCC.CustomerID + "-" + CCC.CNAME +
                                " ]客戶資料!!(資料重複)", "資料新增");
            }
        }