Exemplo n.º 1
0
        private void RunDeleteData()
        {
            try
            {
                My.MyDatabase MyDb = new My.MyDatabase();
                SIS.Configuration.ClsReversalConfig CRC = new Configuration.ClsReversalConfig();
                CRC.ReversalID = txtReversalID.Text;

                SIS.DBClass.DBClassReversal DBCR = new DBClass.DBClassReversal();

                if (MyDb.AuthPK(CRC.ReversalID, "ReversalID", "Reversal") == true)
                {
                    if (DBCR.DeleteOneData(CRC.ReversalID))
                    {
                        MessageBox.Show("刪除[" + CRC.ReversalID +
                                        "]沖銷單資料成功", "刪除沖銷單資料", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadDefaultValue();
                    }
                    else
                    {
                        MessageBox.Show("刪除[" + CRC.ReversalID +
                                        "]沖銷單資料失敗", "刪除沖銷單資料", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("對不起,資料庫不存在[ " + CRC.ReversalID +
                                    " ]沖銷單資料!!(資料不存在)", "資料刪除");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("錯誤訊息:" + ex.Message.ToString(), "發生例外");
            }
        }
Exemplo n.º 2
0
        //查詢
        private void tsbQuery_Click(object sender, EventArgs e)
        {
            string Msg = "是否要進行沖銷單[" + txtReversalID.Text + "]查詢動作?\r\n";


            DialogResult DR;

            DR = MessageBox.Show(Msg, "查詢沖銷單", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (DR == DialogResult.Yes)
            {
                if (CheckField())
                {
                    SIS.DBClass.DBClassReversal         DBCR = new DBClass.DBClassReversal();
                    SIS.Configuration.ClsReversalConfig CRC  = new Configuration.ClsReversalConfig();

                    bool result = DBCR.QueryData(txtReversalID.Text, CRC);
                    if (result)
                    {
                        MessageBox.Show("有找到沖銷單號:[" + txtReversalID.Text + "]資料!\r\n是否將沖銷單資料載入?", "搜尋結果", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (DR == DialogResult.Yes)
                        {
                            txtReversalID.Text    = CRC.ReversalID;
                            dtpReversalDate.Text  = CRC.ReversalDate;
                            cboReversalStaff.Text = CRC.ReversalStaff;

                            if (CRC.ReversalType == "Customer")
                            {
                                //SIS.DBClass.DBClassCustomerInfo DBCCI = new DBClass.DBClassCustomerInfo();
                                // string CNAME = DBCCI.QueryData(CRC.CustomerOrManufacturer,"CNAME");
                                txtCustomerOrManufacturer.Text = CRC.CustomerOrManufacturer;
                                rdoReversalShip.Checked        = true;
                            }
                            else
                            {
                                //SIS.DBClass.DBClassManufacturerInfo DBCMI = new DBClass.DBClassManufacturerInfo();
                                //string CNAME = DBCMI.QueryData(CRC.CustomerOrManufacturer, "CNAME");
                                txtCustomerOrManufacturer.Text = CRC.CustomerOrManufacturer;
                                rdoReversalStock.Checked       = true;
                            }

                            txtStockIDOrShipID.Text = CRC.StockIDOrShipID;
                            txtPaymentAmount.Text   = CRC.PaymentAmount.ToString();
                            mtbReversalAmount.Text  = CRC.ReversalAmount.ToString();
                            cbxIsReversal.Checked   = CRC.IsReversal;
                            cboPaymentType.Text     = My.MyMethod.SearchComboBoxItems(cboPaymentType, CRC.PaymentType);
                            rtbNotes.Text           = CRC.Notes;
                        }
                    }
                    else
                    {
                        MessageBox.Show("沒有找到沖銷單號:[" + txtReversalID.Text + "]資料!", "搜尋結果");
                    }
                }
            }
            else
            {
                MessageBox.Show("取消沖銷單查詢動作!!", "查詢沖銷單");
            }
        }
Exemplo n.º 3
0
        private void RunUpdateData()
        {
            try
            {
                My.MyDatabase MyDb = new My.MyDatabase();
                SIS.Configuration.ClsReversalConfig CRC = new Configuration.ClsReversalConfig();
                CRC.ReversalID    = txtReversalID.Text;
                CRC.ReversalDate  = dtpReversalDate.Value.ToString("yyyy年MM月dd日");
                CRC.ReversalStaff = cboReversalStaff.Text;
                if (rdoReversalShip.Checked == true)
                {
                    CRC.ReversalType = "Customer";
                }
                else
                {
                    CRC.ReversalType = "Manufacturer";
                }

                CRC.CustomerOrManufacturer = txtCustomerOrManufacturer.Text;
                CRC.StockIDOrShipID        = txtStockIDOrShipID.Text;
                CRC.PaymentAmount          = int.Parse(txtPaymentAmount.Text);
                CRC.ReversalAmount         = int.Parse(mtbReversalAmount.Text);
                CRC.IsReversal             = cbxIsReversal.Checked;
                CRC.PaymentType            = cboPaymentType.Text.Split('-')[1];
                CRC.Notes = rtbNotes.Text.Replace("'", "''");

                SIS.DBClass.DBClassReversal DBCR = new DBClass.DBClassReversal();

                if (MyDb.AuthPK(CRC.ReversalID, "ReversalID", "Reversal") == true)
                {
                    if (DBCR.Update(CRC))
                    {
                        MessageBox.Show("更新[" + CRC.ReversalID +
                                        "]沖銷單資料成功", "更新沖銷單資料", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadDefaultValue();
                    }
                    else
                    {
                        MessageBox.Show("更新[" + CRC.ReversalID +
                                        "]沖銷單資料失敗", "更新沖銷單資料", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("對不起,資料庫不存在[ " + CRC.ReversalID +
                                    " ]沖銷單資料!!(資料不存在)", "資料更新");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("錯誤訊息:" + ex.Message.ToString(), "發生例外");
            }
        }
Exemplo n.º 4
0
 //列印
 private void tsbPrint_Click(object sender, EventArgs e)
 {
     if (CheckField())
     {
         SIS.DBClass.DBClassReversal DBCR = new DBClass.DBClassReversal();
         bool result = DBCR.QueryData(txtReversalID.Text);
         if (result)
         {
             FrmReportPrint FRP = new FrmReportPrint("ReversalID", txtReversalID.Text, "rptReversal");
             FRP.ShowDialog();
         }
         else
         {
             MessageBox.Show("沒有找到沖銷單號:[" + txtReversalID.Text + "]資料,無法列印!", "列印結果");
         }
     }
 }