Пример #1
0
        public static bool DeleteJournal(string jid)
        {
            TSQLAccess sq = new TSQLAccess(DbConfig.GetConStr("MAINDB"));

            sq.Open();
            try
            {
                string qry = "delete from JournalMaster where j_id ='" + jid + "'";
                sq.ExecuteNonQuery(qry);
                qry = "delete from JournalDetail where j_id ='" + jid + "'";
                sq.ExecuteNonQuery(qry);

                sq.Close();
                return(true);
            }
            catch (Exception ex)
            {
                sq.Abort();
                return(false);
            }
        }
Пример #2
0
        private static bool DoPost(Journal j)
        {
            TSQLAccess sq = new TSQLAccess(DbConfig.GetConStr("MAINDB"));

            sq.Open();
            try
            {
                string qry = "insert into JournalMaster values('" + j.jid + "','JV','" + DateTime.Now + "',0,'" + j.narration + "')";
                sq.ExecuteNonQuery(qry);
                List <JournalEntry> je = j.rs;
                foreach (JournalEntry js in je)
                {
                    qry = "insert into JournalDetail values('" + j.jid + "','" + js.jcode + "','" + js.drcr + "'," + js.amount + ")";
                    sq.ExecuteNonQuery(qry);
                }
                sq.Close();
                return(true);
            }
            catch (Exception ex)
            {
                sq.Abort();
                return(false);
            }
        }