internal string ZapamtiKvar(int sifraGosta, DateTime datumKvara, int brojSobe, string opisKvara)
        {
            Kvar kvar = new Kvar
            {
                KvarID       = SifraKvara,
                GostID       = sifraGosta,
                DatumKvara   = datumKvara,
                BrojSobe     = brojSobe,
                OpisKvara    = opisKvara,
                IDZaposlenog = 1,
            };

            DBBroker.DajSesiju().PokreniDbTransakciju();
            bool ret = DBBroker.DajSesiju().ZapamtiKvar(kvar);

            if (ret)
            {
                DBBroker.DajSesiju().PotvrdiDbTransakciju();
                return(UspesnoCuvanje);
            }
            else
            {
                DBBroker.DajSesiju().PonistiDbTransakciju();
                return(NeuspesnoCuvanje);
            }
        }
示例#2
0
        public void N_ReturnAllUsers_CanGetAllUsers_ReturnsTrue()
        {
            DBBroker broker    = new DBBroker();
            var      userLogic = new UsersLogic();

            List <User> expected = (List <User>)broker.reaturnAllUsers();
            List <User> result   = (List <User>)userLogic.reaturnAllUsers();

            Assert.AreEqual(result.Count, expected.Count);
        }
        internal List <object> PronadjiKvarove(DateTime datumKvara)
        {
            ListaKvarova = DBBroker.DajSesiju().PronadjiKvarove(datumKvara);

            if (ListaKvarova == null)
            {
                return(null);
            }

            return(ListaKvarova.Cast <object>().ToList());
        }
        public void returnAllProject_CanGetAllProjects_ReturnTrue()
        {
            DBBroker broker       = new DBBroker();
            var      projectLogic = new ProjectLogic();


            List <Project> expected = (List <Project>)broker.returnAllProject();
            List <Project> result   = (List <Project>)projectLogic.returnAllProject();

            Assert.AreEqual(result.Count, expected.Count);
        }
 public bool createProject(Project project)
 {
     try
     {
         DBBroker broker = new DBBroker();
         return(broker.createProject(project));
     }
     catch (Exception)
     {
         throw;
     }
 }
 public Project IsProjectCodeUnique(string random)
 {
     try
     {
         DBBroker broker = new DBBroker();
         return(broker.IsProjectCodeUnique(random));
     }
     catch (Exception)
     {
         throw;
     }
 }
 public bool isUsernameUnique(string text)
 {
     try
     {
         DBBroker broker = new DBBroker();
         return(broker.isUsernameUnique(text));
     }
     catch (Exception)
     {
         throw;
     }
 }
 public object getAllUsersWithRole(int v)
 {
     try
     {
         DBBroker broker = new DBBroker();
         return(broker.getAllUsersWithRole(v));
     }
     catch (Exception)
     {
         throw;
     }
 }
 public IList <Project> returnAllProjectForPM(User userLogged)
 {
     try
     {
         DBBroker broker = new DBBroker();
         return(broker.returnAllProjectForPM(userLogged));
     }
     catch (Exception)
     {
         throw;
     }
 }
 public bool updateUser(User user, string oldUsername)
 {
     try
     {
         DBBroker broker = new DBBroker();
         return(broker.updateUser(user, oldUsername));
     }
     catch (Exception)
     {
         throw;
     }
 }
 public IList <Project> returnAllProject()
 {
     try
     {
         DBBroker broker = new DBBroker();
         return(broker.returnAllProject());
     }
     catch (Exception)
     {
         throw;
     }
 }
 public bool removeUser(User user)
 {
     try
     {
         DBBroker broker = new DBBroker();
         return(broker.removeUser(user));
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#13
0
        public static void Log(Exception ex)
        {
            try
            {
                AppLog log = new AppLog();
                log.Message = ex.Message;
                log.Stack   = ex.StackTrace;

                DBBroker <AppLog> .Save(log);
            }
            catch { }
        }
 public List <Task> returnAllTasksForUser(User user)
 {
     try
     {
         DBBroker broker = new DBBroker();
         return(broker.returnAllTasksForUser(user));
     }
     catch (Exception)
     {
         throw;
     }
 }
 public IList <User> reaturnAllUsers()
 {
     try
     {
         DBBroker broker = new DBBroker();
         return(broker.reaturnAllUsers());
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#16
0
        public void S_returnAllTasksForUser_CanReturnAllTasksForUser_ReturnTrue()
        {
            DBBroker broker    = new DBBroker();
            var      userLogic = new UsersLogic();
            User     u         = new User();

            u.Username = "******";

            List <Task> expected = broker.returnAllTasksForUser(u);
            List <Task> result   = (List <Task>)userLogic.returnAllTasksForUser(u);

            Assert.AreEqual(result.Count, expected.Count);
        }
        public bool updateTask(Task task)
        {
            try
            {
                DBBroker broker = new DBBroker();
                return broker.updateTask(task);
            }
            catch (Exception)
            {

                throw;
            }
        }
        public void returnAllProjectForPM_CanReturnAllProjectForPM_ReturnTrue()
        {
            DBBroker broker         = new DBBroker();
            var      projectLogic   = new ProjectLogic();
            User     projectManager = new User();

            projectManager.Username = "******";

            List <Project> expected = (List <Project>)broker.returnAllProjectForPM(projectManager);
            List <Project> result   = (List <Project>)projectLogic.returnAllProjectForPM(projectManager);

            Assert.AreEqual(result.Count, expected.Count);
        }
        public int returnTaskId()
        {
            try
            {
                DBBroker broker = new DBBroker();
                return broker.returnTaskId();
            }
            catch (Exception)
            {

                throw;
            }
        }
        public IList<Task> returnAllTasksForProject(Project project)
        {
            try
            {
                DBBroker broker = new DBBroker();
                return broker.returnAllTasksForProject(project);
            }
            catch (Exception)
            {

                throw;
            }
        }
示例#21
0
        internal List <string> PronadjiGosta(int sifraGosta)
        {
            Gost g = DBBroker.DajSesiju().PronadjiGosta(sifraGosta);

            if (g == null)
            {
                return(null);
            }

            return(new List <string>
            {
                { g.Ime },
                { g.Prezime }
            });
        }
示例#22
0
        public void Q_updateUser3_CanUpdateUser_ReturnTrue()
        {
            DBBroker broker    = new DBBroker();
            var      userLogic = new UsersLogic();
            User     u         = new User();

            u.Username = "******";

            u.Password = "******";
            u.Email    = "masa12@gmail";
            u.Role     = 2;

            var result = userLogic.updateUser(u, "masa123");

            Assert.IsTrue(result);
        }
示例#23
0
        public void C_updateUser_CanUpdateUser_ReturnTrue()
        {
            DBBroker broker    = new DBBroker();
            var      userLogic = new UsersLogic();
            User     u         = new User();

            u.Username = "******";

            u.Password = "******";
            u.Email    = "lazar@gmail";
            u.Role     = 0;

            var result = userLogic.updateUser(u, "lazarkosti");

            Assert.IsTrue(result);
        }
        public void returnAllTasksForProject_CanGetAllTasksForProject()
        {
            DBBroker broker    = new DBBroker();
            var      taskLogic = new TaskLogic();
            Project  project   = new Project()
            {
                ProjectCode = projectCodeTest
            };


            List <Task> expected = (List <Task>)broker.returnAllTasksForProject(project);
            List <Task> result   = (List <Task>)taskLogic.returnAllTasksForProject(project);


            Assert.AreEqual(result.Count, expected.Count);
        }
示例#25
0
        public void E_createUser2_CanCreateUser_ReturnTrue()
        {
            DBBroker broker    = new DBBroker();
            var      userLogic = new UsersLogic();
            User     u         = new User();

            u.Username = "******";
            u.Password = "******";
            u.Email    = "igo@gmail";
            u.Role     = 2;


            var result = userLogic.createUser(u);

            Assert.IsTrue(result);
        }
示例#26
0
        public void B_createUser_CanCreateUser_ReturnTrue()
        {
            DBBroker broker    = new DBBroker();
            var      userLogic = new UsersLogic();
            User     u         = new User();

            u.Username = "******";
            u.Password = "******";
            u.Email    = "laza@gmail";
            u.Role     = 1;


            var result = userLogic.createUser(u);

            Assert.IsTrue(result);
        }
示例#27
0
        public void F_updateUser2_CanUpdateUser_ReturnTrue()
        {
            DBBroker broker    = new DBBroker();
            var      userLogic = new UsersLogic();
            User     u         = new User();

            u.Username = "******";

            u.Password = "******";
            u.Email    = "igor@gmail";
            u.Role     = 1;

            var result = userLogic.updateUser(u, "igorpani");

            Assert.IsTrue(result);
        }
示例#28
0
        internal string ObrisiKvar()
        {
            DBBroker.DajSesiju().PokreniDbTransakciju();
            bool ret = DBBroker.DajSesiju().ObrisiKvar(izabraniKvar.KvarID);

            if (ret)
            {
                ListaKvarova = new List <Kvar>();

                DBBroker.DajSesiju().PotvrdiDbTransakciju();
                return(UspesnoCuvanje);
            }
            else
            {
                DBBroker.DajSesiju().PonistiDbTransakciju();
                return(NeuspesnoCuvanje);
            }
        }
示例#29
0
        internal string IzmeniKvar(int sifraGosta, int brojSobe, string opisKvara)
        {
            izabraniKvar.GostID       = sifraGosta;
            izabraniKvar.BrojSobe     = brojSobe;
            izabraniKvar.OpisKvara    = opisKvara;
            izabraniKvar.IDZaposlenog = 1;

            DBBroker.DajSesiju().PokreniDbTransakciju();
            bool ret = DBBroker.DajSesiju().IzmeniKvar(izabraniKvar);

            if (ret)
            {
                DBBroker.DajSesiju().PotvrdiDbTransakciju();
                return(UspesnoCuvanje);
            }
            else
            {
                DBBroker.DajSesiju().PonistiDbTransakciju();
                return(NeuspesnoCuvanje);
            }
        }
示例#30
0
        static void Main()
        {
            //var parameters = new List<DbParameter>();
            //parameters.Add(new OracleParameter("pSqPessoa", OracleDbType.Varchar2) { Value = "100502304" });
            //parameters.Add(new OracleParameter("pSqContribuinte", OracleDbType.Varchar2) { Value = "1" });
            //parameters.Add(new OracleParameter("pCursor", OracleDbType.RefCursor) { Direction = ParameterDirection.Output });

            //var contador =
            //    DBBroker<Contador>
            //    .ExecCmdSQL("UVTPKG_CONTRIBUINTE_CONSULTAS.ConsultaContador"
            //                , parameters
            //                , CommandType.StoredProcedure);


            //var empregado = new Empregado()
            //{
            //    Id = 0,
            //    Nome = "Diego",
            //    Sobrenome = "Morais",
            //};

            //DBBroker<Empregado>.Save(empregado);

            var person = new Person
            {
                Id       = 21,
                Name     = "Edward Snoden (Hero)",
                Birthday = new DateTime(1986, 05, 29),
                IsFriend = false,
                Salary   = 50000
            };

            DBBroker <Person> .Save(person);

            //person = DBPerson.GetById(6);
            //person.Name = "Watchman Nee";
            //person.IsFriend = false;
            //DBPerson.Save(person);
        }