예제 #1
0
        public int UpdatePhases(List <OfferPhases> listOfferPhases, int IdOffer)
        {
            SqlConnection _connection;
            OfferPhasRepository <OfferPhases> ofre = new OfferPhasRepository <OfferPhases>();

            using (_connection = Utilities.GetOpenConnection())
            {
                foreach (OfferPhases fase in listOfferPhases)
                {
                    ofre.Update(fase);
                }

                return(1);
            }
        }
예제 #2
0
        public OfferPhases GetPhaseInitial(int IdOffer)
        {
            SqlConnection _connection;
            OfferPhasRepository <OfferPhases> OfferPhas = new OfferPhasRepository <OfferPhases>();

            Entities.OfferPhases result;

            using (_connection = Utilities.GetOpenConnection())
            {
                //string processQuery = "DELETE FROM OFFERPHASES WHERE IDOFFER IN )";
                string sqlQuery = "SELECT * FROM OfferPhases WHERE IdOffer=@IdOffer";
                result = _connection.Query <OfferPhases>(sqlQuery, new { IdOffer }).FirstOrDefault();
                _connection.Close();
            }
            return(result);
        }
예제 #3
0
        public int DeletePhases(int IdOffer)
        {
            SqlConnection _connection;
            OfferPhasRepository <OfferPhases> OfferPhas = new OfferPhasRepository <OfferPhases>();

            Entities.Offer result;
            int            rta = 0;

            using (_connection = Utilities.GetOpenConnection())
            {
                //string processQuery = "DELETE FROM OFFERPHASES WHERE IDOFFER IN )";
                string sqlQuery = "DELETE FROM OfferPhases WHERE IdOffer=@IdOffer";
                rta = _connection.Execute(sqlQuery, new { IdOffer });
                _connection.Close();
            }
            return(rta);
        }
예제 #4
0
        public List <Project> GetListPaged(int pagenumber, int itemsperpage, string conditions, string order)
        {
            ZonaFl.Persistence.Repository.ProjectRepository <Project> Projectrepo = new ProjectRepository <Project>();
            OfferUserRepository <OfferUser>   OfferrepoUser   = new OfferUserRepository <OfferUser>();
            OfferPhasRepository <OfferPhases> OfferrepoPhases = new OfferPhasRepository <OfferPhases>();
            UserRepository userrepo = new UserRepository();
            var            lista    = Projectrepo.GetListPaged <Project, Offer>(pagenumber, itemsperpage, conditions, order).ToList().Select(e => new Project().InjectFrom(e)).Cast <Project>().ToList();

            foreach (var project in lista)
            {
                var repoofferuser   = OfferrepoUser.GetList("where idoffer=" + project.IdOffer + " and iduser='******'").ToList();
                var repoofferphases = OfferrepoPhases.GetList("where idoffer=" + project.IdOffer).ToList();
                var user            = userrepo.FindByID(new Guid(repoofferuser.FirstOrDefault().IdUser));
                project.Offer.OfferUsers  = new List <OfferUser>();
                project.Offer.OfferUsers  = repoofferuser;
                project.Offer.AspNetUser  = new AspNetUsers();
                project.Offer.AspNetUser  = user;
                project.Offer.OfferPhases = new List <OfferPhases>();
                project.Offer.OfferPhases = repoofferphases;
            }

            return(lista);
        }