Exemplo n.º 1
0
        public Int32 insert(ExternalDesignation oExternal)
        {
            String     oSql     = "SP_INSERTEXTERNAL_DESIGNATION";
            SqlCommand oCommand = new SqlCommand(oSql);

            oCommand.CommandType = CommandType.StoredProcedure;
            oCommand.Parameters.AddWithValue("@ID", oExternal.code);
            oCommand.Parameters.AddWithValue("@TEACHER_ID", oExternal.oTeacher.code);
            oCommand.Parameters.AddWithValue("@LOCATION", oExternal.location);
            oCommand.Parameters.AddWithValue("@POSITION", oExternal.position);
            oCommand.Parameters.AddWithValue("@HOURS", oExternal.hours);
            oCommand.Parameters.AddWithValue("@INITIAL_DATE", oExternal.initial_day);
            oCommand.Parameters.AddWithValue("@FINAL_DATE", oExternal.final_day);
            try
            {
                DAO.getInstance().executeSQL(oCommand);
            }
            catch (Exception)
            {
                throw;
            }



            for (int i = 0; i < oExternal.journeys.Count; i++)
            {
                int        Codejourney = JourneyBLL.getInstance().getNextCode();
                String     oSql2       = "SP_INSERTJOURNEY";
                SqlCommand oCommand2   = new SqlCommand(oSql2);
                oCommand2.CommandType = CommandType.StoredProcedure;
                oCommand2.Parameters.AddWithValue("@ID", Codejourney);
                oCommand2.Parameters.AddWithValue("@DAY_ID", oExternal.journeys[i].day.code);
                oCommand2.Parameters.AddWithValue("@START", oExternal.journeys[i].start);
                oCommand2.Parameters.AddWithValue("@FINISH", oExternal.journeys[i].finish);
                try
                {
                    DAO.getInstance().executeSQL(oCommand2);
                }
                catch (Exception)
                {
                    throw;
                }

                String     oSql3     = "SP_INSERTEXTERNALDESIGNATION_JOURNEY";
                SqlCommand oCommand3 = new SqlCommand(oSql3);
                oCommand3.CommandType = CommandType.StoredProcedure;
                oCommand3.Parameters.AddWithValue("@IDEXTERNAL", oExternal.code);
                oCommand3.Parameters.AddWithValue("@IDJOURNEY", Codejourney);
                try
                {
                    DAO.getInstance().executeSQL(oCommand3);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(0);
        }
Exemplo n.º 2
0
 public static JourneyBLL getInstance()
 {
     if (instace == null)
     {
         instace = new JourneyBLL();
     }
     return(instace);
 }