コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you want to save current record ? ", "Confirmation ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                int VoucherStatus = MyReceipt.GetReceiptStatus(txtRcptNumber.Text);
                switch (VoucherStatus)
                {
                case 2:
                    Program.InformationMessage("This is aproval payment voucher, cannot chage");
                    break;

                case 3:
                    Program.InformationMessage("Already Accounted, cannot chage");
                    break;

                default:
                    if (!MyReceipt.ExistReceipt(txtRcptNumber.Text))
                    {
                        REceiptTypes.ReceiptDataType _SaveHeader = new REceiptTypes.ReceiptDataType();
                        string respond = "";
                        string Rcpt    = "";
                        string SelItem = MyCommon.GetSelectedID(cmbPayFor, true);
                        if (SelItem == "5")
                        {
                            MyAccount.SaveotherPayee(cmbPayTo.Text, lblAddress.Text);
                        }
                        respond = SetHeaderDatatoClass(out _SaveHeader);
                        if (respond == "True")
                        {
                            respond = MyReceipt.Save(_SaveHeader, out Rcpt);
                            if (respond == "True")
                            {
                                txtRcptNumber.Text = Rcpt;
                                LoadExtPaymentList();
                                MessageBox.Show("Data Saved Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                txtRcptNumber.Text = "";
                                Program.VerningMessage(respond);
                            }
                        }
                    }
                    else
                    {
                        Program.VerningMessage("Use Update Button");
                    }
                    break;
                }
            }
        }