public void LookupCouponInvoice() { var discounts = new Dictionary<string, int> { { "USD", 1000 } }; var coupon = new Coupon(GetMockCouponCode(), GetMockCouponName(), discounts); coupon.Create(); var plan = new Plan(GetMockPlanCode(), GetMockPlanCode()) { Description = "Test Lookup Coupon Invoice" }; plan.UnitAmountInCents.Add("USD", 1500); plan.Create(); PlansToDeactivateOnDispose.Add(plan); var account = CreateNewAccountWithBillingInfo(); var redemption = account.RedeemCoupon(coupon.CouponCode, "USD"); var sub = new Subscription(account, plan, "USD", coupon.CouponCode); sub.Create(); // TODO complete this test var invoices = account.GetInvoices(); invoices.Should().NotBeEmpty(); var invoice = Invoices.Get(invoices.First().InvoiceNumber); var fromInvoice = invoice.GetRedemption(); redemption.Should().Be(fromInvoice); }
public void CreatePlan() { var plan = new Plan(GetMockPlanCode(), GetMockPlanName()) { AccountingCode = "accountingcode123", SetupFeeAccountingCode = "setupfeeac", Description = "a test plan", DisplayDonationAmounts = true, DisplayPhoneNumber = false, DisplayQuantity = true, TotalBillingCycles = 5, TrialIntervalUnit = Plan.IntervalUnit.Months, TrialIntervalLength = 1, PlanIntervalUnit = Plan.IntervalUnit.Days, PlanIntervalLength = 180 }; plan.SetupFeeInCents.Add("USD", 500); plan.Create(); PlansToDeactivateOnDispose.Add(plan); plan.CreatedAt.Should().NotBe(default(DateTime)); plan.AccountingCode.Should().Be("accountingcode123"); plan.SetupFeeAccountingCode.Should().Be("setupfeeac"); plan.Description.Should().Be("a test plan"); plan.DisplayDonationAmounts.Should().HaveValue().And.Be(true); plan.DisplayPhoneNumber.Should().HaveValue().And.Be(false); plan.DisplayQuantity.Should().HaveValue().And.Be(true); plan.TotalBillingCycles.Should().Be(5); plan.TrialIntervalUnit.Should().Be(Plan.IntervalUnit.Months); plan.TrialIntervalLength.Should().Be(1); plan.PlanIntervalUnit.Should().Be(Plan.IntervalUnit.Days); plan.PlanIntervalLength.Should().Be(180); }
public void ListExpiredSubscriptions() { var plan = new Plan(GetMockPlanCode(), GetMockPlanName()) { Description = "Subscription Test", PlanIntervalLength = 1, PlanIntervalUnit = Plan.IntervalUnit.Months }; plan.UnitAmountInCents.Add("USD", 400); plan.Create(); PlansToDeactivateOnDispose.Add(plan); for (var x = 0; x < 2; x++) { var account = CreateNewAccountWithBillingInfo(); var sub = new Subscription(account, plan, "USD") { StartsAt = DateTime.Now.AddMonths(-5) }; sub.Create(); } var subs = Subscriptions.List(Subscription.SubscriptionState.Expired); subs.Should().NotBeEmpty(); }
public void GetAllPlansTest() { // Setup dependency var settingsMock = new Mock<ISettings>(); var repositoryMock = new Mock<IRepository>(); var uowMock = new Mock<IUnitOfWork>(); var serviceLocatorMock = new Mock<IServiceLocator>(); serviceLocatorMock.Setup(x => x.GetInstance<IRepository>()) .Returns(repositoryMock.Object); ServiceLocator.SetLocatorProvider(() => serviceLocatorMock.Object); // Arrange decimal expectedResult = 10; List<Plan> plans = new List<Plan>(); for (int i = 0; i < expectedResult; i++) { Plan plan = new Plan { Id = Guid.NewGuid() }; plans.Add(plan); } repositoryMock.Setup(r => r.Query<Plan>()).Returns(plans.AsQueryable()); // Act PlanService bookingService = new PlanService(uowMock.Object, repositoryMock.Object, settingsMock.Object); List<PlanDto> currentResult = bookingService.GetAllPlans(); // Assert repositoryMock.Verify(repo => repo.Query<Plan>()); Assert.AreEqual(expectedResult, currentResult.Count()); }
/// <summary> /// Initializes a new instance of the <see cref="CopySaveOptionsWindow"/> class. /// </summary> /// <param name="pto">The pto.</param> /// <param name="plan">The p.</param> /// <param name="isForCopy">if set to <c>true</c> [is for copy].</param> public CopySaveOptionsWindow(PlanExportSettings pto, Plan plan, bool isForCopy) : this() { m_planTextOptions = pto; m_plan = plan; m_isForCopy = isForCopy; }
public void CreateSubscription() { var plan = new Plan(GetMockPlanCode(), GetMockPlanName()) { Description = "Create Subscription Test" }; plan.UnitAmountInCents.Add("USD", 100); plan.Create(); PlansToDeactivateOnDispose.Add(plan); var account = CreateNewAccountWithBillingInfo(); var coup = CreateNewCoupon(3); var sub = new Subscription(account, plan, "USD"); sub.TotalBillingCycles = 5; sub.Coupon = coup; Assert.Null(sub.TaxInCents); Assert.Null(sub.TaxType); Assert.Null(sub.TaxRate); sub.Create(); sub.ActivatedAt.Should().HaveValue().And.NotBe(default(DateTime)); sub.State.Should().Be(Subscription.SubscriptionState.Active); Assert.Equal(5, sub.TotalBillingCycles); Assert.Equal(coup.CouponCode, sub.Coupon.CouponCode); Assert.Equal(9, sub.TaxInCents.Value); Assert.Equal("usst", sub.TaxType); Assert.Equal(0.0875M, sub.TaxRate.Value); var sub1 = Subscriptions.Get(sub.Uuid); Assert.Equal(5, sub1.TotalBillingCycles); }
private int CalculateAdvantage(Plan plan) { IDictionary<IPlayer, int> scores = GameState.Players.ToDictionary(p => p, p => GameState.PlayerScore(p)+plan.Worth(p)); if (scores[Player]>scores.Where(kvp => kvp.Key != Player).Max(kvp => kvp.Value)) return scores.Where(kvp => kvp.Key != Player).Sum(kvp => scores[Player]-kvp.Value); return scores.Where(kvp => kvp.Key != Player && kvp.Value>scores[Player]).Sum(kvp => scores[Player]-kvp.Value); }
/// <summary> /// When the user clicks "load", import the plan. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLoad_Click(object sender, EventArgs e) { SourcePlan = (Plan)lbPlan.SelectedItem; TargetPlan = SourcePlan.Clone(TargetCharacter); DialogResult = DialogResult.OK; Close(); }
private static void EnqueuePlan(Plan plan, Queue<object> queue) { queue.Enqueue(plan.Tile); queue.Enqueue(plan.Space); if (plan.Arguments != null) foreach (object item in plan.Arguments) queue.Enqueue(item); }
public void TestDefaults() { var plan = new Plan(); Assert.That(plan.Executable, Is.Null); Assert.That(plan.Assembly, Is.Null); Assert.That(plan.Run, Is.Null); Assert.That(plan.ID, Is.Null); }
public void CreatePlanSmall() { var plan = new Plan(GetMockPlanCode(), GetMockPlanName()); plan.SetupFeeInCents.Add("USD", 100); plan.Create(); PlansToDeactivateOnDispose.Add(plan); plan.CreatedAt.Should().NotBe(default(DateTime)); plan.SetupFeeInCents.Should().Contain("USD", 100); }
public void ListPlans() { var plan = new Plan(GetMockPlanCode(), GetMockPlanName()); plan.SetupFeeInCents.Add("USD", 100); plan.Create(); PlansToDeactivateOnDispose.Add(plan); var plans = Plans.List(); plans.Should().NotBeEmpty(); }
public AttributesOptimizationSettingsForm(Plan plan) { InitializeComponent(); buttonWholePlan.Font = FontFactory.GetFont("Microsoft Sans Serif", 10F); buttonCharacter.Font = FontFactory.GetFont("Microsoft Sans Serif", 10F); buttonRemappingPoints.Font = FontFactory.GetFont("Microsoft Sans Serif", 10F); m_plan = plan; m_character = (Character)plan.Character; }
/// <summary> /// Constructor /// </summary> /// <param name="plan">The plan.</param> private PlanPrinter(Plan plan) { m_plan = plan; m_plan.UpdateStatistics(); m_character = (Character)plan.Character; m_settings = Settings.Exportation.PlanToText; m_font = FontFactory.GetFont("Arial", 10); m_boldFont = FontFactory.GetFont("Arial", 10, FontStyle.Bold | FontStyle.Underline); }
/// <summary> /// Constructor for use in code when the user wants to manually edit a remapping point. /// </summary> /// <param name="character">Character information</param> /// <param name="plan">Plan to optimize for</param> /// <param name="strategy">Optimization strategy</param> /// <param name="name">Title of this form</param> /// <param name="description">Description of the optimization operation</param> public AttributesOptimizationForm(Character character, Plan plan, RemappingPoint point) : this() { m_plan = plan; m_character = character; m_baseCharacter = character.After(plan.ChosenImplantSet); m_manuallyEditedRemappingPoint = point; m_strategy = Strategy.ManualRemappingPointEdition; m_description = "Manual editing of a remapping point"; Text = "Remapping point manual editing (" + plan.Name + ")"; }
/// <summary> /// Constructor /// </summary> public EFTLoadoutImportationForm(Plan plan) { InitializeComponent(); topSplitContainer.RememberDistanceKey = "EFTLoadoutImportationForm"; m_plan = plan; m_character = m_plan.Character; EveClient.CharacterChanged += EveClient_CharacterChanged; EveClient.PlanChanged += EveClient_PlanChanged; }
/// <summary> /// Creates the dialog based upon a plan. /// </summary> /// <param name="plan">Plan to display obsolete entries from</param> /// <returns>Action to be taken</returns> public static ObsoleteEntriesAction ShowDialog(Plan plan) { if (plan == null) return ObsoleteEntriesAction.None; if (!plan.ContainsObsoleteEntries) return ObsoleteEntriesAction.None; ObsoleteEntriesForm form = new ObsoleteEntriesForm(plan); return form.ShowObsoleteEntriesDialog(); }
/// <summary> /// Constructor. /// </summary> /// <param name="plan">The plan.</param> /// <exception cref="System.ArgumentNullException">plan</exception> public LoadoutImportationWindow(Plan plan) : this() { plan.ThrowIfNull(nameof(plan)); Plan = plan; EveMonClient.CharacterUpdated += EveMonClient_CharacterUpdated; EveMonClient.PlanChanged += EveMonClient_PlanChanged; EveMonClient.PlanNameChanged += EveMonClient_PlanNameChanged; }
/// <summary> /// Creates the dialog based upon a plan. /// </summary> /// <param name="plan">Plan to display obsolete entries from</param> /// <returns>Action to be taken</returns> public static ObsoleteEntriesAction ShowDialog(Plan plan) { if (plan == null) return ObsoleteEntriesAction.None; if (!plan.ContainsObsoleteEntries) return ObsoleteEntriesAction.None; using (ObsoleteEntriesWindow form = new ObsoleteEntriesWindow(plan)) { return form.ShowObsoleteEntriesDialog(); } }
/// <summary> /// Constructor /// </summary> /// <param name="ship"></param> /// <param name="plan"></param> public ShipLoadoutSelectWindow(Item ship, Plan plan) : this() { this.persistentSplitContainer1.RememberDistanceKey = "ShipLoadoutBrowser"; m_character = (Character)plan.Character; m_plan = plan; m_ship = ship; m_columnSorter = new LoadoutListSorter(this); m_columnSorter.OrderOfSort = SortOrder.Descending; m_columnSorter.SortColumn = 2; lvLoadouts.ListViewItemSorter = m_columnSorter; }
static void CompileFcToIp(string sourcePath) { CompileFcToQd(sourcePath); var implementationPlan = new Plan(Opertaions, QDeterminant); if (countNode > 0) { implementationPlan.OptimizeForMaxEffective(countNode); } var IPConverter = Manufactory.CreateImplementationPlanConverter(ConverterTypes.JSON); IPConverter.SetBlocks(implementationPlan.GetVertexGraph()); IPConverter.SetLinks(implementationPlan.GetEdgesGraph()); Console.WriteLine("Save IP"); IPConverter.SaveToFile(Path.GetDirectoryName(sourcePath) + @"\ImplementationPlan.ip"); }
public MainWindow() { InitializeComponent(); _plan = (Plan)FindResource("Plan"); _log = (Plan)FindResource("Log"); Closing += OnClosing; if (_json.FolderExists() == true) { _plan = _json.Deserialize(); } }
public void AddAddOnSucceedsWhenCurrencyMatches() { var account = new Account("1"); var plan = new Plan(GetMockPlanCode(), GetMockPlanName()); plan.UnitAmountInCents.Add(USD, 100); var addOn = plan.NewAddOn("1", "test"); addOn.UnitAmountInCents.Add(USD, 200); var sub = new Subscription(account, plan, USD); Action a = () => sub.AddOns.Add(addOn); a.ShouldNotThrow<ValidationException>(); }
/// <summary> /// Constructor /// </summary> /// <param name="plan">Plan to display obsolete entries from</param> private ObsoleteEntriesWindow(Plan plan) { InitializeComponent(); m_plan = plan; if (Settings.UI.PlanWindow.ObsoleteEntryRemovalBehaviour == ObsoleteEntryRemovalBehaviour.RemoveConfirmed) { ObsoleteEntriesListView.Columns.RemoveAt(ObsoleteEntriesListView.Columns.Count - 1); RemoveConfirmedButton.Visible = false; } UpdateListView(); AutoFitColumnHeaders(); }
private void button2_Click(object sender, RoutedEventArgs e) { Plan p = new Plan(); p = Parser.ParseXML(textBox1.Text); Plan p2 = p.ConsistentAccordance(); //if plan has a consistent accordance, if (p2.HasOfferings()) { MessageBox.Show("The plan has consistent accordance(s):\n" + p2.ToString()); } else { MessageBox.Show("The plan has no consistent accordances."); } }
public void LookupPlan() { var plan = new Plan(GetMockPlanCode(), GetMockPlanName()) {Description = "Test Lookup"}; plan.UnitAmountInCents.Add("USD", 100); plan.TaxExempt = true; plan.Create(); PlansToDeactivateOnDispose.Add(plan); plan.CreatedAt.Should().NotBe(default(DateTime)); var fromService = Plans.Get(plan.PlanCode); fromService.PlanCode.Should().Be(plan.PlanCode); fromService.UnitAmountInCents.Should().Contain("USD", 100); fromService.Description.Should().Be("Test Lookup"); Assert.True(plan.TaxExempt.Value); }
public void AddPlan(Plan plan) { RestRequest request = new RestRequest("https://viitrumobileproduct.azure-mobile.net/tables/plan"); request.Method = Method.POST; request.AddHeader("X-ZUMO-APPLICATION", AppKey); string jasonPlan = JsonConvert.SerializeObject(plan, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); request.AddParameter("application/json", jasonPlan, ParameterType.RequestBody); RestClient client = new RestClient(); var response = client.Execute(request); }
public Subscription(Plan plan, string state, int quantity, int amountInCents, DateTime activatedAt, DateTime canceledAt, DateTime expiresAt, DateTime currentPeriodStartsAt, DateTime currentPeriodEndsAt, DateTime? trialStartedAt, DateTime? trialEndsAt) { Plan = plan; State = state; Quantity = quantity; AmountInCents = amountInCents; ActivatedAt = activatedAt; CanceledAt = canceledAt; ExpiresAt = expiresAt; CurrentPeriodStartedAt = currentPeriodStartsAt; CurrentPeriodEndsAt = currentPeriodEndsAt; TrialStartedAt = trialStartedAt; TrialEndsAt = trialEndsAt; }
public void ListActiveSubscriptions() { var p = new Plan(GetMockPlanCode(), GetMockPlanName()) { Description = "Subscription Test" }; p.UnitAmountInCents.Add("USD", 300); p.Create(); PlansToDeactivateOnDispose.Add(p); for (var x = 0; x < 2; x++) { var account = CreateNewAccountWithBillingInfo(); var sub = new Subscription(account, p, "USD"); sub.Create(); } var subs = Subscriptions.List(Subscription.SubscriptionState.Active); subs.Should().NotBeEmpty(); }
public void UpdatePlan() { var plan = new Plan(GetMockPlanCode(), GetMockPlanName()) {Description = "Test Update"}; plan.UnitAmountInCents.Add("USD", 100); plan.Create(); PlansToDeactivateOnDispose.Add(plan); plan.UnitAmountInCents["USD"] = 5000; plan.SetupFeeInCents["USD"] = 100; plan.TaxExempt = false; plan.Update(); plan = Plans.Get(plan.PlanCode); plan.UnitAmountInCents.Should().Contain("USD", 5000); plan.SetupFeeInCents.Should().Contain("USD", 100); Assert.False(plan.TaxExempt.Value); }
public UCCompleteOperator(Plan plan) { InitializeComponent(); _transaction = new CompletePlanOperatorTransaction(plan); _plan = plan; }
public Plan GetPlanDetailByPlanCode(string planCode) { Plan plan = context.plans.FirstOrDefault(x => x.IsActive == true && x.PlanCode == planCode); return(plan); }
private void Run() { // Sku Sku vSku = null; // Plan Plan vPlan = null; // UpgradePolicy UpgradePolicy vUpgradePolicy = null; // AutomaticRepairsPolicy PSAutomaticRepairsPolicy vAutomaticRepairsPolicy = null; // VirtualMachineProfile PSVirtualMachineScaleSetVMProfile vVirtualMachineProfile = null; // ProximityPlacementGroup SubResource vProximityPlacementGroup = null; // AdditionalCapabilities AdditionalCapabilities vAdditionalCapabilities = null; // ScaleInPolicy ScaleInPolicy vScaleInPolicy = null; // Identity VirtualMachineScaleSetIdentity vIdentity = null; if (this.IsParameterBound(c => c.SkuName)) { if (vSku == null) { vSku = new Sku(); } vSku.Name = this.SkuName; } if (this.IsParameterBound(c => c.SkuTier)) { if (vSku == null) { vSku = new Sku(); } vSku.Tier = this.SkuTier; } if (this.IsParameterBound(c => c.SkuCapacity)) { if (vSku == null) { vSku = new Sku(); } vSku.Capacity = this.SkuCapacity; } if (this.IsParameterBound(c => c.PlanName)) { if (vPlan == null) { vPlan = new Plan(); } vPlan.Name = this.PlanName; } if (this.IsParameterBound(c => c.PlanPublisher)) { if (vPlan == null) { vPlan = new Plan(); } vPlan.Publisher = this.PlanPublisher; } if (this.IsParameterBound(c => c.PlanProduct)) { if (vPlan == null) { vPlan = new Plan(); } vPlan.Product = this.PlanProduct; } if (this.IsParameterBound(c => c.PlanPromotionCode)) { if (vPlan == null) { vPlan = new Plan(); } vPlan.PromotionCode = this.PlanPromotionCode; } if (this.IsParameterBound(c => c.UpgradePolicyMode)) { if (vUpgradePolicy == null) { vUpgradePolicy = new UpgradePolicy(); } vUpgradePolicy.Mode = this.UpgradePolicyMode; } if (this.IsParameterBound(c => c.RollingUpgradePolicy)) { if (vUpgradePolicy == null) { vUpgradePolicy = new UpgradePolicy(); } vUpgradePolicy.RollingUpgradePolicy = this.RollingUpgradePolicy; } if (vUpgradePolicy == null) { vUpgradePolicy = new UpgradePolicy(); } if (vUpgradePolicy.AutomaticOSUpgradePolicy == null) { vUpgradePolicy.AutomaticOSUpgradePolicy = new AutomaticOSUpgradePolicy(); } vUpgradePolicy.AutomaticOSUpgradePolicy.EnableAutomaticOSUpgrade = this.AutoOSUpgrade.IsPresent; if (this.EnableAutomaticRepair.IsPresent) { if (vAutomaticRepairsPolicy == null) { vAutomaticRepairsPolicy = new PSAutomaticRepairsPolicy(); } vAutomaticRepairsPolicy.Enabled = this.EnableAutomaticRepair.IsPresent; } if (this.IsParameterBound(c => c.AutomaticRepairGracePeriod)) { if (vAutomaticRepairsPolicy == null) { vAutomaticRepairsPolicy = new PSAutomaticRepairsPolicy(); } vAutomaticRepairsPolicy.GracePeriod = this.AutomaticRepairGracePeriod; } if (this.IsParameterBound(c => c.DisableAutoRollback)) { if (vUpgradePolicy == null) { vUpgradePolicy = new UpgradePolicy(); } if (vUpgradePolicy.AutomaticOSUpgradePolicy == null) { vUpgradePolicy.AutomaticOSUpgradePolicy = new AutomaticOSUpgradePolicy(); } vUpgradePolicy.AutomaticOSUpgradePolicy.DisableAutomaticRollback = this.DisableAutoRollback; } if (this.IsParameterBound(c => c.OsProfile)) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } vVirtualMachineProfile.OsProfile = this.OsProfile; } if (this.IsParameterBound(c => c.StorageProfile)) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } vVirtualMachineProfile.StorageProfile = this.StorageProfile; } if (this.IsParameterBound(c => c.HealthProbeId)) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } if (vVirtualMachineProfile.NetworkProfile == null) { vVirtualMachineProfile.NetworkProfile = new VirtualMachineScaleSetNetworkProfile(); } if (vVirtualMachineProfile.NetworkProfile.HealthProbe == null) { vVirtualMachineProfile.NetworkProfile.HealthProbe = new ApiEntityReference(); } vVirtualMachineProfile.NetworkProfile.HealthProbe.Id = this.HealthProbeId; } if (this.IsParameterBound(c => c.NetworkInterfaceConfiguration)) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } if (vVirtualMachineProfile.NetworkProfile == null) { vVirtualMachineProfile.NetworkProfile = new VirtualMachineScaleSetNetworkProfile(); } vVirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations = this.NetworkInterfaceConfiguration; } if (this.IsParameterBound(c => c.BootDiagnostic)) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } if (vVirtualMachineProfile.DiagnosticsProfile == null) { vVirtualMachineProfile.DiagnosticsProfile = new DiagnosticsProfile(); } vVirtualMachineProfile.DiagnosticsProfile.BootDiagnostics = this.BootDiagnostic; } if (this.IsParameterBound(c => c.Extension)) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } if (vVirtualMachineProfile.ExtensionProfile == null) { vVirtualMachineProfile.ExtensionProfile = new PSVirtualMachineScaleSetExtensionProfile(); } vVirtualMachineProfile.ExtensionProfile.Extensions = this.Extension; } if (this.IsParameterBound(c => c.LicenseType)) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } vVirtualMachineProfile.LicenseType = this.LicenseType; } if (this.IsParameterBound(c => c.Priority)) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } vVirtualMachineProfile.Priority = this.Priority; } if (this.IsParameterBound(c => c.EvictionPolicy)) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } vVirtualMachineProfile.EvictionPolicy = this.EvictionPolicy; } if (this.IsParameterBound(c => c.MaxPrice)) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } if (vVirtualMachineProfile.BillingProfile == null) { vVirtualMachineProfile.BillingProfile = new BillingProfile(); } vVirtualMachineProfile.BillingProfile.MaxPrice = this.MaxPrice; } if (this.TerminateScheduledEvents.IsPresent) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } if (vVirtualMachineProfile.ScheduledEventsProfile == null) { vVirtualMachineProfile.ScheduledEventsProfile = new ScheduledEventsProfile(); } if (vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile == null) { vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile = new TerminateNotificationProfile(); } vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile.Enable = this.TerminateScheduledEvents.IsPresent; } if (this.IsParameterBound(c => c.TerminateScheduledEventNotBeforeTimeoutInMinutes)) { if (vVirtualMachineProfile == null) { vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); } if (vVirtualMachineProfile.ScheduledEventsProfile == null) { vVirtualMachineProfile.ScheduledEventsProfile = new ScheduledEventsProfile(); } if (vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile == null) { vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile = new TerminateNotificationProfile(); } vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile.NotBeforeTimeout = XmlConvert.ToString(new TimeSpan(0, this.TerminateScheduledEventNotBeforeTimeoutInMinutes, 0)); } if (this.IsParameterBound(c => c.ProximityPlacementGroupId)) { if (vProximityPlacementGroup == null) { vProximityPlacementGroup = new SubResource(); } vProximityPlacementGroup.Id = this.ProximityPlacementGroupId; } if (this.EnableUltraSSD.IsPresent) { if (vAdditionalCapabilities == null) { vAdditionalCapabilities = new AdditionalCapabilities(true); } } if (this.IsParameterBound(c => c.ScaleInPolicy)) { if (vScaleInPolicy == null) { vScaleInPolicy = new ScaleInPolicy(); } vScaleInPolicy.Rules = this.ScaleInPolicy; } if (this.AssignIdentity.IsPresent) { if (vIdentity == null) { vIdentity = new VirtualMachineScaleSetIdentity(); } vIdentity.Type = ResourceIdentityType.SystemAssigned; } if (this.IsParameterBound(c => c.IdentityType)) { if (vIdentity == null) { vIdentity = new VirtualMachineScaleSetIdentity(); } vIdentity.Type = this.IdentityType; } if (this.IsParameterBound(c => c.IdentityId)) { if (vIdentity == null) { vIdentity = new VirtualMachineScaleSetIdentity(); } vIdentity.UserAssignedIdentities = new Dictionary <string, VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue>(); foreach (var id in this.IdentityId) { vIdentity.UserAssignedIdentities.Add(id, new VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue()); } } var vVirtualMachineScaleSet = new PSVirtualMachineScaleSet { Overprovision = this.IsParameterBound(c => c.Overprovision) ? this.Overprovision : (bool?)null, DoNotRunExtensionsOnOverprovisionedVMs = this.SkipExtensionsOnOverprovisionedVMs.IsPresent ? true : (bool?)null, SinglePlacementGroup = this.IsParameterBound(c => c.SinglePlacementGroup) ? this.SinglePlacementGroup : (bool?)null, ZoneBalance = this.ZoneBalance.IsPresent ? true : (bool?)null, PlatformFaultDomainCount = this.IsParameterBound(c => c.PlatformFaultDomainCount) ? this.PlatformFaultDomainCount : (int?)null, Zones = this.IsParameterBound(c => c.Zone) ? this.Zone : null, Location = this.IsParameterBound(c => c.Location) ? this.Location : null, Tags = this.IsParameterBound(c => c.Tag) ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null, Sku = vSku, Plan = vPlan, UpgradePolicy = vUpgradePolicy, AutomaticRepairsPolicy = vAutomaticRepairsPolicy, VirtualMachineProfile = vVirtualMachineProfile, ProximityPlacementGroup = vProximityPlacementGroup, AdditionalCapabilities = vAdditionalCapabilities, ScaleInPolicy = vScaleInPolicy, Identity = vIdentity, }; WriteObject(vVirtualMachineScaleSet); }
private void SaveEntity(Plan plan) { this.Logic.Save(plan); }
public int GuardarPlan(Plan _plan) { return(Convert.ToInt32(MapperPro.Instance().Insert("insert_plan", _plan))); }
public Respuesta PlanDetails([FromUri] string u, [FromUri] string t, [FromUri] int centro_id, [FromUri] int id) { Respuesta respuesta = new Respuesta(); respuesta.resultado = 0; //respuesta.mensaje = n + ", " + h + ", " + centro_id + ", " + id;return respuesta; string verification_result = Tools.VerifyToken(new Token() { usuario = u, token = t }, 0); if (verification_result != "1") { respuesta.mensaje = verification_result; return(respuesta); } int centro = 0; int plan_id = 0; try { using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["APIDB"].ConnectionString)) { using (MacEntities db = new MacEntities()) { centro = (from c in db.tbl_centros where c.id == centro_id select c.id).FirstOrDefault(); if (centro == 0) { respuesta.mensaje = "Error, centro no encontrado."; return(respuesta); } plan_id = (from p in db.tbl_planes where p.id == id select p.id).FirstOrDefault(); if (plan_id == 0) { respuesta.mensaje = "Error, plan no encontrado."; return(respuesta); } } // var query = "select tbl_planes.id, tbl_escalas_precios.niveles, tbl_escalas_precios.horas, "+ //"tbl_escalas_precios.precio, tbl_escalas_precios.enganche, tbl_escalas_precios.monto_mensualidades, "+ //"tbl_escalas_precios.mensualidades, tbl_escalas_precios.puntos_mensuales, tbl_escalas_precios.publicidad, " + // " tbl_escalas_precios.id_moneda, isNull(tbl_planes.cant_alumnos, 1) as cantidad_alumnos from tbl_planes " + //"inner join tbl_planes_centros on tbl_planes_centros.id_plan = tbl_planes.id "+ //"inner join tbl_escalas_precios on tbl_escalas_precios.id_plan = tbl_planes.id "+ //"where tbl_planes.anulado != 1 and tbl_planes_centros.id_centro = @centro_id and tbl_planes.id = @id_plan "+ //" and tbl_escalas_precios.niveles = @niveles and tbl_escalas_precios.horas=@horas"; // var query = "select tbl_planes.id, tbl_escalas_precios.niveles, tbl_escalas_precios.horas, " + //"tbl_escalas_precios.precio, tbl_escalas_precios.enganche, tbl_escalas_precios.monto_mensualidades, " + //"tbl_escalas_precios.mensualidades, tbl_escalas_precios.puntos_mensuales, tbl_escalas_precios.publicidad, " + // " tbl_escalas_precios.id_moneda,tbl_escalas_precios.id_escala, isNull(tbl_planes.cant_alumnos, 1) as cantidad_alumnos from tbl_planes " + //"inner join tbl_planes_centros on tbl_planes_centros.id_plan = tbl_planes.id " + //"inner join tbl_escalas_precios on tbl_escalas_precios.id_plan = tbl_planes.id " + //"where tbl_planes.anulado != 1 and tbl_planes_centros.id_centro = @centro_id and tbl_planes.id = @id_plan "; var query = "select tbl_planes.id, tbl_escalas_precios.niveles, tbl_escalas_precios.horas, " + "tbl_escalas_precios.precio, tbl_escalas_precios.enganche, tbl_escalas_precios.monto_mensualidades, " + "tbl_escalas_precios.mensualidades, tbl_escalas_precios.puntos_mensuales, tbl_escalas_precios.publicidad, " + " tbl_escalas_precios.id_moneda,tbl_escalas_precios.id_escala, isNull(tbl_planes.cant_alumnos, 1) as cantidad_alumnos from tbl_planes " + "inner join tbl_planes_centros on tbl_planes_centros.id_plan = tbl_planes.id " + "inner join tbl_escalas_precios on tbl_escalas_precios.id_plan = tbl_planes.id " + "where tbl_planes_centros.id_centro = @centro_id and tbl_planes.id = @id_plan "; SqlCommand command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@id_plan", plan_id); command.Parameters.AddWithValue("@centro_id", centro); //command.Parameters.AddWithValue("@niveles", n); //command.Parameters.AddWithValue("@horas", h); connection.Open(); SqlDataReader rows = command.ExecuteReader(); Plan plan = new Plan(); while (rows.Read()) { if (!rows.IsDBNull(0)) { plan.id = rows.GetInt32(0); } else { plan.id = 0; } if (!rows.IsDBNull(1)) { plan.niveles = rows.GetInt32(1) + ""; } else { plan.niveles = ""; } if (!rows.IsDBNull(2)) { plan.horas = rows.GetInt32(2) + ""; } else { plan.horas = ""; } if (!rows.IsDBNull(3)) { plan.precio = rows.GetDouble(3) + ""; } else { plan.niveles = ""; } if (!rows.IsDBNull(4)) { plan.enganche = rows.GetDouble(4) + ""; } else { plan.enganche = ""; } if (!rows.IsDBNull(5)) { plan.monto_mensualidades = rows.GetDouble(5) + ""; } else { plan.niveles = ""; } if (!rows.IsDBNull(6)) { plan.mensualidades = rows.GetInt32(6) + ""; } else { plan.mensualidades = ""; } if (!rows.IsDBNull(7)) { plan.puntos_mensuales = rows.GetDouble(7) + ""; } else { plan.puntos_mensuales = ""; } if (!rows.IsDBNull(8)) { plan.publicidad = rows.GetDouble(8) + ""; } else { plan.publicidad = ""; } plan.moneda = new Entidad(); if (!rows.IsDBNull(9)) { plan.moneda.id = rows.GetInt32(9); } else { plan.moneda.id = 0; } if (!rows.IsDBNull(10)) { plan.cant_alumnos = rows.GetInt32(10); } if (!rows.IsDBNull(11)) { plan.id_escala = rows.GetInt32(10); } } //select isnull(id,0) from tbl_planes_paypal where enganche = " & var_enganche & " and monto = " & var_monto_cuotas & " and cuotas = " & var_cuotas & "" rows.Close(); connection.Close(); if (plan.id == 0) { respuesta.resultado = 0; respuesta.mensaje = "Error, no se encontro plan."; return(respuesta); } query = "select * from tbl_planes_paypal where enganche = @enganche and monto = @monto and cuotas = @cuotas"; command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@enganche", plan.enganche); command.Parameters.AddWithValue("@monto", plan.monto_mensualidades); command.Parameters.AddWithValue("@cuotas", plan.mensualidades); connection.Open(); rows = command.ExecuteReader(); Entidad plan_paypal = new Entidad(); plan.planes_paypal = new List <Entidad>(); while (rows.Read()) { plan_paypal = new Entidad(); if (!rows.IsDBNull(0)) { plan_paypal.id = rows.GetInt32(0); } else { plan_paypal.id = 0; } if (!rows.IsDBNull(1)) { plan_paypal.nombre = rows.GetString(1) + ""; } else { plan_paypal.nombre = ""; } plan.planes_paypal.Add(plan_paypal); } rows.Close(); connection.Close(); respuesta.mensaje = "Exito"; respuesta.resultado = 1; respuesta.data = plan; } //using } //try catch (DbEntityValidationException ex) { respuesta.mensaje = "Errores econtrados."; List <Error> error_list = new List <Error>(); foreach (var errors in ex.EntityValidationErrors) { foreach (var error in errors.ValidationErrors) { // get the error message error_list.Add(new Error(error.ErrorMessage)); } //inner foreach } //foreach respuesta.data = error_list; } //DbEntityValidationException ex catch (Exception ex) { respuesta.mensaje = "Error, intente mas tarde."; respuesta.data = ex; } finally { } return(respuesta); }
/// <summary> /// 获得一个选题记录信息 /// </summary> /// <param name="recordId">要获得的选题记录ID</param> /// <returns>返回一个类型为TitleRecord的选题记录对象</returns> public TitleRecord GetTitleRecord(int recordId) { try { string cmdText = "select * from V_TitleRecord where titleRecordId = @titleRecordId"; string[] param = { "@titleRecordId" }; object[] values = { recordId }; DataSet ds = db.FillDataSet(cmdText, param, values); TitleRecord titleRecord = new TitleRecord(); Student student = new Student(); Title title = new Title(); Plan plan = new Plan(); Profession prodession = new Profession(); Teacher teacher = new Teacher(); College college = new College(); if (ds != null && ds.Tables[0].Rows.Count > 0) { int i = ds.Tables[0].Rows.Count - 1; if (ds.Tables[0].Rows[i]["titleRecordId"].ToString() != "" && ds.Tables[0].Rows[i]["titleRecordId"].ToString() == recordId.ToString()) { titleRecord.TitleRecordId = int.Parse(ds.Tables[0].Rows[i]["titleRecordId"].ToString()); if (ds.Tables[0].Rows[i]["stuAccount"].ToString() != "") { student.StuAccount = ds.Tables[0].Rows[i]["stuAccount"].ToString(); } if (ds.Tables[0].Rows[i]["titleId"].ToString() != "") { title.TitleId = int.Parse(ds.Tables[0].Rows[i]["titleId"].ToString()); } if (ds.Tables[0].Rows[i]["realName"].ToString() != "") { student.RealName = ds.Tables[0].Rows[i]["realName"].ToString(); } if (ds.Tables[0].Rows[i]["sex"].ToString() != "") { student.Sex = ds.Tables[0].Rows[i]["sex"].ToString(); } if (ds.Tables[0].Rows[i]["phone"].ToString() != "") { student.Phone = ds.Tables[0].Rows[i]["phone"].ToString(); } if (ds.Tables[0].Rows[i]["Email"].ToString() != "") { student.Email = ds.Tables[0].Rows[i]["Email"].ToString(); } if (ds.Tables[0].Rows[i]["proId"].ToString() != "") { prodession.ProId = int.Parse(ds.Tables[0].Rows[i]["proId"].ToString()); } if (ds.Tables[0].Rows[i]["proName"].ToString() != "") { prodession.ProName = ds.Tables[0].Rows[i]["proName"].ToString(); } if (ds.Tables[0].Rows[i]["title"].ToString() != "") { title.title = ds.Tables[0].Rows[i]["title"].ToString(); } if (ds.Tables[0].Rows[i]["titleContent"].ToString() != "") { title.TitleContent = ds.Tables[0].Rows[i]["titleContent"].ToString(); } if (ds.Tables[0].Rows[i]["createTime"].ToString() != "") { title.CreateTime = DateTime.Parse(ds.Tables[0].Rows[i]["createTime"].ToString()); } if (ds.Tables[0].Rows[i]["selected"].ToString() != "") { title.Selected = int.Parse(ds.Tables[0].Rows[i]["selected"].ToString()); } if (ds.Tables[0].Rows[i]["limit"].ToString() != "") { title.Limit = int.Parse(ds.Tables[0].Rows[i]["limit"].ToString()); } if (ds.Tables[0].Rows[i]["planId"].ToString() != "") { plan.PlanId = int.Parse(ds.Tables[0].Rows[i]["planId"].ToString()); } if (ds.Tables[0].Rows[i]["planName"].ToString() != "") { plan.PlanName = ds.Tables[0].Rows[i]["planName"].ToString(); } if (ds.Tables[0].Rows[i]["teaAccount"].ToString() != "") { teacher.TeaAccount = ds.Tables[0].Rows[i]["teaAccount"].ToString(); } if (ds.Tables[0].Rows[i]["teaName"].ToString() != "") { teacher.TeaName = ds.Tables[0].Rows[i]["teaName"].ToString(); } if (ds.Tables[0].Rows[i]["recordCreateTime"].ToString() != "") { titleRecord.recordCreateTime = DateTime.Parse(ds.Tables[0].Rows[i]["recordCreateTime"].ToString()); } if (ds.Tables[0].Rows[i]["collegeId"].ToString() != "") { college.ColID = int.Parse(ds.Tables[0].Rows[i]["collegeId"].ToString()); } if (ds.Tables[0].Rows[i]["collegeName"].ToString() != "") { college.ColName = ds.Tables[0].Rows[i]["collegeName"].ToString(); } if (student != null && title != null && plan != null && prodession != null && teacher != null) { titleRecord.student = student; titleRecord.title = title; titleRecord.plan = plan; titleRecord.profession = prodession; titleRecord.teacher = teacher; return(titleRecord); } } } return(null); } catch (Exception ex) { throw ex; } }
internal GenericResourceData(string id, string name, string type, string location, IDictionary <string, string> tags, Plan plan, object properties, string kind, string managedBy, Sku sku, ResourceIdentity identity, DateTimeOffset?createdTime, DateTimeOffset?changedTime, string provisioningState) : base(id, name, type, tags, location) { Plan = plan; Properties = properties; Kind = kind; ManagedBy = managedBy; Sku = sku; Identity = identity; CreatedTime = createdTime; ChangedTime = changedTime; ProvisioningState = provisioningState; }
private void LoadEntity(Plan plan) { plan.Descripcion = this.descripcionTextBox.Text; plan.IDEspecialidad = Convert.ToInt32(this.ddlEspecialidades.SelectedItem.Value); }
public static void Initialize(AdminContext admincontext) { admincontext.Database.EnsureCreated(); if (!admincontext.Companys.Where(e => e.UserType == "Manager").Any()) { var companys = new Company[] { new Company { Name = "Flower1", UserType = "Manager", Emailaddress = "*****@*****.**", Password = "******", Phone = "123456" }, new Company { Name = "Flower2", UserType = "Manager", Emailaddress = "*****@*****.**", Password = "******", Phone = "123456" }, new Company { Name = "Flower3", UserType = "Manager", Emailaddress = "*****@*****.**", Password = "******", Phone = "123456" }, new Company { Name = "Flower4", UserType = "Manager", Emailaddress = "*****@*****.**", Password = "******", Phone = "123456" } }; foreach (Company c in companys) { admincontext.Companys.Add(c); } admincontext.SaveChanges(); } if (!admincontext.Plans.Any()) { var plans = new Plan[] { new Plan { PlanName = "Store" }, new Plan { PlanName = "Human Resource" }, new Plan { PlanName = "Protection" }, new Plan { PlanName = "Pack House" }, new Plan { PlanName = "Fertigatin" }, new Plan { PlanName = "Field Management" }, new Plan { PlanName = "Scout" }, }; foreach (Plan s in plans) { admincontext.Plans.Add(s); } admincontext.SaveChanges(); } ; if (!admincontext.PlanSubscriptions.Any()) { var subscriptions = new PlanSubscription[] { new PlanSubscription { CompanyId = new Guid("c0bc9d2d-856e-4821-cc8b-08d867999975"), PlanId = new Guid("10d6f392-18f3-4e02-ca31-08d867999de9"), SubscriptionDate = new DateTime(2020, 6, 23), SubscriptionEndDate = new DateTime(2020, 7, 23) }, new PlanSubscription { CompanyId = new Guid("c0bc9d2d-856e-4821-cc8b-08d867999975"), PlanId = new Guid("fcec75db-cbc5-4fc7-ca33-08d867999de9"), SubscriptionDate = new DateTime(2020, 5, 23), SubscriptionEndDate = new DateTime(2020, 7, 10) }, }; foreach (PlanSubscription s in subscriptions) { admincontext.PlanSubscriptions.Add(s); } admincontext.SaveChanges(); } if (!admincontext.Companys.Where(e => e.UserType == "Admin").Any()) { var companys = new Company[] { new Company { Name = "IT4Flower1", UserType = "Admin", Emailaddress = "*****@*****.**", Password = "******", Phone = "123456" } }; foreach (Company c in companys) { admincontext.Companys.Add(c); } admincontext.SaveChanges(); } if (!admincontext.Users.Any()) { var users = new User[] { new User { Emailaddress = "*****@*****.**", Phone = "123456", FirstName = "Abiy1", LastName = "Sahle", Password = "******" }, new User { Emailaddress = "*****@*****.**", Phone = "123456", FirstName = "Abiy2", LastName = "Sahle", Password = "******" }, new User { Emailaddress = "*****@*****.**", Phone = "123456", FirstName = "Abiy3", LastName = "Sahle", Password = "******" }, new User { Emailaddress = "*****@*****.**", Phone = "123456", FirstName = "Abiy4", LastName = "Sahle", Password = "******" }, new User { Emailaddress = "*****@*****.**", Phone = "123456", FirstName = "Abiy5", LastName = "Sahle", Password = "******" }, new User { Emailaddress = "*****@*****.**", Phone = "123456", FirstName = "Abiy6", LastName = "Sahle", Password = "******" }, }; foreach (User u in users) { admincontext.Users.Add(u); } admincontext.SaveChanges(); } }
//試圖建立第二張帳單 public TryToCreateSecondValidBill(User user, Plan plan) : base($"userId: {user.Id} , planId: {plan.Id}") { }
private async Task <DialogTurnResult> TimeDayStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { IMealService mealService = new MealService(this.clientFactory.CreateClient(), this.botConfig.Value); var meals = await mealService.GetMeals(string.Empty, string.Empty); var mealEnumerator = meals.GetEnumerator(); PlanDay day = new PlanDay(); while (mealEnumerator.MoveNext()) { if (string.IsNullOrEmpty(day.Restaurant1)) { day.Restaurant1 = mealEnumerator.Current.Restaurant; } if (string.IsNullOrEmpty(day.Restaurant2) && day.Restaurant1 != mealEnumerator.Current.Restaurant) { day.Restaurant2 = mealEnumerator.Current.Restaurant; } } // Get the Plan try { string food = BotMethods.GetDocument("eatingplan", "ButlerOverview.json", this.botConfig.Value.StorageAccountUrl, this.botConfig.Value.StorageAccountKey); plan = JsonConvert.DeserializeObject <Plan>(food); dayId = plan.Planday.FindIndex(x => x.Name == DateTime.Now.DayOfWeek.ToString().ToLower()); valid = true; } catch { valid = false; } OrderBlob orderBlob = new OrderBlob(); var tmp = BotMethods.GetSalaryDeduction("2", this.botConfig.Value.GetSalaryDeduction); int weeknumber = (DateTime.Now.DayOfYear / 7) + 1; orderBlob = JsonConvert.DeserializeObject <OrderBlob>(BotMethods.GetDocument("orders", "orders_" + weeknumber + "_" + DateTime.Now.Year + ".json", this.botConfig.Value.StorageAccountUrl, this.botConfig.Value.StorageAccountKey)); var nameID = orderBlob.OrderList.FindIndex(x => x.Name == stepContext.Context.Activity.From.Name); if (DateTime.Now.Hour - 1 >= 12) { await stepContext.Context.SendActivityAsync(MessageFactory.Text($"Es ist schon nach 12 Uhr")); return(await stepContext.BeginDialogAsync(nameof(OrderForOtherDayDialog))); } else if (nameID != -1) { var temp = orderBlob.OrderList.FindAll(x => x.Name == stepContext.Context.Activity.From.Name); foreach (var item in temp) { if (item.CompanyStatus.ToLower().ToString() == "für mich") { await stepContext.Context.SendActivityAsync(MessageFactory.Text($"Du hast heute schon etwas bestellt")); return(await stepContext.BeginDialogAsync(nameof(NextOrder))); } } return(await stepContext.NextAsync()); } else { return(await stepContext.NextAsync()); } }
public ActionResult MyPlanDetails(int planId, string name, string country, DateTime date, string method) { Plan model = new Plan(planId, name, country, date, method); return(View(model)); }
public void VigenciaPlan(Plan _plan) { MapperPro.Instance().Update("vigencia_plan", _plan); }
// GET: WorldDomination public ActionResult CreatePlan() { Plan model = new Plan(); return(View(model)); }
/// <summary> /// Initializes a new instance of the <see cref="PlanWindow"/> class. /// Constructor used in WindowsFactory. /// </summary> /// <param name="plan">The plan.</param> public PlanWindow(Plan plan) : this() { Plan = plan; }
public dynamic CreateSubscriptionRequester(Customer Customer, Plan Plan, PaymentProfile PayMentProfile = null) { SubscriptionRequester NewSub; Subscription SubEdit; Customer CustomerEdit; CreatePlanRequester PlanResquester; Plan PlanEdit; PlanItems[] PlanItemsEdit; PaymentProfile PayProfileEdit; DateTime CurrentDate = DateTime.UtcNow.AddHours(-3); dynamic Result; try { PayProfileEdit = PayMentProfile; PlanEdit = Plan; PlanItemsEdit = PlanEdit.PlanItems; CustomerEdit = Customer; List <Customer> FoundClient; /* Pesquisa o cliente pelo CPF ou codigo caso não encontre cadastra um novo cliente * pelas informações passadas e da prosseguimento no processo de Assinatura */ if (!String.IsNullOrEmpty(CustomerEdit.RegistryCode) || !String.IsNullOrEmpty(CustomerEdit.Code)) { var FindClient = GetByAnythingAsync(CustomerEdit, true); if (FindClient != null) { FoundClient = (List <Customer>)FindClient; if (FoundClient.Count == 1) { foreach (Customer customer in FoundClient) { CustomerEdit = customer; break; } } else if (FoundClient.Count > 1) { throw new Exception("Existe mais de 1(um) cadastro para esse cliente, entre em contato com o suporte!"); } else if (FoundClient.Count == 0) { //Cria um novo Cliente var NewClient = CreateAnythingAsync(CustomerEdit); CustomerEdit = (Customer)NewClient; } } } /* Pesquisa se o cliente possui um perfil de pagamendo disponivel pelo id ou cpf do cliente caso não encontre ou seja passado dados diferentes * tenta cadastra um novo perfil de pagamento com as informações passadas e da prosseguimento no processo de Assinatura caso consiga. */ if (PayProfileEdit == null) { PayProfileEdit = new PaymentProfile(); } Boolean IsNewProfile = true; PayProfileEdit.Customer = CustomerEdit; var FindPayProfile = new List <PaymentProfile>(); if (String.IsNullOrEmpty(PayProfileEdit.CardNumber) && String.IsNullOrEmpty(Convert.ToString(PayProfileEdit.BankAccount))) { FindPayProfile = (List <PaymentProfile>)GetByAnythingAsync(PayProfileEdit, true); IsNewProfile = false; } if (FindPayProfile != null) { List <PaymentProfile> FoundPaymentProfiles = (List <PaymentProfile>)FindPayProfile; if (FoundPaymentProfiles.Count == 0) { /*Cria um perfil de pagamento para o cliente, caso tenha sido passada as informações necessarias.*/ if (PayMentProfile != null) { /* Deleta o perfil antigo se tiver, caso seja informado os dados necessarios para a troca de perfis de pagamento do cliente*/ PaymentProfile DeleteOldProfile = null; if (IsNewProfile == true) { FindPayProfile = (List <PaymentProfile>)GetByAnythingAsync(PayProfileEdit, true); foreach (PaymentProfile OldProfile in FindPayProfile) { DeleteOldProfile = OldProfile; } } if (DeleteOldProfile != null && DeleteOldProfile.Id > 0) { var DeleteResult = DeleteAnythingAsync(DeleteOldProfile); } var NewPayProfile = CreateAnythingAsync(PayMentProfile); PayProfileEdit = (PaymentProfile)NewPayProfile; } else { throw new Exception("Não foi possivel criar um perfil de pagamento para o cliente, verifique os dados fornecidos."); } } else if (FoundPaymentProfiles.Count > 1) { throw new Exception("O cliente só pode possuir 1(um) perfil de pagamento ativo, e possui: " + FoundPaymentProfiles.Count + " perfis ativos, Entre em contato com o suporte para fazer a devida correção."); } else if (FoundPaymentProfiles.Count == 1) { foreach (PaymentProfile paymentProfile in FoundPaymentProfiles) { PayProfileEdit = paymentProfile; break; } } } /* Pesquisa se o plano pelo nome ou codigo caso não encontre tenta cadastra um novo plano * com as informações passadas e da prosseguimento no processo de Assinatura caso consiga */ var FindPlan = GetByAnythingAsync(PlanEdit, true); if (FindPlan != null) { List <Plan> FoundPlan = (List <Plan>)FindPlan; if (FoundPlan.Count == 0) { /* Pesquisa se o produto informado no plano pelo preço ou codigo caso não encontre tenta cadastra * um novo produto com as informações passadas e da prosseguimento no processo de Assinatura caso consiga */ Int32 Count = 0; foreach (PlanItems PItens in PlanItemsEdit) { var FindProduct = GetByAnythingAsync(PItens.Product, true); List <Product> FoundProduct = (List <Product>)FindProduct; if (FoundProduct.Count > 0) { foreach (Product product in FoundProduct) { PlanItemsEdit[Count].Product = product; } } else { var NewProduct = CreateAnythingAsync(PlanItemsEdit[Count].Product); PlanItemsEdit[Count].Product = (Product)NewProduct; } } PlanResquester = new CreatePlanRequester(); PlanEdit.PlanItems = PlanItemsEdit; PlanResquester.Plan = PlanEdit; var NewPlan = CreateAnythingAsync(PlanResquester); PlanEdit = (Plan)NewPlan; } else if (FoundPlan.Count == 1) { foreach (Plan plan in FoundPlan) { PlanEdit = plan; break; } } else { throw new Exception("Foi encontrado mais de um plano, por favor verifique os dados informados, ou refine sua busca"); } } /* Pesquisa se o aluno já possui uma assinatura, caso possua verifica se possui * um determinado numero de dias para o fim da assinatura, caso não possua o processo de assinatura continua normalmente. */ SubEdit = new Subscription(); SubEdit.Customer = CustomerEdit; var FindSubscription = GetByAnythingAsync(SubEdit, true); List <Subscription> FoundSubscription = (List <Subscription>)FindSubscription; if (FoundSubscription.Count == 1) { foreach (Subscription subscription in FoundSubscription) { SubEdit = subscription; break; } if (Convert.ToDateTime(SubEdit.EndAt) > CurrentDate.AddDays(46)) { throw new Exception("O aluno informado possui uma assinatura vingente com mais de 45 dias para o termino, com vigencia final para: " + Convert.ToString(Convert.ToDateTime(SubEdit.EndAt))); } } else if (FoundSubscription.Count > 1) { throw new Exception("O aluno possui mais de uma assinatura, contate o suporte"); } NewSub = new SubscriptionRequester() { CustomerId = CustomerEdit.Id, PlanId = PlanEdit.Id, PaymentMethodCode = PayProfileEdit.PaymentMethodCode }; Result = CreateAnythingAsync(NewSub); } catch (Exception Except) { throw new Exception(Except.Message); } return(Result); }
// Use this for initialization public override iThinkPlan SearchMethod(iThinkState GoalState, iThinkActionManager ActionManager, List <iThinkPlan> OpenStates, List <iThinkState> VisitedStates) { int it = 0; iThinkPlan curStep, nextStep; iThinkState CurrentState = null; List <iThinkPlan> stateList = null; while (OpenStates.Count != 0) { List <iThinkAction> applicableActions = new List <iThinkAction>(); stateList = new List <iThinkPlan>(); curStep = new iThinkPlan(OpenStates[0]); CurrentState = OpenStates[0].getState(); VisitedStates.Add(CurrentState); OpenStates.RemoveAt(0); applicableActions = getApplicable(CurrentState, ActionManager.getActions()); foreach (iThinkAction action in applicableActions) { bool found = false; // todo: Add "statnode" for statistics retrieval nextStep = progress(curStep, action); if (compareStates(nextStep.getState(), GoalState)) { Debug.Log("Found Plan (BestFS) " + nextStep.getPlanActions().Count); Plan.setPlan(nextStep); repoFunct.completed = true; return(Plan); } foreach (iThinkState state in VisitedStates) { if (state == nextStep.getState()) { found = true; break; } } if (found == false) { int Cost = hFunction(nextStep.getState(), GoalState); nextStep.getState().setCost(Cost); stateList.Add(nextStep); } } OpenStates.AddRange(stateList); OpenStates.Sort(delegate(iThinkPlan obj1, iThinkPlan obj2) { if (obj1.getState().getCost() == obj2.getState().getCost()) { return(0); } else if (obj1.getState().getCost() > obj2.getState().getCost()) { return(-1); } else { return(1); } } ); ++it; } //Debug.Log( "Didn't find Plan (BestFS)" ); return(null); }
public void EstadoPlan(Plan _plan) { MapperPro.Instance().Update("estado_plan", _plan); }
private async Task <List <O365Task> > GetO365TasksAsync(GraphServiceClient graphService, Plan plan) { var tasks = await PlanService.GetTasksAsync(plan); var result = new List <O365Task>(); foreach (var item in tasks) { var task = new O365Task { Title = item.title, AssignedTo = !string.IsNullOrEmpty(item.assignedTo) ? (await graphService.Users[item.assignedTo].Request().GetAsync()).DisplayName : "", AssignedBy = !string.IsNullOrEmpty(item.assignedBy) ? (await graphService.Users[item.assignedBy].Request().GetAsync()).DisplayName : "", AssignedDate = item.assignedDateTime.HasValue ? item.assignedDateTime.Value.DateTime.ToLocalTime().ToString() : "" }; result.Add(task); } return(result); }
internal static Task makeTask(Plan plan, Worker worker) { Task aTask = new Task(); return(aTask); }
public IHttpActionResult UpdatePlan(UpdatePlanViewModel data) { try { if (data == null || data.plan == null || data.updateIndexPlanLocationAndNote == null) { return(BadRequest()); } Plan plan = _planService.Find(data.plan.Id); if (plan == null) { return(BadRequest()); } plan.StartDate = data.plan.StartDate; plan.EndDate = data.plan.EndDate; plan.Name = data.plan.Name; _planService.Update(plan); try { bool result = false; foreach (var item in data.updateIndexPlanLocationAndNote.PlanLocation) { var planLocation = _planService.FindPlanLocation(item.Id); planLocation.Index = item.Index; planLocation.PlanDay = item.PlanDay; result = _planService.UpdatePlanLocation(planLocation); } if (result) { foreach (var item in data.updateIndexPlanLocationAndNote.PlanNotes) { var planNote = _planService.FindNote(item.Id); planNote.Index = item.Index; planNote.PlanDay = item.PlanDay; result = _planService.UpdatePlanNote(planNote); } } if (result) { return(Ok()); } else { return(BadRequest()); } } catch (Exception ex) { _loggingService.Write(GetType().Name, nameof(EditIndexPlanLocationAndNote), ex); return(InternalServerError(ex)); } } catch (Exception ex) { _loggingService.Write(GetType().Name, nameof(UpdatePlan), ex); return(InternalServerError(ex)); } }
public int AltaPlan(Plan objPlan) { return(objDP.AltaPlan(objPlan)); //ref }
static FunctionApp CreateAzureFunctionApp(ResourceGroup resourceGroup, Output <string> sqlConnectionString, Output <string> appInsightsKey) { var appServicePlan = new Plan("asp", new PlanArgs { ResourceGroupName = resourceGroup.Name, Kind = "FunctionApp", Sku = new PlanSkuArgs { Tier = "Dynamic", Size = "Y1", }, }); var backendStorageAccount = new Account("backendstorage", new AccountArgs { ResourceGroupName = resourceGroup.Name, AccountReplicationType = "LRS", EnableHttpsTrafficOnly = true, AccountTier = "Standard", AccountKind = "StorageV2", AccessTier = "Hot", }); var container = new Container("zips", new ContainerArgs { StorageAccountName = backendStorageAccount.Name, ContainerAccessType = "private", }); var blob = new Blob("zip", new BlobArgs { StorageAccountName = backendStorageAccount.Name, StorageContainerName = container.Name, Type = "Block", Source = new FileArchive("../../TodoFunctions/bin/Release/netcoreapp2.1/publish"), }); var codeBlobUrl = SharedAccessSignature.SignedBlobReadUrl(blob, backendStorageAccount); return(new FunctionApp("app", new FunctionAppArgs { ResourceGroupName = resourceGroup.Name, AppServicePlanId = appServicePlan.Id, AppSettings = { { "runtime", "dotnet" }, { "WEBSITE_RUN_FROM_PACKAGE", codeBlobUrl }, { "ConnectionString", sqlConnectionString }, { "APPINSIGHTS_INSTRUMENTATIONKEY", appInsightsKey } }, SiteConfig = new FunctionAppSiteConfigArgs { Cors = new FunctionAppSiteConfigCorsArgs { AllowedOrigins = new List <string> { "*" } } }, StorageConnectionString = backendStorageAccount.PrimaryConnectionString, Version = "~2" })); }
public override void BecauseOf() { Result = Plan.Verify(); }
public void ActualizarPlan(Plan _plan) { MapperPro.Instance().Update("update_plan", _plan); }
public void InactivarPlan(Plan _plan) { MapperPro.Instance().Update("inactive_plan", _plan); }
public void LoadPlan(Plan plan) { this.DataContext = plan; }
internal GenericResourceExpandedData(string id, string name, string type, string location, IDictionary <string, string> tags, Plan plan, object properties, string kind, string managedBy, Sku sku, ResourceIdentity identity, DateTimeOffset?createdTime, DateTimeOffset?changedTime, string provisioningState) : base(id, name, type, location, tags, plan, properties, kind, managedBy, sku, identity) { CreatedTime = createdTime; ChangedTime = changedTime; ProvisioningState = provisioningState; }
public Plan GetPlanDetailByPlanId(int planId) { Plan plan = context.plans.FirstOrDefault(x => x.Id == planId && x.IsActive == true); return(plan); }