Exemple #1
0
        public int Delete(DBConnection Connection, ref List <EXCEPTIONDC> lstExceptions, List <DAILYDC> objDAILs)
        {
            int deleteCount = 0;

            foreach (DAILYDC objDAIL in objDAILs)
            {
                try
                {
                    Connection.Open(true);
                    deleteCount = Delete(Connection, objDAIL);
                    Connection.Commit();
                }
                catch (Exception exp)
                {
                    EXCEPTIONDC objExcption = new EXCEPTIONDC();
                    objExcption.FIELD_ID          = objDAIL.DAILY_ID;
                    objExcption.EXCEPTION_MESSAGE = exp.Message;
                    objExcption.STACK_TRACK       = exp.StackTrace;
                    lstExceptions.Add(objExcption);
                }
                finally { Connection.Close(); }
            }

            return(deleteCount);
        }
Exemple #2
0
        public int Delete(DBConnection Connection, List <JOBDC> objMANAGE_JOBs, ref List <EXCEPTIONDC> lstExceptions)
        {
            int deleteCount = 0;

            try
            {
                foreach (JOBDC objMANAGE_JOB in objMANAGE_JOBs)
                {
                    try
                    {
                        Connection.Open(true);
                        deleteCount = Delete(Connection, objMANAGE_JOB);
                        Connection.Commit();
                    }
                    catch (Exception exp)
                    {
                        EXCEPTIONDC objExcption = new EXCEPTIONDC();
                        objExcption.FIELD_ID          = objMANAGE_JOB.JOB_ID;
                        objExcption.EXCEPTION_MESSAGE = exp.Message;
                        objExcption.STACK_TRACK       = exp.StackTrace;
                        lstExceptions.Add(objExcption);
                        Connection.Rollback();
                    }
                }
                if (lstExceptions.Count > 0)
                {
                    throw new Exception("Excption Occure");
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
            return(deleteCount);
        }
Exemple #3
0
        //public int Insert(DBConnection Connection, List<ErrorLogDC> objErrorLogs)
        //{
        //    int insertCount = 0;
        //    foreach (ErrorLogDC errLog in objErrorLogs)
        //    {
        //        insertCount = Insert(Connection, errLog);
        //    }
        //    return insertCount;
        //}
        public int Insert(ErrorLogDC objErrorLog)
        {
            DBConnection Connection = new DBConnection();

            Connection.Open(false);
            int insertCount = 0;

            try
            {
                if (objErrorLog.On == DateTime.MinValue)
                {
                    objErrorLog.On = DateTime.Now;
                }
                StringBuilder sql = new StringBuilder();
                sql.Append("proc_ErrorLogInsert");

                DBCommandWarpper dbCommandWrapper = new DBCommandWarpper(Connection.dataBase.GetStoredProcCommand(sql.ToString()), Connection);


                dbCommandWrapper.AddOutParameter("EL_ID", DbType.Int32, objErrorLog.ErrorLogID);
                dbCommandWrapper.AddInParameter("AU_ERROR_RECEIVER", DbType.Int32, objErrorLog.ErrorReceiver);
                dbCommandWrapper.AddInParameter("EL_ERROR_ON", DbType.DateTime, objErrorLog.On);
                dbCommandWrapper.AddInParameter("EL_ERROR_FROM", DbType.String, objErrorLog.From);
                dbCommandWrapper.AddInParameter("EL_ERROR_DESCRIP", DbType.String, objErrorLog.Description);



                if (Connection.Transaction != null)
                {
                    insertCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand, Connection.Transaction);
                }
                else
                {
                    insertCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand);
                }
                Connection.Commit();
                return(insertCount);
            }
            catch (Exception ex)
            {
                objErrorLog.SetError(ex);
                throw ex;
            }
        }