Exemple #1
0
        public static void addToCalculateResulte()
        {
            Contract con3;

            foreach (var item in contractUsed)
            {
                if (item.Key.isContract == true)
                {
                    con3 = contracts.Where(u => u.id == item.Key.idContractOrTravel).FirstOrDefault();
                    if (con3 != null)
                    {
                        CalculateResulte c = new CalculateResulte(travelsToCurrentContractDTO, type == "freeDay" ? true : false, con3.Description, item.Key.idContractOrTravel, item.Key.price);
                        if (!calculateResultes.Contains(c))
                        {
                            calculateResultes.Add(c);
                        }
                    }
                }
                else
                {
                    if (type == "freeDay")
                    {
                        Travel tr = db.Travels.Where(q => q.id == item.Key.idContractOrTravel).FirstOrDefault();
                        if (tr != null)
                        {
                            TravelsDTO trDTO = Convertions.Convertion(tr);
                            calculateResultes[0].TravelToCon.Add(trDTO);
                            calculateResultes[0].price += item.Key.price;
                        }
                    }
                }
            }
        }
Exemple #2
0
        public static Travel Convertion(TravelsDTO travel)
        {
            Travel newTravel = new Travel();

            newTravel.id     = travel.id;
            newTravel.bas    = travel.buss;
            newTravel.price  = travel.price;
            newTravel.areaID = travel.areaID;
            // newTravel.InternalOrIntermediate = travel.internalOrIntermediate;
            newTravel.travelTrip = travel.trvelTrip;
            newTravel.date       = travel.date;
            return(newTravel);
        }
Exemple #3
0
        /* public static AreasDTO Convertion(Area areaTbl)
         * {
         *   return  new AreasDTO(areaTbl.id) {
         *       id = areaTbl.id,
         *       name = areaTbl.name
         *
         *   };
         *
         *
         * }
         * public static Area Convertion(AreasDTO area)
         * {
         *
         *   return new Area() {
         *   id = area.id,
         *   name = area.name,
         *
         *   };
         *
         * }
         * public static AreaToContractsDTO Convertion(AreaToContract areaToContractsTbl)
         * {
         *   AreaToContractsDTO newareaToContracts = new AreaToContractsDTO();
         *   newareaToContracts.id = areaToContractsTbl.id;
         *   newareaToContracts.areaID = areaToContractsTbl.areaID;
         *   newareaToContracts.contractID = areaToContractsTbl.contractID;
         *   return newareaToContracts;
         * }
         *
         * public static AreaToContract Convertion(AreaToContractsDTO areaToContracts)
         * {
         *   AreaToContract newareaToContracts = new AreaToContract();
         *   newareaToContracts.id = areaToContracts.id;
         *   newareaToContracts.areaID = areaToContracts.areaID;
         *   newareaToContracts.contractID = areaToContracts.contractID;
         *   newareaToContracts=newareaToContracts.Area?.code;
         *   return newareaToContracts;
         * }
         * public static contractsDTO Convertion(Contract contractTbl)
         * {
         *   contractsDTO newContract = new contractsDTO();
         *   newContract.id = contractTbl.id;
         *   newContract.freeDay = contractTbl.freeDay;
         *   newContract.freeMonth = contractTbl.freeMounth;
         *   return newContract;
         * }
         * public static Contract Convertion(contractsDTO contract)
         * {
         *   Contract newContract = new Contract();
         *   newContract.id = contract.id;
         *   newContract.freeDay = contract.freeDay;
         *   newContract.freeMounth = contract.freeMonth;
         *   return newContract;
         * }
         * public static ProfilsDTO Convertion(Profile profileTbl)
         * {
         *   ProfilsDTO newprofile = new ProfilsDTO();
         *   newprofile.id = profileTbl.id;
         * //  newprofile.discount = profileTbl.discount;
         *   newprofile.describe = profileTbl.describe;
         *   return newprofile;
         * }
         * public static Profile Convertion(ProfilsDTO profile)
         * {
         *   Profile newprofile = new Profile();
         *   newprofile.id = profile.id;
         *   newprofile.discount = profile.discount;
         *   newprofile.describe = profile.describe;
         *   return newprofile;
         * }*/
        public static TravelsDTO Convertion(Travel travelTbl)
        {
            TravelsDTO newTravel = new TravelsDTO();

            newTravel.id        = travelTbl.id;
            newTravel.buss      = travelTbl.bas;
            newTravel.price     = travelTbl.price;
            newTravel.areaID    = travelTbl.areaID;
            newTravel.trvelTrip = travelTbl.travelTrip;
            newTravel.date      = travelTbl.date;
            newTravel.areaName  = travelTbl.Area?.name;
            return(newTravel);
        }
Exemple #4
0
        private TravelsDTO ToDTO(Travels r)
        {
            TravelsDTO dto = new TravelsDTO();

            dto.content = r.content;
            dto.Id      = r.Id;
            dto.title   = r.title;
            dto.shenhe  = r.shenhe;
            dto.tops    = r.tops;
            dto.shenhe  = r.shenhe;
            using (Dbcontext ctx = new Dbcontext())
            {
                BaseService <User> bs = new BaseService <User>(ctx);
                var user = bs.GetById(r.Uid);
                if (user != null)
                {
                    dto.UNickName = user.NickName;
                }
            }

            dto.CreateDateTime = r.CreateDateTime;
            dto.Id             = r.Id;
            return(dto);
        }