コード例 #1
0
 private void FrmCreateCompany_onClose()
 {
     if (!LedgerTools.GetCashLedgers())
     {
         AddCashAccount frmAddCashAccount = new AddCashAccount();
         frmAddCashAccount.OnClose    += GenerateReport;
         frmAddCashAccount.WindowState = FormWindowState.Normal;
         frmAddCashAccount.ShowDialog();
     }
 }
コード例 #2
0
        private void DataSave()
        {
            string ledgerID       = Guid.NewGuid().ToString();
            string templeteName   = txtLedgerName.Text.GetDBFormatString();
            string mSubAccount    = "Cash A/C";
            string mParentAccount = "Current Assets";
            string mAccountType   = "NULL";
            double amountBalance  = 0d;

            double.TryParse(txtOpeningAmount.Text, out amountBalance);

            List <string> lstQuery = new List <string>();
            string        query    = "";

            if (mLedgerIdForUpdate.ISNullOrWhiteSpace())
            {
                query = "Insert into LadgerMain(LadgerID, LadgerName, TemplateName, Category, SubAccount, ParentAccount, Type)" +
                        "values('" + ledgerID + "','" + templeteName + "','" + templeteName + "','Cash','" +
                        mSubAccount + "','" + mParentAccount + "'," + mAccountType + ")";
                lstQuery.Add(query);
                query = "Insert into LedgerStatus( LedgerID, FinYearID, OpeningBalance, CurrentBalance) " +
                        "Values('" + ledgerID + "'," + FinancialYearTools._YearID + "," +
                        amountBalance + "," + amountBalance + ")";
                lstQuery.Add(query);
            }
            else
            {
                query = "Update LadgerMain set LadgerID='" + ledgerID + "',LadgerName='" + templeteName
                        + "',TemplateName='" + templeteName + "' where LadgerID='" + mLedgerIdForUpdate + "'";
                lstQuery.Add(query);
                query = "Update LedgerStatus set OpeningBalance=" + amountBalance + ", CurrentBalance=" +
                        amountBalance + " where LedgerID='" + ledgerID + "' and FinYearID=" + FinancialYearTools._YearID + "";
                lstQuery.Add(query);
            }
            if (SQLHelper.GetInstance().ExecuteTransection(lstQuery, out msg))
            {
                mIsSuccess = true;
                LedgerTools.GetCashLedgers();
                this.Close();
            }
            else
            {
                MessageBox.Show(msg + "\nData not save", "Add Account", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }