public OpeningJustification getJustification(Int32 pCode)
        {
            String sql = "SP_OPENINGJUSTIFCATION";

            try
            {
                SqlCommand oCommand = new SqlCommand(sql);
                oCommand.CommandType = System.Data.CommandType.StoredProcedure;
                oCommand.Parameters.AddWithValue("@ID", pCode);
                DataTable            oDataTable     = DAO.getInstance().executeQuery(oCommand);
                OpeningJustification oJustification = new OpeningJustification();
                AcademicOffer        oAcademic      = new AcademicOffer();
                Teacher             oTeacher        = new Teacher();
                Course              oCourse         = new Course();
                InternalDesignation oInternal       = new InternalDesignation();
                foreach (DataRow oDataRow in oDataTable.Rows)
                {
                    oAcademic.code                 = Convert.ToInt32(oDataRow[0].ToString());
                    oTeacher.name                  = oDataRow[1].ToString();
                    oTeacher.lastName              = oDataRow[2].ToString();
                    oInternal.description          = oDataRow[3].ToString();
                    oInternal.baseSalary           = Convert.ToDouble(oDataRow[4].ToString());
                    oInternal.annuity              = Convert.ToDouble(oDataRow[5].ToString());
                    oAcademic.price                = Convert.ToDecimal(oDataRow[6].ToString());
                    oAcademic.hours                = Convert.ToInt32(oDataRow[7].ToString());
                    oCourse.description            = oDataRow[8].ToString();
                    oInternal.code                 = Convert.ToInt32(oDataRow[9].ToString());
                    oAcademic.oteacher             = oTeacher;
                    oAcademic.oCourse              = oCourse;
                    oJustification.Anuality        = 0;
                    oJustification.CauntAnualities = 0;
                    oJustification.CCSS            = 0;
                    oJustification.Diference       = 0;
                    oJustification.Others          = 0;
                    oJustification.publicity       = 0;
                    oJustification.Salary          = 0;
                    oJustification.Students        = 0;
                    oJustification.TotalBimensual  = 0;
                    oJustification.TotalIncome     = 0;
                    oJustification.TotalMensual    = 0;
                    oJustification.oInternal       = oInternal;
                    oJustification.oAcademic       = oAcademic;
                }
                return(oJustification);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { }
        }
Exemple #2
0
        //to select all academics offer by program
        public List <Entities.AcademicOffer> getGridViewProgram(int code, int period)
        {
            String sql = "SP_SELECTPROGRAMGRIDVIEW";

            try
            {
                SqlCommand oCommand = new SqlCommand(sql);
                oCommand.CommandType = System.Data.CommandType.StoredProcedure;
                oCommand.Parameters.AddWithValue("@ID", code);
                oCommand.Parameters.AddWithValue("@PERIOD", period);
                DataTable            oDataTable        = DAO.getInstance().executeQuery(oCommand);
                List <AcademicOffer> listAcademicOffer = new List <AcademicOffer>();
                foreach (DataRow oDataRow in oDataTable.Rows)
                {
                    AcademicOffer oAcademic  = new AcademicOffer();
                    Course        oCourse    = new Course();
                    Teacher       oTeacher   = new Teacher();
                    Schedule      oSchedule  = new Schedule();
                    ClassRoom     oClassRoom = new ClassRoom();
                    Program       oProgram   = new Program();
                    Period        oPeriod    = new Period();

                    oAcademic.code         = Convert.ToInt32(oDataRow[0].ToString());
                    oCourse.description    = oDataRow[1].ToString();
                    oTeacher.name          = oDataRow[2].ToString();
                    oTeacher.lastName      = oDataRow[3].ToString();
                    oSchedule.name         = oDataRow[4].ToString();
                    oSchedule.typeSchedule = oDataRow[5].ToString();
                    oClassRoom.num_room    = oDataRow[6].ToString();
                    oAcademic.price        = Convert.ToDecimal(oDataRow[7].ToString());
                    oProgram.code          = Convert.ToInt32(oDataRow[8].ToString());
                    oProgram.name          = oDataRow[9].ToString();
                    oPeriod.code           = Convert.ToInt32(oDataRow[10].ToString());
                    oPeriod.name           = oDataRow[11].ToString();
                    oAcademic.oProgram     = oProgram;
                    oAcademic.oPeriod      = oPeriod;
                    oAcademic.oCourse      = oCourse;
                    oAcademic.oteacher     = oTeacher;
                    oAcademic.oSchedule    = oSchedule;
                    oAcademic.oClassRoom   = oClassRoom;
                    listAcademicOffer.Add(oAcademic);
                }
                return(listAcademicOffer);
            }
            catch (Exception)
            {
                throw;
            }
            finally { }
        }