Exemplo n.º 1
0
        //GET
        public Class Get(int id)
        {
            Class            a     = null;
            OracleCommand    cmd   = null;
            string           query = @"SELECT C.idClass FROM Class C WHERE C.idClass = :classId";
            OracleDataReader dr    = null;

            try
            {
                cmd = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":classId", id);
                cmd.Parameters.AddRange(parameters1);
                dr = DBImplementation.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    a = new Class(int.Parse(dr[0].ToString()));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
                dr.Close();
            }
            return(a);
        }
Exemplo n.º 2
0
        public DataTable SelectTeacherAdd(string like)
        {
            string query = @"SELECT C.idClass,M.matterName SubjectName,CONCAT(CO.numberCourse,CO.letterCourse) Course,
(select  listagg(DAYSS, ', ') within group (order by DAYSS)
  FROM (SELECT DISTINCT S.DAY DAYSS FROM ClassSchedules CSS
    INNER JOIN Schedules S ON S.schedulesid= CSS.schedulesid
    WHERE CSS.idClass = C.idClass)) Days
FROM Class C INNER JOIN Matter M ON C.idMatter=M.idMatter
INNER JOIN Course CO ON CO.idCourse=C.idCourse 
WHERE (M.MATTERNAME LIKE :like)
OR CO.numberCourse||CO.letterCourse LIKE :like 
OR M.matterName||CO.numberCourse||CO.letterCourse LIKE :like
OR CO.numberCourse||CO.letterCourse||' '||M.matterName LIKE :like ) AND C.status=1";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter("@like", "%" + like + "%");
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 3
0
        //GET
        public Course Get(int id)
        {
            Course           a     = null;
            OracleCommand    cmd   = null;
            string           query = @"SELECT idCourse,numberCourse,letterCourse,section FROM Course WHERE idCourse= :Course";
            OracleDataReader dr    = null;

            try
            {
                cmd = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":Course", id);
                cmd.Parameters.AddRange(parameters1);

                dr = DBImplementation.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    a = new Course(int.Parse(dr[0].ToString()), int.Parse(dr[1].ToString()), dr[2].ToString(), dr[3].ToString());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
                dr.Close();
            }
            return(a);
        }
Exemplo n.º 4
0
        public Payer Get(string id)
        {
            Payer            a     = new Payer();
            OracleCommand    cmd   = null;
            string           query = @"SELECT IDPAYER ,NIT,BUSINESSNAME
    FROM PAYER WHERE NIT=:NIT";
            OracleDataReader dr    = null;

            try
            {
                cmd = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":NIT", id);
                cmd.Parameters.AddRange(parameters1);

                dr = DBImplementation.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    a.IdPayer      = int.Parse(dr[0].ToString());
                    a.Nit          = dr[1].ToString();
                    a.BusinessName = dr[2].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
                dr.Close();
            }
            return(a);
        }
Exemplo n.º 5
0
        //SelectDis
        public DataTable SelectDis()
        {
            string query = @" SELECT P.PersonId,
P.names Names,
P.lastName LastName, 
COALESCE(P.secondLastName,'') SecondLastName, 
P.addres Address,
P.phone Phone,
P.birthDate BirthDate,
P.gender Gender,
P.status Status,
P.registrationDate Registration,
NVL(TO_CHAR(P.updateDate),'1900-01-01') UpdateDate,
NVL(TO_CHAR(P.startDate),'1900-01-01') StartDate,
NVL(TO_CHAR(P.finishDate),'1900-01-01') FinishDate,
P.email Mail,
P.latitude Latitude,
P.longitude Longitude,
(SELECT C.CityName||'-'||PR.provinceName||','||T.townName
FROM Town T INNER JOIN Province PR ON PR.ProvinceId=T.ProvinceId 
INNER JOIN City C ON C.CityId=PR.CityId WHERE P.TownId=T.TownId) Location 
FROM Person P 
INNER JOIN Teacher T ON T.PersonId = P.Personid 
INNER JOIN USERACCOUNT U ON U.Personid=P.Personid  WHERE P.status=0 AND U.role='P'";

            try
            {
                OracleCommand cmd = DBImplementation.CreateBasicCommand(query);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 6
0
        public City GetPlace(byte id)
        {
            City          a   = null;
            OracleCommand cmd = null;

            OracleParameter[] parameters1 = new OracleParameter[1];
            string            query       = @"SELECT CityId, CityName,state FROM City WHERE CityId=:CityId";
            OracleDataReader  dr          = null;

            try
            {
                cmd            = DBImplementation.CreateBasicCommand(query);
                parameters1[0] = new OracleParameter(":CityId", id);
                cmd.Parameters.AddRange(parameters1);

                dr = DBImplementation.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    a = new City(byte.Parse(dr[0].ToString()), dr[1].ToString(), byte.Parse(dr[2].ToString()));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
                dr.Close();
            }
            return(a);
        }
Exemplo n.º 7
0
        public DataTable SelectTeacherAdd(int id)
        {
            string query = @"SELECT DISTINCT C.idClass,M.matterName SubjectName,CO.numberCourse||CO.letterCourse Course,
(select  listagg(DAYSS, ', ') within group (order by DAYSS)
  FROM (SELECT DISTINCT S.DAY DAYSS FROM ClassSchedules CSS
    INNER JOIN Schedules S ON S.schedulesid= CSS.schedulesid
    WHERE CSS.idClass = C.idClass)) Days
 FROM Class C INNER JOIN ClassSchedules CS ON CS.idClass=C.idClass
 INNER JOIN Matter M ON M.idMatter=C.idMatter
  INNER JOIN Course CO ON CO.idCourse=C.idCourse
WHERE C.status=1 AND ( C.idClass  NOT IN
(SELECT DISTINCT CS.idClass FROM ClassSchedules CS INNER JOIN Class C ON C.idClass=CS.idClass
WHERE CS.schedulesid IN(SELECT CS.schedulesid
  FROM Teacher T
  INNER JOIN Class CL ON CL.teacherid=T.teacherid
  INNER JOIN ClassSchedules CS ON CS.idClass=CL.idClass
  WHERE T.teacherid=:Teacher)))";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":Teacher", id);
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 8
0
        //Get
        public Horario Get(byte id)
        {
            Horario          a     = null;
            OracleCommand    cmd   = null;
            string           query = @"SELECT timeTableId, hourStart, hourFinish, ISNULL(updateDate,0), status, registrationDate, day
                            FROM timetable
                            WHERE timeTableId = :timeTableId";
            OracleDataReader dr    = null;

            try
            {
                cmd = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":timeTableId", id);
                cmd.Parameters.AddRange(parameters1);
                dr = DBImplementation.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    a = new Horario(byte.Parse(dr[0].ToString()), DateTime.Parse(dr[1].ToString()), DateTime.Parse(dr[2].ToString()), DateTime.Parse(dr[3].ToString()), byte.Parse(dr[4].ToString()), DateTime.Parse(dr[5].ToString()), dr[6].ToString());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
                dr.Close();
            }
            return(a);
        }
Exemplo n.º 9
0
        public DataTable Selectjue(int idcourse)
        {
            string query = @"SELECT schedulesid,
CASE WHEN schedulesid NOT IN 
(SELECT CS.schedulesid FROM ClassSchedules CS
INNER JOIN Class C ON C.idClass=CS.idClass
INNER JOIN Course CO ON CO.idCourse=C.idCourse
WHERE  CO.idCourse= :course AND C.status>0) 
THEN 'O'
ELSE 'X'
END AS TH,hourStart,hourFinish
FROM Schedules
WHERE day='Thursday'";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":course", idcourse);
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 10
0
        public Person Get(int id)
        {
            Person a = null;
            OracleCommand cmd = null;
            string query = @"SELECT P.Personid, P.names, P.lastName, COALESCE(P.secondLastName,''), P.addres, P.phone, P.birthDate,P.gender,P.status,P.registrationDate,NVL(P.updateDate,'01/01/1900'),P.startDate,NVL(P.finishDate,'01/01/1900'),P.email, P.latitude, P.longitude, P.TownId,P.photo FROM Person P INNER JOIN Users U ON U.PersonId=P.Personid WHERE U.UserId= :PersonId";
            OracleDataReader dr = null;
            try
            {
                cmd = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":PersonId", id);
                cmd.Parameters.AddRange(parameters1);
                dr = DBImplementation.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    a = new Person(int.Parse(dr[0].ToString()), dr[1].ToString(), dr[2].ToString(), dr[3].ToString(), dr[4].ToString(), dr[5].ToString(), DateTime.Parse(dr[6].ToString()), dr[7].ToString(), byte.Parse(dr[8].ToString()), DateTime.Parse(dr[9].ToString()), DateTime.Parse(dr[10].ToString()), DateTime.Parse(dr[11].ToString()), DateTime.Parse(dr[12].ToString()), dr[13].ToString(), Convert.ToDouble(dr[14].ToString()), Convert.ToDouble(dr[15].ToString()), byte.Parse(dr[16].ToString()), dr[17].ToString());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
                dr.Close();
            }
            return a;
        }
Exemplo n.º 11
0
        public Person GetPass(string user)
        {
            Person a = null;
            OracleCommand cmd = null;
            string query = @"SELECT P.email,U.UserId FROM Users U INNER JOIN Person P ON P.Personid=U.Personid WHERE U.userName= :User";
            OracleDataReader dr = null;
            try
            {
                cmd = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":User", user);
                cmd.Parameters.AddRange(parameters1);
                dr = DBImplementation.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    a = new Person(dr[0].ToString(),int.Parse(dr[1].ToString()));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
                dr.Close();
            }
            return a;
        }
Exemplo n.º 12
0
        public DataTable SelectSpecificStudentSchedule(int iduser, string day)
        {
            string query = @"SELECT 
COALESCE((SELECT M.matterName FROM ClassSchedules CS 
INNER JOIN Class C ON C.idClass=CS.idClass
INNER JOIN Matter M ON M.idMatter=C.idMatter
INNER JOIN Course CO ON CO.idCourse=C.idCourse
INNER JOIN Student ST ON ST.idCourse=CO.idCourse
INNER JOIN Person P ON P.Personid=ST.PersonId
INNER JOIN USERACCOUNT U ON U.Personid=P.Personid
WHERE U.UserId= :useraccount AND CS.schedulesid=S.schedulesid AND C.status=2),'') AS " + day + @"
FROM Schedules S
WHERE S.DAY= :dayss";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[2];

                parameters1[0] = new OracleParameter(":useraccount", iduser);
                parameters1[1] = new OracleParameter(":dayss", day);
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw; }
        }
Exemplo n.º 13
0
        public Town GetPlace(byte id)
        {
            Town             a     = null;
            OracleCommand    cmd   = null;
            string           query = @"SELECT TownId, townName,ProvinceId FROM Town WHERE TownId= :townName";
            OracleDataReader dr    = null;

            try
            {
                cmd = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":townName", id);
                cmd.Parameters.AddRange(parameters1);

                dr = DBImplementation.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    a = new Town(byte.Parse(dr[0].ToString()), dr[1].ToString(), byte.Parse(dr[2].ToString()), byte.Parse(dr[3].ToString()));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
                dr.Close();
            }
            return(a);
        }
Exemplo n.º 14
0
        public DataTable SelectDislike(int id, string like)
        {
            string query = @"SELECT P.Personid
      , P.names ,P.lastName
      ,P.secondLastName ,S.rudeNumber,P.email,P.gender,P.phone ,P.addres   ,P.birthDate ,
	  P.status , P.registrationDate
      ,P.updateDate ,P.startDate,P.finishDate,(SELECT C.CityName||'-'||PP.provinceName||', '||T.townName
	  FROM Town T INNER JOIN Province PP ON PP.ProvinceId=T.ProvinceId
	  INNER JOIN City C ON C.CityId=PP.CityId WHERE T.TownId=P.TownId),P.photo ,
	  S.studentId
      FROM Person P left JOIN Student S ON S.PersonId = P.PersonId WHERE S.idCourse = :Course AND P.names||' '||P.lastName||' '||P.secondLastName like :likes
 AND P.status=0";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[2];

                parameters1[0] = new OracleParameter(":Course", id);
                parameters1[1] = new OracleParameter(":likes", "%" + like + "%");
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 15
0
        public Town GetID(string id, string id2, string id3)
        {
            Town             a     = null;
            OracleCommand    cmd   = null;
            string           query = @"SELECT DISTINCT T.TownId FROM Town T INNER JOIN Province P ON T.ProvinceId=(SELECT ProvinceId FROM Province WHERE provinceName = :ProvinceName) INNER JOIN City C ON (SELECT CityId FROM Province WHERE provinceName= :ProvinceName)=(SELECT CityId FROM City WHERE CityName= :CityName) where t.townName= :townName";
            OracleDataReader dr    = null;

            try
            {
                cmd = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[3];

                parameters1[0] = new OracleParameter(":CityName", id);
                parameters1[1] = new OracleParameter(":ProvinceName", id2);
                parameters1[2] = new OracleParameter(":townName", id3);
                cmd.Parameters.AddRange(parameters1);

                dr = DBImplementation.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    a = new Town(byte.Parse(dr[0].ToString()));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
                dr.Close();
            }
            return(a);
        }
Exemplo n.º 16
0
        public Dosage Get()
        {
            Dosage           a     = new Dosage();
            OracleCommand    cmd   = null;
            string           query = @"SELECT IDDOSAGE,NROAUTHORIZATION,DOSAGEKEY,COALESCE(FINALNUMBER,0) FROM DOSAGE WHERE STATUS>0";
            OracleDataReader dr    = null;

            try
            {
                cmd = DBImplementation.CreateBasicCommand(query);
                dr  = DBImplementation.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    a.IdDosage         = int.Parse(dr[0].ToString());
                    a.NroAuthorization = long.Parse(dr[1].ToString());
                    a.DosageKey        = dr[2].ToString();
                    a.FinalNumber      = int.Parse(dr[2].ToString());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
                dr.Close();
            }
            return(a);
        }
Exemplo n.º 17
0
        public DataTable SelectList()
        {
            string query = "SELECT DISTINCT CityId id, CityName name FROM City  ";

            try
            {
                OracleCommand cmd = DBImplementation.CreateBasicCommand(query);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 18
0
        public DataTable Select()
        {
            string query = "SELECT CITYID AS ID, CITYNAME AS NAME FROM CITY WHERE STATE=1";

            try
            {
                OracleCommand cmd = DBImplementation.CreateBasicCommand(query);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 19
0
        //SELECT
        public DataTable Select()
        {
            string query = @"SELECT idCourse,numberCourse||letterCourse Course,section Section,
status Status, registrationDate Registration,NVL(updateDate, '01-01-1993') UpdateDate FROM Course";

            try
            {
                OracleCommand cmd = DBImplementation.CreateBasicCommand(query);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 20
0
        //Select
        public DataTable Select()
        {
            string query = "SELECT * FROM timetable WHERE status=1";

            try
            {
                OracleCommand cmd = DBImplementation.CreateBasicCommand(query);

                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 21
0
        public DataTable Selectlike(string like)
        {
            string query = "SELECT idCourse,numberCourse||letterCourse Course,section Section,status Status,registrationDate Registration,updateDate UpdateDate FROM Course WHERE numberCourse||letterCourse LIKE :likes OR section LIKE :likes OR numberCourse||letterCourse||section LIKE :likes OR numberCourse||letterCourse||' '||section LIKE :likes";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":likes", "%" + like + "%");
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 22
0
        public DataTable SelectList(int id)
        {
            string query = "SELECT DISTINCT ProvinceId id, provinceName name,CityId city FROM Province  WHERE CityId=(SELECT CityId FROM Province WHERE ProvinceId= :province)";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":province", id);
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 23
0
        //SELECT
        public DataTable Selectasd(int idcourse)
        {
            string query = @"SELECT idMatter,matterName FROM Matter WHERE (idMatter NOT IN(SELECT idMatter FROM Class WHERE idCourse= 21 AND status>0))";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":course", idcourse);
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 24
0
        public DataTable Select(string id)
        {
            string query = "SELECT PROVINCEID, PROVINCENAME FROM Province WHERE STATE=1 and CITYID=:CityId";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":CityId", int.Parse(id));
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 25
0
        public DataTable Select(string id)
        {
            string query = "SELECT TOWNID ID, TOWNNAME NAME FROM Town  WHERE PROVINCEID=:ProvinceName";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":ProvinceName", int.Parse(id));
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 26
0
        public DataTable SelectTotal(int idclass)
        {
            string query = @"select * from AverageGradeTotal WHERE idAverage= :tot";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":tot", idclass);
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw; }
        }
Exemplo n.º 27
0
        //SELECT STUDENTLIST
        public DataTable SelectStudents(int id)
        {
            string query = @"SELECT STUDENTID FROM STUDENT WHERE IDCOURSE= :Course";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":Course", id);
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 28
0
        public DataTable SelectList(int id)
        {
            string query = "SELECT DISTINCT [TownId] as 'id', TownName as 'name',ProvinceId as 'province' FROM Town  WHERE ProvinceId=(SELECT ProvinceId FROM Town WHERE TownId= :Town)";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":Town", id);
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 29
0
        public DataTable SelectSubjects(int id)
        {
            string query = @"SELECT C.idClass FROM Class C 
  WHERE C.idCourse= :Course AND C.status>0 ";

            try
            {
                OracleCommand     cmd         = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[1];

                parameters1[0] = new OracleParameter(":Course", id);
                cmd.Parameters.AddRange(parameters1);
                return(DBImplementation.ExecuteDataTableCommand(cmd));
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 30
0
        public int Update(Person t)
        {
            string query = @"UPDATE Person SET names= :names, lastName= :lastName, secondLastName= :secondLastName, address= :address, phone= :phone, email= :email, photo= :photo, updateDate=CURRENT_TIMESTAMP WHERE Personid= :PersonId";
            try
            {
                OracleCommand cmd = DBImplementation.CreateBasicCommand(query);
                OracleParameter[] parameters1 = new OracleParameter[8];

                parameters1[0] = new OracleParameter(":PersonId", t.PersonId);
                parameters1[0] = new OracleParameter(":names", t.Names);
                parameters1[0] = new OracleParameter(":lastName", t.LastName);
                parameters1[0] = new OracleParameter(":secondLastName", t.SecondLastName);
                parameters1[0] = new OracleParameter(":phone", t.Address);
                parameters1[0] = new OracleParameter(":email", t.Phone);
                parameters1[0] = new OracleParameter(":class", t.Email);
                if (t.Pathrevision == t.PathImage)
                { 
                    parameters1[0] = new OracleParameter(":photo", t.Photo);
                }
                else
                {
                    if (int.Parse(t.Photo)==0)
                    {
                        parameters1[0] = new OracleParameter(":photo", t.PersonId);


                        File.Copy(t.PathImage, DBImplementation.pathImages + t.PersonId + ".png");
                    }
                    else
                    {
                        System.GC.Collect();
                        System.GC.WaitForPendingFinalizers();
                        parameters1[0] = new OracleParameter(":photo", t.PersonId);
                        File.Delete(DBImplementation.pathImages + t.PersonId + ".png");
                        File.Copy(t.PathImage, DBImplementation.pathImages + t.PersonId + ".png");
                    }
                }
                cmd.Parameters.AddRange(parameters1);
                return DBImplementation.ExecuteBasicCommand(cmd);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }