Exemplo n.º 1
0
        public async Task <GetTotalResponseDTO> GetTotal(string amount, DeliveryType deliveryType)
        {
            var client = _httpClientFactory.CreateClient(Constants.ClientWithToken);

            var price = CurrencyConverter.currencyToDecimal(amount);

            var response2 = await client.GetAsync <decimal>(string.Format(Constants.Routes.CalculateVAT, price));

            var vat = response2.Object;

            decimal deliveryFee = 0m;

            if (deliveryType == DeliveryType.HomeDelivery)
            {
                deliveryFee = 50000;
            }

            decimal Total = price + vat + deliveryFee;

            return(new GetTotalResponseDTO
            {
                deliveryCharge = CurrencyConverter.formatAmount(deliveryFee),
                amount = CurrencyConverter.formatAmount(price),
                total = CurrencyConverter.formatAmount(Total),
                vat = CurrencyConverter.formatAmount(vat)
            });
        }
Exemplo n.º 2
0
        private DeliveryAct ParseActFromForm()
        {
            TreeNode node     = (TreeNode)controlDataTreeRow.SelectedNode;
            string   fullPath = node.FullPath;

            string[] elements = fullPath.Split('\\');

            if (elements.Length != 3)
            {
                throw new Exception("Выбран узел не на том уровне");
            }

            DeliveryType deliveryType = DeliveryType.Газета;

            foreach (var item in Enum.GetValues(typeof(DeliveryType)))
            {
                if (item.ToString() == elements[0])
                {
                    deliveryType = (DeliveryType)item;
                }
            }

            return(deliveryActs
                   .First(rec => rec.DeliveryDate.ToString() == DateTime.Parse(elements[2]).ToString() &&
                          rec.DeliveryType == deliveryType &&
                          rec.CourierFIO == elements[1]));
        }
Exemplo n.º 3
0
        internal IAgNetChannel GetChannel(DeliveryType deliveryType, byte channel)
        {
            if (deliveryType == DeliveryType.Unreliable)
            {
                return(unreliableChannel);
            }
            else if (deliveryType == DeliveryType.Reliable)
            {
                return(reliableChannel);
            }
            else if (deliveryType == DeliveryType.Sequenced)
            {
                lock (sequenceChannels)
                {
                    if (!sequenceChannels.ContainsKey(channel))
                    {
                        sequenceChannels.Add(channel, new AgNetSequenceChannel(channel));
                    }

                    return(sequenceChannels[channel]);
                }
            }

            throw new ArgumentException("Invalid delivery type: " + deliveryType.ToString());
        }
 public NewImportDeliveryDetail(PageMode pageMode, DeliveryType deliveryType)
 {
     InitializeComponent();
     ModuleName = "PurchaseDelivery";
     DVM = new DeliveryVM(deliveryType);
     BindData();
 }
Exemplo n.º 5
0
        public ActionResult <DeliveryTypeDTO> Edit([FromBody] DeliveryTypeDTO deliveryTypeDTO)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(UnprocessableEntity(ModelState));
                }

                DeliveryType deliveryType = _mapper.Map <DeliveryType>(_deliveryTypeAppService.GetById(deliveryTypeDTO.Id, this.User));

                if (deliveryType == null)
                {
                    return(BadRequest());
                }

                deliveryType.Description   = deliveryTypeDTO.Description;
                deliveryType.DeliveryValue = deliveryTypeDTO.DeliveryValue;

                _deliveryTypeAppService.UpdateEntity(deliveryType);

                return(new ObjectResult(deliveryTypeDTO));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Purpose: Grabs delivery type information based on ID
        /// Accepts: Int
        /// Returns: Hashtable
        /// </summary>
        public Hashtable GetDeliveryTypeByID(int id)
        {
            DeliveryType          obj = new DeliveryType();
            QuickStart_DBEntities dbContext;
            Hashtable             hsh = new Hashtable();

            try
            {
                dbContext = new QuickStart_DBEntities();
                obj       = dbContext.DeliveryTypes.FirstOrDefault(d => d.DeliveryTypeID == id);
                if (obj != null)
                {
                    hsh["deliverytypeid"] = obj.DeliveryTypeID;
                    hsh["name"]           = obj.Name;
                    hsh["description"]    = obj.Description;
                    hsh["cost"]           = obj.Cost;
                    hsh["created"]        = obj.Created;
                    hsh["modified"]       = obj.Modified;
                }
            }
            catch (Exception ex)
            {
                ErrorLoggerData.ErrorRoutine(ex, "DeliveryTypeData", "GetDeliveryTypeByID");
            }

            return(hsh);
        }
Exemplo n.º 7
0
        private void InitializeDroids()
        {
            CurrentPlayer currentPlayer                   = Service.CurrentPlayer;
            int           num                             = currentPlayer.CurrentDroidsAmount;
            NodeList <SupportViewNode> nodeList           = Service.EntityController.GetNodeList <SupportViewNode>();
            ISupportController         iSupportController = Service.ISupportController;

            for (SupportViewNode supportViewNode = nodeList.Head; supportViewNode != null; supportViewNode = supportViewNode.Next)
            {
                Contract contract = iSupportController.FindCurrentContract(supportViewNode.Entity.Get <BuildingComponent>().BuildingTO.Key);
                if (contract != null)
                {
                    DeliveryType deliveryType = contract.DeliveryType;
                    if (deliveryType == DeliveryType.SwapBuilding || deliveryType == DeliveryType.UpgradeBuilding || deliveryType == DeliveryType.Building)
                    {
                        this.AssignWorkToDroid(supportViewNode.Entity, true, true, false);
                        num--;
                    }
                    else if (deliveryType == DeliveryType.ClearClearable || deliveryType == DeliveryType.Champion)
                    {
                        this.AssignWorkToDroid(supportViewNode.Entity, false, true, false);
                        num--;
                    }
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        ///     Finalizes the current order
        /// </summary>
        public void Finish(DeliveryType deliverType)
        {
            SwitchProfile(0);
            var director = new BillDirector();
            var list     = new List <ProfileMemento>();

            list.AddRange(ProfileCaretaker.Profiles);
            var deliverMessage = "";

            switch (deliverType)
            {
            case DeliveryType.TO_COUNTER:
                deliverMessage = new Delivery().DeliveryType(deliverType);
                director.SetBuilder(new AnalogBillBuilder());
                director.BuildAnalogBill(DateTime.Now, list, TotalPrice, "Emmen", "Parallelweg 36A");
                break;

            case DeliveryType.TO_TABLE_INSIDE:
                deliverMessage = new DeliveryToTableDecorator(new Delivery()).DeliveryType(deliverType);
                director.SetBuilder(new AnalogBillBuilder());
                director.BuildAnalogBill(DateTime.Now, list, TotalPrice, "Emmen", "Parallelweg 36A");
                break;

            case DeliveryType.TO_CAR_A:
                deliverMessage = new DeliveryToCarDecorator(new Delivery()).DeliveryType(deliverType);
                director.SetBuilder(new DigitalBillBuilder());
                director.BuildDigitalBill(DateTime.Now, list, TotalPrice, "Emmen", "Parallelweg 36A",
                                          "*****@*****.**");
                break;
            }


            new MessageDialog($"{deliverMessage}\n{director.GetBill()}").ShowAsync();
            ProfileCaretaker.Clear();
        }
Exemplo n.º 9
0
        public TrainTroopTypeObjectiveProcessor(ObjectiveVO vo, ObjectiveManager parent) : base(vo, parent)
        {
            TroopType troopType = StringUtils.ParseEnum <TroopType>(vo.Item);

            if (troopType == TroopType.Champion)
            {
                this.deliveryType = DeliveryType.Champion;
            }
            else if (troopType == TroopType.Hero)
            {
                this.deliveryType = DeliveryType.Hero;
            }
            else if (troopType == TroopType.Infantry)
            {
                this.deliveryType = DeliveryType.Infantry;
            }
            else if (troopType == TroopType.Mercenary)
            {
                this.deliveryType = DeliveryType.Mercenary;
            }
            else if (troopType == TroopType.Vehicle)
            {
                this.deliveryType = DeliveryType.Vehicle;
            }
            Service.Get <EventManager>().RegisterObserver(this, EventId.TroopRecruited);
            Service.Get <EventManager>().RegisterObserver(this, EventId.HeroMobilized);
        }
Exemplo n.º 10
0
        public static int GetBuildingContractTotalTime(string buildingContractUid, DeliveryType type)
        {
            if (type == DeliveryType.UpgradeTroop)
            {
                TroopTypeVO optional = Service.Get <IDataController>().GetOptional <TroopTypeVO>(buildingContractUid);
                return(optional.UpgradeTime);
            }
            if (type == DeliveryType.UpgradeStarship)
            {
                SpecialAttackTypeVO optional2 = Service.Get <IDataController>().GetOptional <SpecialAttackTypeVO>(buildingContractUid);
                return(optional2.UpgradeTime);
            }
            if (type == DeliveryType.UpgradeEquipment)
            {
                EquipmentVO optional3 = Service.Get <IDataController>().GetOptional <EquipmentVO>(buildingContractUid);
                return(optional3.UpgradeTime);
            }
            BuildingTypeVO buildingTypeVO = Service.Get <IDataController>().Get <BuildingTypeVO>(buildingContractUid);

            switch (type)
            {
            case DeliveryType.Building:
            case DeliveryType.UpgradeBuilding:
            case DeliveryType.ClearClearable:
                return(buildingTypeVO.Time);

            case DeliveryType.SwapBuilding:
                return(buildingTypeVO.SwapTime);
            }
            return(0);
        }
Exemplo n.º 11
0
        public IncomingMessage(byte[] buffer, EndPoint remoteEndPoint)
        {
            this.RemoteEndPoint = remoteEndPoint;

            if (buffer.Length < HEADER_SIZE)
            {
                throw new AgNetException("Wrong packet header");
            }

            using (MemoryStream instream = new MemoryStream(buffer))
            {
                using (BinaryReader reader = new BinaryReader(instream))
                {
                    this.sequence = reader.ReadInt32();
                    this.channel  = reader.ReadByte();
                    int serviceData = reader.ReadByte();
                    int len         = reader.ReadUInt16();

                    this.DeliveryType = (DeliveryType)(serviceData & 0x3);
                    this.Type         = (PacketType)((serviceData >> 2) & 0xF);

                    if (buffer.Length - HEADER_SIZE < len)
                    {
                        throw new AgNetException("Invalid packet");
                    }

                    this.stream = new MemoryStream(reader.ReadBytes((int)len));
                    this.reader = new BinaryReader(this.stream);
                }
            }
        }
Exemplo n.º 12
0
        protected override void InitLabels()
        {
            base.InitLabels();
            this.labelUnlock = base.GetElement <UXLabel>("LabelUnlock");
            DeliveryType deliveryType = this.deliveryType;
            string       id;

            switch (deliveryType)
            {
            case DeliveryType.Vehicle:
                id = "UNLOCKS_VEHICLES";
                break;

            case DeliveryType.Starship:
                id = "UNLOCKS_STARSHIPS";
                break;

            case DeliveryType.Hero:
                id = "UNLOCKS_HEROES";
                break;

            default:
                if (deliveryType != DeliveryType.Mercenary)
                {
                    id = "UNLOCKS_TROOPS";
                }
                else
                {
                    id = "UNLOCKS_MERCENARIES";
                }
                break;
            }
            this.labelUnlock.Text = this.lang.Get(id, new object[0]);
        }
Exemplo n.º 13
0
        private async Task StartDelivery(DeliveryType aDeliveryType)
        {
            SavePlayerSkin();
            LoadWorkPlayerSkin(aDeliveryType);

            RequestModel((uint)GetHashKey("prop_paper_bag_01"));

            await SpawnDeliveryVehicle(aDeliveryType);

            m_delivery_state = DELIVERY_STATE.PLAYER_STARTED_DELIVERY;

            CreateRoute(aDeliveryType);
            GetNextDeliveryPoint(true);
            m_active_delivery_type = aDeliveryType;

            int safe_deposit = DeliveryData.SAFE_DEPOSIT_SCOOTER;

            if (aDeliveryType == DeliveryType.Van)
            {
                safe_deposit = DeliveryData.SAFE_DEPOSIT_VAN;
            }
            if (aDeliveryType == DeliveryType.Truck)
            {
                safe_deposit = DeliveryData.SAFE_DEPOSIT_TRUCK;
            }

            TriggerServerEvent("esx_deliveries:RemoveBankMoney", safe_deposit);
            Screen.ShowNotification(DeliveryData._U["SAFE_DEPOSIT_RECEIVED"]);
        }
Exemplo n.º 14
0
        private static void LoadWorkPlayerSkin(DeliveryType aDeliveryType)
        {
            bool isPedFemale = IsPedModel(Game.PlayerPed.Handle, (uint)GetHashKey("mp_f_freemode_01"));

            var drawables        = DeliveryData.OutfitScooter_drawables;
            var drawableTextures = DeliveryData.OutfitScooter_drawableTextures;

            if (isPedFemale)
            {
                drawables        = DeliveryData.OutfitScooter_drawables_f;
                drawableTextures = DeliveryData.OutfitScooter_drawableTextures_f;
            }

            if (aDeliveryType != DeliveryType.Scooter)
            {
                drawables        = DeliveryData.OutfitVan_drawables;
                drawableTextures = DeliveryData.OutfitVan_drawableTextures;

                if (isPedFemale)
                {
                    drawables        = DeliveryData.OutfitVan_drawables_f;
                    drawableTextures = DeliveryData.OutfitVan_drawableTextures_f;
                }
            }

            foreach (var x in drawables)
            {
                SetPedComponentVariation(Game.PlayerPed.Handle, x.Key, x.Value, drawableTextures[x.Key], 1);
            }
        }
Exemplo n.º 15
0
 public DeskQuote(Desk desk, string name, DeliveryType shippingTime)
 {
     this.Desk         = desk;
     this.CustomerName = name;
     this.ShippingTime = shippingTime;
     this.DateCreated  = DateTime.Today;
 }
Exemplo n.º 16
0
 public Order(uint number, string address, DeliveryType type)
 {
     this.Number       = number;
     this.CreationDate = DateTimeOffset.Now;
     this.Address      = address;
     this.DeliveryType = type;
 }
Exemplo n.º 17
0
        public void AddOrder()
        {
            var couriers = this.Users
                           .Where(u => u.Role == UserRole.Normal)
                           .Cast <ICourier>();

            var clients = this.Users
                          .Where(u => u.Role == UserRole.Operator)
                          .Cast <IClient>();

            this.PrintUser(couriers);

            string inputCourier = Console.ReadLine();

            ICourier selectedCourier = couriers
                                       .FirstOrDefault(sc => sc.Username.Equals(inputCourier));

            Console.WriteLine("--- Sender ---");
            this.PrintUser(clients);

            string inputSender = Console.ReadLine();

            IClient selectedSender = clients
                                     .FirstOrDefault(sc => sc.Username.Equals(inputSender));

            Console.WriteLine("--- Receiver ---");
            this.PrintUser(clients);

            string inputReceiver = Console.ReadLine();

            IClient selectedReceiver = clients
                                       .FirstOrDefault(sc => sc.Username.Equals(inputReceiver));

            Console.WriteLine("---Delivery Type information---");
            Console.Write("Delivery type (Standart/Express): ");

            string       type         = Console.ReadLine();
            DeliveryType deliveryType = AddDeliveryType(type);

            Console.Write("---Product information---");
            IProduct product = AddProduct();

            Console.Write("Enter date of sending (Day/Month/Year): ");
            DateTime sendDate = DateTime.ParseExact(Console.ReadLine(),
                                                    "d/M/yyyy", CultureInfo.InvariantCulture);

            Console.Write("Enter due date for delivery(Day/Month/Year): ");
            DateTime dueDate = DateTime.ParseExact(Console.ReadLine(),
                                                   "d/M/yyyy", CultureInfo.InvariantCulture);

            int postalCode = selectedReceiver.Address.Country.CitysAndZips[selectedReceiver.Address.City];

            var order = this.Factory.CreateOrder(selectedCourier, selectedSender, selectedReceiver, deliveryType, sendDate, dueDate, OrderState.InProgress, product, postalCode);

            this.Orders.Add(order);

            selectedCourier.OrdersList.Add(order);
            selectedReceiver.OrdersList.Add(order);
            selectedSender.OrdersList.Add(order);
        }
Exemplo n.º 18
0
        public static float ShippingTimeHours(this DeliveryType dt, float distanceKilometers)
        {
            float hours = 0f;

            switch (dt)
            {
            default:
            case DeliveryType.Rover:
                //1 sol for scheduling problems and start/stops on way
                //48.3 km/h (30 mph) driving speed
                //for 24.7h each day
                hours = 24.7f + (distanceKilometers / (48.3f));
                break;

            case DeliveryType.Lander:
                //.5 sol for loading and fueling
                //300 km/h suborbital speed
                //for 24.7h each day
                hours = 12.35f + (distanceKilometers / (300));
                break;

            case DeliveryType.Drop:
                //0 sol (fast loading)
                //600 km/h suborbital speed
                //for 24.7h each day
                hours = distanceKilometers / (600);
                break;
            }
            return(Mathf.Max(hours, MinimumDeliveryTimeHours));//no delivery can ever take less than 2 hours!
        }
Exemplo n.º 19
0
        public virtual bool SendCustom(ICustomMessage message, DeliveryType deliveryType, int channel)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            ChannelDescriptor.CheckChannelValue(channel);

            using (var rawMessage = this.Parent.CreateMessage())
            {
                rawMessage.DeliveryType = deliveryType;
                rawMessage.Channel      = channel;

                using (WardenStreamWriter sw = new WardenStreamWriter(rawMessage.BaseStream, true))
                {
                    message.WriteTo(new WriteFormatterInfo(sw, this.configuration.Serializer));
                }

                UdpSendStatus result = SendRawMessage(new Warden.Networking.Udp.Messages.MessageInfo(rawMessage,
                                                                                                     deliveryType, channel));

                return(result != UdpSendStatus.Failed);
            }
        }
        void CreateOrEditGradleFile(string androidPackDir, string assetPackName, DeliveryType deliveryType)
        {
            if (deliveryType == DeliveryType.None)
            {
                Addressables.Log($"Asset pack '{assetPackName}' has its delivery type set to 'None'. " +
                                 $"No gradle file will be created for this asset pack. Unity assumes that any custom asset packs with no gradle file use on-demand delivery.");
                return;
            }

            // Warn about other gradle files in the .androidpack directory
            List <string> gradleFiles = Directory.EnumerateFiles(androidPackDir, "*.gradle").Where(x => Path.GetFileName(x) != "build.gradle").ToList();

            if (gradleFiles.Count > 0)
            {
                Addressables.LogWarning($"Custom asset pack at '{androidPackDir}' contains {gradleFiles.Count} files with .gradle extension which will be ignored. " +
                                        $"Only the 'build.gradle' file will be included in the Android App Bundle.");
            }

            // Create or edit the 'build.gradle' file in the .androidpack directory
            string deliveryTypeString = CustomAssetPackUtility.DeliveryTypeToGradleString(deliveryType);
            string buildFilePath      = Path.Combine(androidPackDir, "build.gradle");
            string content            = $"apply plugin: 'com.android.asset-pack'\n\nassetPack {{\n\tpackName = \"{assetPackName}\"\n\tdynamicDelivery {{\n\t\tdeliveryType = \"{deliveryTypeString}\"\n\t}}\n}}";

            File.WriteAllText(buildFilePath, content);
        }
        void CreateConfigFiles(AddressableAssetGroup group, string assetPackName, DeliveryType deliveryType, Dictionary <string, CustomAssetPackDataEntry> assetPackToDataEntry, Dictionary <string, BuildProcessorDataEntry> bundleIdToEditorDataEntry)
        {
            foreach (AddressableAssetEntry entry in group.entries)
            {
                if (bundleIdToEditorDataEntry.ContainsKey(entry.BundleFileId))
                {
                    continue;
                }

                string bundleBuildPath = AddressablesRuntimeProperties.EvaluateString(entry.BundleFileId);
                string bundleName      = Path.GetFileNameWithoutExtension(bundleBuildPath);

                if (!assetPackToDataEntry.ContainsKey(assetPackName))
                {
                    // Create .androidpack directory and gradle file for the asset pack
                    assetPackToDataEntry[assetPackName] = new CustomAssetPackDataEntry(assetPackName, deliveryType, new List <string>()
                    {
                        bundleName
                    });
                    string androidPackDir = CreateAssetPackDirectory(assetPackName);
                    CreateOrEditGradleFile(androidPackDir, assetPackName, deliveryType);
                }
                else
                {
                    // Otherwise just save the bundle to asset pack data
                    assetPackToDataEntry[assetPackName].AssetBundles.Add(bundleName);
                }

                // Store the bundle's build path and its corresponding .androidpack folder location
                string bundlePackDir    = ConstructAssetPackDirectoryName(assetPackName);
                string assetsFolderPath = Path.Combine(bundlePackDir, Path.GetFileName(bundleBuildPath));
                bundleIdToEditorDataEntry.Add(entry.BundleFileId, new BuildProcessorDataEntry(bundleBuildPath, assetsFolderPath));
            }
        }
Exemplo n.º 22
0
        public async Task <IActionResult> Edit(int id, [Bind("DeliveryTypeID,Name,Description,IsActive,AddedDate,UpdatedDate,AddedUserID,UpdatedUserID")] DeliveryType deliveryType)
        {
            if (id != deliveryType.DeliveryTypeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    deliveryType.UpdatedDate   = DateTime.Now;
                    deliveryType.UpdatedUserID = Int32.Parse(HttpContext.Session.GetString("UserID"));
                    _context.Update(deliveryType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DeliveryTypeExists(deliveryType.DeliveryTypeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddedUserID"]   = new SelectList(_context.Users, "UserID", "Login", deliveryType.AddedUserID);
            ViewData["UpdatedUserID"] = new SelectList(_context.Users, "UserID", "Login", deliveryType.UpdatedUserID);
            return(View(deliveryType));
        }
Exemplo n.º 23
0
 private void ReturnVehicle(DeliveryType aDeliveryType)
 {
     SetModelAsNoLongerNeeded((uint)m_delivery_vehicle.Handle);
     m_delivery_vehicle.Delete();
     Screen.ShowNotification(DeliveryData._U["DELIVERY_VEHICLE_RETURNED"]);
     FinishDelivery(aDeliveryType, SafeDepositReturn.YES);
 }
Exemplo n.º 24
0
        public void Then_If_No_Location_Then_Delivery_Modes_Are_Not_Filtered(
            Shortlist source,
            DeliveryType deliveryType1,
            DeliveryType deliveryType2,
            DeliveryType deliveryType3)
        {
            //Arrange
            source.LocationDescription            = string.Empty;
            deliveryType1.Radius                  = 5;
            deliveryType1.DistanceInMiles         = 10;
            source.ProviderLocation.DeliveryTypes = new List <DeliveryType>
            {
                deliveryType1,
                deliveryType2,
                deliveryType3
            };

            //Act
            var actual = (GetShortlistItemResponse)source;

            //Assert
            actual.ProviderDetails.DeliveryTypes.Should().BeEquivalentTo(new List <DeliveryType>
            {
                deliveryType1,
                deliveryType2,
                deliveryType3
            });
        }
        public bool Save(DeliveryType obj)
        {
            Connect();
            SqlCommand cmd = new SqlCommand("IUDeliveryType", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
            cmd.Parameters.AddWithValue("@LocationID", LocationID);
            if (obj.DeliveryTypeID == 0)
            {
                cmd.Parameters.AddWithValue("@DeliveryTypeID", 0);
                cmd.Parameters.AddWithValue("@Mode", "Add");
            }
            else
            {
                cmd.Parameters.AddWithValue("@DeliveryTypeID", obj.DeliveryTypeID);
                cmd.Parameters.AddWithValue("@Mode", "Edit");
            }
            cmd.Parameters.AddWithValue("@DeliveryType", obj.DeliveryType1);

            cmd.Parameters.AddWithValue("@CreationID", UserID);
            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 26
0
        private NotificationObject CreateResearchNotification(string productUid, DeliveryType contractType, int remainingTime, string buildingKey)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            string displayName = null;
            int    level       = 0;

            if (contractType != DeliveryType.UpgradeTroop)
            {
                if (contractType != DeliveryType.UpgradeStarship)
                {
                    if (contractType == DeliveryType.UpgradeEquipment)
                    {
                        EquipmentVO equipmentVO = staticDataController.Get <EquipmentVO>(productUid);
                        displayName = LangUtils.GetEquipmentDisplayName(equipmentVO);
                        level       = equipmentVO.Lvl;
                    }
                }
                else
                {
                    SpecialAttackTypeVO specialAttackTypeVO = staticDataController.Get <SpecialAttackTypeVO>(productUid);
                    displayName = LangUtils.GetStarshipDisplayName(specialAttackTypeVO);
                    level       = specialAttackTypeVO.Lvl;
                }
            }
            else
            {
                TroopTypeVO troopTypeVO = staticDataController.Get <TroopTypeVO>(productUid);
                displayName = LangUtils.GetTroopDisplayName(troopTypeVO);
                level       = troopTypeVO.Lvl;
            }
            return(this.CreateSupportNotification(productUid, remainingTime, buildingKey, "notif3", displayName, level));
        }
Exemplo n.º 27
0
        public void Then_The_DeliveryTypes_Are_Filtered_If_The_Distance_Exceeds_The_Radius_And_There_Is_A_Location(
            Shortlist source,
            DeliveryType deliveryType1,
            DeliveryType deliveryType2,
            DeliveryType deliveryType3)
        {
            //Arrange
            deliveryType1.Radius                  = 5;
            deliveryType1.DistanceInMiles         = 10;
            source.ProviderLocation.DeliveryTypes = new List <DeliveryType>
            {
                deliveryType1,
                deliveryType2,
                deliveryType3
            };

            //Act
            var actual = (GetShortlistItemResponse)source;

            //Assert
            actual.ProviderDetails.DeliveryTypes.Should().BeEquivalentTo(new List <DeliveryType>
            {
                deliveryType2,
                deliveryType3
            });
        }
Exemplo n.º 28
0
        public bool TryEditDeliveryType(string id, uint orderNumber, DeliveryType newType)
        {
            if (!customers.TryGetValue(id, out Customer customer))
            {
                UserWarning?.Invoke("Клиент с указанным id не найден в базе");
                return(false);
            }

            if (!customer.OrderManager.TryGetOrder(orderNumber, out Order order))
            {
                UserWarning?.Invoke("Заказ с указанным номером не найден в базе");
                return(false);
            }

            if (order.state != OrderState.Formation)
            {
                UserWarning?.Invoke("Тип доставки можно менять только во время формирования заказа");
                return(false);
            }

            order.DeliveryType = newType;
            CheckCustomerDiscounts(id);
            StateChanged?.Invoke();
            return(true);
        }
Exemplo n.º 29
0
        protected void InsertAppData()
        {
            StringBuilder appDataSb = new StringBuilder();

            appDataSb.Append("window.appData = {");
            appDataSb.Append("dictionaries: {");
            appDataSb.Append("inputDocTypes: [" + FormatDictionaryList(InputDocType.GetAll(), "InputDocTypeID") + "], ");
            appDataSb.Append("inputMethods: [" + FormatDictionaryList(InputMethod.GetAll(), "InputMethodID") + "], ");
            appDataSb.Append("inputSigns: [" + FormatDictionaryList(InputSign.GetAll(), "InputSignID") + "], ");
            appDataSb.Append("inputSubjectTypes: [" + FormatDictionaryList(InputSubjectType.GetAll(), "InputSubjectTypeID") + "], ");
            appDataSb.Append("deliveryTypes: [" + FormatDictionaryList(DeliveryType.GetAll(), "DeliveryTypeID") + "] ,");
            appDataSb.Append("socialStatuses: [" + FormatDictionaryList(SocialStatus.GetAll(), "SocialStatusID") + "], ");
            appDataSb.Append("branchTypes: [" + FormatDictionaryList(BranchType.GetAll(), "BranchTypeID") + "], ");
            appDataSb.Append("socialCategories: [" + FormatDictionaryList(SocialCategory.GetAll(), "SocialCategoryID") + "], ");
            appDataSb.Append("cardStatuses: [" + FormatDictionaryList(CardStatus.GetAll(), "CardStatusID") + "], ");
            appDataSb.Append("labels: [" + FormatDictionaryList(Label.GetList(), "LabelID") + "], ");
            appDataSb.Append("docStatuses: [" + FormatDictionaryList(DocStatus.GetAll(), "DocStatusID") + "]");
            appDataSb.Append("}");
            appDataSb.Append("}");

            HtmlGenericControl scriptControl = new HtmlGenericControl("script");

            scriptControl.Attributes["type"] = "text/javascript";
            scriptControl.InnerHtml          = appDataSb.ToString();
            Page.Header.Controls.AddAt(0, scriptControl);
        }
Exemplo n.º 30
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Type")] DeliveryType deliveryType)
        {
            if (!(User.Identity.GetUserId() == "e63830c1-9176-4b57-9946-c91277275e40"))
            {
                Response.Redirect("/Home/Permissions");
            }

            if (id != deliveryType.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(deliveryType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DeliveryTypeExists(deliveryType.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(deliveryType));
        }
Exemplo n.º 31
0
        private NotificationObject CreateResearchNotification(string productUid, DeliveryType contractType, int remainingTime, string buildingKey)
        {
            IDataController dataController = Service.Get <IDataController>();
            string          displayName    = null;
            int             level          = 0;

            switch (contractType)
            {
            case DeliveryType.UpgradeTroop:
            {
                TroopTypeVO troopTypeVO = dataController.Get <TroopTypeVO>(productUid);
                displayName = LangUtils.GetTroopDisplayName(troopTypeVO);
                level       = troopTypeVO.Lvl;
                break;
            }

            case DeliveryType.UpgradeStarship:
            {
                SpecialAttackTypeVO specialAttackTypeVO = dataController.Get <SpecialAttackTypeVO>(productUid);
                displayName = LangUtils.GetStarshipDisplayName(specialAttackTypeVO);
                level       = specialAttackTypeVO.Lvl;
                break;
            }

            case DeliveryType.UpgradeEquipment:
            {
                EquipmentVO equipmentVO = dataController.Get <EquipmentVO>(productUid);
                displayName = LangUtils.GetEquipmentDisplayName(equipmentVO);
                level       = equipmentVO.Lvl;
                break;
            }
            }
            return(this.CreateSupportNotification(productUid, remainingTime, buildingKey, "notif3", displayName, level));
        }
Exemplo n.º 32
0
 public void Add(int pptId, int amount, DateTime date,DeliveryType type,string invoice,string HScode,int userid)
 {
     IProduce_ProductRepository produce_productRep = IoC.Resolve<IProduce_ProductRepository>();
     IProduce_Product prodcue_product = produce_productRep.GetById(pptId);
     //if (amount > prodcue_product.RemainAmount)
     //{
     //    throw new Exception("¼��ʧ�ܣ�������������ʣ��������");
     //}
     IDeliverys deli = _factory.CreateDelivery(prodcue_product, amount, date, type,invoice,HScode , userid);
     using (IUnitOfWork uow = IoC.Resolve<IUnitOfWork>("cat"))
     {
         prodcue_product.RemainAmount -= amount;
         _bar.Add(deli);
         uow.Commit();
     }
 }
Exemplo n.º 33
0
        public static string GetAddress(DeliveryType type, int userdId)
        {
            using(IDataReader reader = DBUser.GetUserInfo(userdId))
            {
                if(reader.Read())
                {
                    switch(type)
                    {
                        case DeliveryType.Email:
                            return Alerts2.BuldEmailAddress(reader["FirstName"].ToString(), reader["LastName"].ToString(), reader["Email"].ToString());
                        case DeliveryType.IBN:
                            return reader["OriginalId"].ToString();
                    }
                }
            }

            return null;
        }
Exemplo n.º 34
0
 public void Edit(int id, int amount, DateTime date, DeliveryType type, string invoice,string HScode, int userid)
 {
     using (IUnitOfWork uow = IoC.Resolve<IUnitOfWork>("cat"))
     {
         IDeliverys dev = _bar.GetById(id);
         dev.DDate = date;
         dev.Type = (int)type;
         dev.Invoice = invoice;
         dev.HScode = HScode;
         int val = amount - dev.Amount;
         IProduce_Product pro= dev.Produce_ProductInfo;
         pro .RemainAmount -=val ;
         //if (pro.RemainAmount < 0 || pro.RemainAmount > pro.Amount)
         //{
         //    throw new Exception("�޸�ʧ�ܣ���������");
         //}
         dev.Amount = amount;
         uow.Commit();
     }
 }
Exemplo n.º 35
0
 public DeliveryInfo(DeliveryType deliverType, long templateId, Express[] expresses)
     : this(deliverType, templateId)
 {
     TkDebug.AssertArgumentNull(expresses, "expresses", null);
     Expresses.AddRange(expresses);
 }
Exemplo n.º 36
0
		public static string GetDeliveryType(DeliveryType deliveryType, CultureInfo cultureInfo)
		{
			return Enums.ResourceManager.GetString(deliveryType.ToString(), cultureInfo);
		}
Exemplo n.º 37
0
 public RenderDeliveryType(DeliveryType dt)
 {
     DeliveryTypeID = dt.DeliveryTypeID;
     Name = Convert.ToString(dt.Name);
     Cost = Convert.ToDouble(dt.Cost);
     Description = Convert.ToString(dt.Description);
     Created = Convert.ToDateTime(dt.Created);
     Modified = Convert.ToDateTime(dt.Modified);
 }
Exemplo n.º 38
0
        /// <summary>
        /// Purpose: Grabs all delivery types
        /// Accepts: Nothing
        /// Returns: List<DeliveryType>
        /// </summary>
        public List<DeliveryType> GetAllDeliveryTypes()
        {
            List<DeliveryType> deliveryTypes = new List<DeliveryType>();
            try
            {
                DeliveryTypeData data = new DeliveryTypeData();
                List<QSRDataObjects.DeliveryType> dataDeliveryTypes = data.GetAllDeliveryTypes();

                foreach (QSRDataObjects.DeliveryType dt in dataDeliveryTypes)
                {
                    DeliveryType deliveryType = new DeliveryType();
                    deliveryType.DeliveryTypeID = dt.DeliveryTypeID;
                    deliveryType.Name = dt.Name;
                    deliveryType.Cost = Convert.ToDouble(dt.Cost);
                    deliveryType.Description = dt.Description;
                    deliveryType.Created = dt.Created;
                    deliveryType.Modified = dt.Modified;
                    deliveryTypes.Add(deliveryType);
                }
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "DeliveryType", "GetAllDeliveryTypes");
            }
            return deliveryTypes;
        }
Exemplo n.º 39
0
        internal static void SendMessage(
			DeliveryType type
			, string address
			, string body
			, string subject
			)
        {
            SendMessage(type, null, address, body, subject);
        }
Exemplo n.º 40
0
 internal string GetAddress(DeliveryType type)
 {
     switch (type)
     {
         case DeliveryType.Email:
             return Alerts2.BuldEmailAddress(FirstName, LastName, Email);
         case DeliveryType.IBN:
             return ImId.ToString(CultureInfo.InvariantCulture);
     }
     return null;
 }
Exemplo n.º 41
0
        /// <summary>
        /// Sends the message.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="from">From.</param>
        /// <param name="address">The address.</param>
        /// <param name="body">The body.</param>
        /// <param name="subject">The subject.</param>
        /// <param name="attachments">The attachments.</param>
        /// <remarks>
        /// Primary Method
        /// </remarks>
        private static void SendMessage(
			DeliveryType type
			, string from
			, string address
			, string body
			, string subject
			//, Attachment[] attachments
			)
        {
            IAlertService5 alertService = GetAlertService();
            if (alertService != null)
            {
                switch (type)
                {
                    case DeliveryType.Email:
                        string sender = null;

                        if (!string.IsNullOrEmpty(from))
                            sender = BuldEmailAddress(null, null, from);
                        else
                            sender = BuldEmailAddress(AlertSenderFirstName, AlertSenderLastName, AlertSenderEmail);

                        if (!string.IsNullOrEmpty(sender))
                        {
                            IEmailAlertMessage6 msg = CreateEmailAlertMessage(alertService);
                            msg.Sender = sender;
                            msg.Recipient = address;
                            msg.Subject = subject;
                            msg.Body = body;

                            //if (attachments != null)
                            //{
                            //    byte[] buf = new byte[4096];
                            //    IEmailAlertAttachment iAtt;
                            //    int read;
                            //    foreach (Attachment att in attachments)
                            //    {
                            //        iAtt = msg.CreateAttachment(att.FileName);
                            //        if (iAtt != null)
                            //        {
                            //            do
                            //            {
                            //                read = att.Data.Read(buf, 0, buf.Length);
                            //                iAtt.Write(buf, read);
                            //            } while (read == buf.Length);
                            //            iAtt.Complete();
                            //        }
                            //    }
                            //}
                            msg.BeginSend();
                        }
                        break;
                    case DeliveryType.IBN:
                        if (PortalConfig.UseIM && !string.IsNullOrEmpty(AlertSenderIM))
                        {
                            IIbnAlertMessage msgIbn = alertService.CreateIbnAlert();
                            msgIbn.Sender = AlertSenderIM;
                            msgIbn.Recipient = address;
                            msgIbn.Body = body;
                            msgIbn.BeginSend();
                        }
                        break;
                }
            }
        }
Exemplo n.º 42
0
        private static void SendBatch(UserInfo ui, DeliveryType deliveryType, Message msg)
        {
            try
            {
                //Attachment[] attachments = null;
                //if (deliveryType == DeliveryType.Email)
                //    attachments = (Attachment[])msg.Attachments.ToArray(typeof(Attachment));

                using (DbTransaction tran = DbTransaction.Begin())
                {
                    SendMessage(deliveryType, ui.EmailFrom, ui.GetAddress(deliveryType), msg.Body, msg.Subject/*, attachments*/);
                    foreach (RecipientInfo ri in ui.Recipients)
                    {
                        DBSystemEvents.RecipientUpdateSent(ri.RecipientId, (int)deliveryType, true);
                    }
                    tran.Commit();
                }
            }
            catch (Exception ex)
            {
                Log.WriteError(ex.ToString());
            }
        }
Exemplo n.º 43
0
    //public DrugOrder GetDrugID(int id)
    //{
    //    foreach (DrugOrder drug in drugOrders)
    //    {
    //        if (drug.drugID == id)
    //            return drug;
    //    }
    //    return null;
    //}

    public DrugEntry CheckItem(string name, int dosage, DoseType doseType, DeliveryType delivery, int time, IntervalType interval)
    {
        foreach (DrugEntry entry in drugEntries)
        {
            if (entry.name == name && entry.dosage == dosage && entry.doseType == doseType && entry.delivery == delivery &&
                entry.time == time && entry.interval == interval)
                return entry;
        }
        return null;
    }
Exemplo n.º 44
0
        public DeliveryLineVM(Commodity commodity, CommodityType commodityType, Brand brand, Specification specification,
                              List<DeliveryLine> deliveryLines, List<DeliveryLine> addDeliveryLines,DeliveryType deliveryType,decimal? qty)
        {
            ObjectId = 0;
            DeliveryType = deliveryType;
            AllDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            AddDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            DeliveryLines = deliveryLines;
            AddedDeliveryLines = addDeliveryLines;
            Commodity = commodity;
            CommodityId = commodity.Id;
            CommodityTypeId = commodityType.Id;
            _brandId = brand == null ? 0 : brand.Id;

            SpecificationId = specification == null ? 0 : specification.Id;

            _startStatus = true;
            LoadCommodityType();

            LoadCountry();
            LoadStatus();
            LoadDocumentLineEnableProperty(ObjectId);

            if (deliveryLines == null || deliveryLines.Count == 0)
            { 
                //第一次新增
                if (deliveryType == DeliveryType.ExternalTDBOL || deliveryType == DeliveryType.ExternalTDWW)
                {
                    NetWeight = qty;
                    GrossWeight = qty;
                }
                else if (deliveryType == DeliveryType.InternalTDBOL || deliveryType == DeliveryType.InternalTDWW)
                {
                    NetWeight = qty;
                    VerifiedWeight = qty;
                }
            }
            PropertyChanged += OnPropertyChanged;
        }
Exemplo n.º 45
0
        /// <summary>
        /// Get the list of messages that have finished delivery. This will include those that were successfully delivered, as well as those that failed due to hard or soft bounces.
        /// </summary>
        /// <param name="mailingId">Mailing Identifier</param>
        /// <param name="result">Optional. Accepted options: ‘all’, ‘delivered’, ‘bounced’, ‘hard’, ‘soft’. Defaults to ‘all’, if not provided.</param>
        /// <param name="start">Start paging record at.</param>
        /// <param name="end">End paging record at.</param>
        /// <returns>An array of message responses that have finished delivery.</returns>
        /// <remarks>Http404 if the mailing does not exist. Http404 if the mailing is not valid mailing type - ‘m’ for standard mailings, ‘t’ for test mailings and ‘r’ for trigger mailings.</remarks>
        public List<ResponseDeliveries> GetMailingDelieveries(string mailingId, DeliveryType result = DeliveryType.All, int start = -1, int end = -1)
        {
            var request = new RestRequest();
            request.Resource = "/{accountId}/response/{mailingId}/deliveries";
            request.AddUrlSegment("mailingId", mailingId);

            request.AddParameter("result", result.ToEnumString<DeliveryType>());

            return Execute<List<ResponseDeliveries>>(request, start, end);
        }
Exemplo n.º 46
0
        /// <summary>
        /// Get the count of the list of messages that have finished delivery. This will include those that were successfully delivered, as well as those that failed due to hard or soft bounces.
        /// </summary>
        /// <param name="mailingId">Mailing Identifier</param>
        /// <param name="result">Optional. Accepted options: ‘all’, ‘delivered’, ‘bounced’, ‘hard’, ‘soft’. Defaults to ‘all’, if not provided.</param>
        /// <returns>An array of message responses that have finished delivery.</returns>
        /// <remarks>Http404 if the mailing does not exist. Http404 if the mailing is not valid mailing type - ‘m’ for standard mailings, ‘t’ for test mailings and ‘r’ for trigger mailings.</remarks>
        public int GetMailingDelieveriesCount(string mailingId, DeliveryType result = DeliveryType.All)
        {
            var request = new RestRequest();
            request.Resource = "/{accountId}/response/{mailingId}/deliveries";
            request.AddUrlSegment("mailingId", mailingId);
            request.AddParameter("count", "true");

            request.AddParameter("result", result.ToEnumString<DeliveryType>());

            return Execute<int>(request);
        }
Exemplo n.º 47
0
        public DeliveryLineVM(int id, Commodity commodity, List<DeliveryLine> deliveryLines,
                              List<DeliveryLine> addDeliveryLines, List<DeliveryLine> updateDeliveryLines,DeliveryType deliveryType)
        {
            ObjectId = id;
            OldID = id;
            DeliveryType = deliveryType;
            DeliveryLines = deliveryLines;
            //SetID(id);
            AllDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            AddDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            UpdateDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();
            DeleteDeliveryPersonList = new List<WarehouseOutDeliveryPerson>();

            AddedDeliveryLines = addDeliveryLines;
            UpdatedDeliveryLines = updateDeliveryLines;
            Commodity = commodity;
            CommodityId = commodity.Id;
            
            _startStatus = true;
            LoadCommodityType();
            LoadCountry();
            LoadDeliveryLine(GetDeliveryLineFromList(id, deliveryLines));

            LoadStatus();
            LoadDocumentLineEnableProperty(ObjectId);
            PropertyChanged += OnPropertyChanged;
        }
Exemplo n.º 48
0
 private DeliveryInfo(DeliveryType deliverType, long templateId)
 {
     DeliveryType = deliverType;
     TemplateId = templateId;
     Expresses = new List<Express>();
 }
Exemplo n.º 49
0
 public ProductDeliveryInfo SetDeliveryType(DeliveryType deliveryType)
 {
     this.deliveryType = deliveryType;
     return this;
 }