Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="strLedgerName"></param>
        /// <param name="decLedgerId"></param>
        /// <returns></returns>
        public bool AccountLedgerCheckExistence(String strLedgerName, decimal decLedgerId)
        {
            bool isStatus = false;

            try
            {
                isStatus = spAccountLedger.AccountLedgerCheckExistence(strLedgerName, decLedgerId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("AL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(isStatus);
        }
Exemple #2
0
        /// <summary>
        /// check if data present in database
        /// </summary>
        /// <returns></returns>
        public bool CheckAlreadyExist()
        {
            bool isOk = true;

            try
            {
                AccountLedgerSP spAccountledger = new AccountLedgerSP();
                int             inCompleteRow   = 0;
                int             inCurrentindex  = 0;
                string          strMessage      = "Row";
                foreach (DataGridViewRow dgvRow in dgvMultipleAccountLedger.Rows)
                {
                    if (dgvRow.Cells["dgvtxtLedgerName"].Value != null)
                    {
                        string LedgerName = dgvRow.Cells["dgvtxtLedgerName"].Value.ToString();
                        if (spAccountledger.AccountLedgerCheckExistence(LedgerName, 0) == true)
                        {
                            isOk = false;
                            if (inCompleteRow == 0)
                            {
                                strMessage     = strMessage + Convert.ToString(dgvRow.Index + 1);
                                inCurrentindex = dgvRow.Index;
                                inCompleteRow++;
                            }
                            else
                            {
                                strMessage = strMessage + ", " + Convert.ToString(dgvRow.Index + 1);
                            }
                        }
                    }
                }
                if (!isOk)
                {
                    strMessage = strMessage + " contains already exisitng ledgers. Do you want to continue?";
                    if (MessageBox.Show(strMessage, "OpenMiracle", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        isOk = true;
                        for (int inK = 0; inK < dgvMultipleAccountLedger.Rows.Count; inK++)
                        {
                            if (dgvMultipleAccountLedger.Rows[inK].Cells["dgvtxtLedgerName"].Value != null)
                            {
                                string strLedgerName = dgvMultipleAccountLedger.Rows[inK].Cells["dgvtxtLedgerName"].Value.ToString().Trim();
                                if (spAccountledger.AccountLedgerCheckExistence(strLedgerName, 0) == true)
                                {
                                    if (!dgvMultipleAccountLedger.Rows[inK].IsNewRow)
                                    {
                                        dgvMultipleAccountLedger.Rows.RemoveAt(inK);
                                        inK--;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        dgvMultipleAccountLedger.Rows[inCurrentindex].Cells["dgvtxtLedgerName"].Selected = true;
                        dgvMultipleAccountLedger.CurrentCell = dgvMultipleAccountLedger.Rows[inCurrentindex].Cells["dgvtxtLedgerName"];
                        dgvMultipleAccountLedger.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("MAL5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(isOk);
        }