コード例 #1
0
 internal static void smazStarouDavku(Session sesna, int extApp, string perioda, out bool dataSmazana, ref PLATCI_RESP resp)
 {
     dataSmazana = false;
     try
     {
         DBVal dbval = new DBVal(sesna);
         sesna.ExecuteNonQuery("delete from P_ODPADY_EULEVY where ZPRAC = 'A' and EA = " + extApp.ToString() +
                               " and ENTRYDATE < " + dbval.dbv.getCurrentDateTimeText + "-750");
         sesna.ExecuteNonQuery("delete from P_ODPADY_EULEVY where EA = " + extApp.ToString() + " and ZPRAC = 'E'" +
                               " and PER = '" + perioda + "'");
         dataSmazana = true;
     }
     catch (Exception e)
     {
         resp.result    = Result.ERROR;
         resp.status    = Status.ERROR;
         resp.ERRORMESS = string.Format("Odmazání starých dat neproběhlo. \n {0}", e.Message);
     }
 }
コード例 #2
0
        public int LIZNI_SEQ(string sequence)
        {
            DBVal         dbv  = new DBVal(sesna);
            IDBValFactory idbv = dbv.CreateDBV();
            int           ID   = 0;

            if (idbv.Database == typeof(MSSQL))
            {
                if (sequence == "PRPL_ID")
                {
                    sequence = "P_SEQUENCE_PRPL";
                }
                if (sequence == "PLATBA_ID")
                {
                    sequence = "P_SEQUENCE_PLATBA";
                }
                DevExpress.Xpo.DB.SelectedData selData = sesna.ExecuteSproc("LIZNI_SEQ", new OperandValue(sequence));
                ID = Convert.ToInt32(selData.ResultSet[0].Rows[0].Values[0]);
            }

            if (idbv.GetType() == typeof(ORACLE))
            {
                if (sequence == "PRPL_ID")
                {
                    sequence = "P_SEQ_PRPL_ID";
                }
                if (sequence == "PLATBA_ID")
                {
                    sequence = "P_SEQ_PLATBA_ID";
                }
                object obj = sesna.ExecuteScalar("select " + sequence + ".Nextval ID from dual");
                ID = Convert.ToInt32(obj);
            }

            if (ID == 0)
            {
                throw new Exception(String.Format("chyba při čtení hodnoty sequence {0}", sequence));
            }

            return(ID);
        }