示例#1
0
        void kedofriends(bool retry)
        {
            using (jaka jaka = new jaka())
            {
                jaka.Show();

                if (retry)
                {
                    jaka.PasswordWasWrong();
                    npkji.Flash(jaka, 3);
                }

                // wait for slow jaka
                while (jaka.Visible)
                {
                    Application.DoEvents();

                    Thread.Sleep(1);
                }

                // jaka stinx
                if (jaka.WasCancelled || jaka.Username.Length == 0 || jaka.Password.Length == 0)
                    Environment.Exit(0);

                username = jaka.Username;
                type = jaka.PlanType;

                password = new System.Security.SecureString();
                foreach (var x in jaka.Password) password.AppendChar(x);
                password.MakeReadOnly();
            }
        }
示例#2
0
 public static void PostDataToServer(PlanType type, string name, object value)
 {
     name = HttpUtility.UrlEncode(name);
     value = HttpUtility.UrlEncode(value.ToString());
     string postUrl = string.Format("{0}?type={1}&ip={2}&name={3}&data={4}", serverUrl, type.ToString(), GetServerIP(), name, value);
     HttpHelper.GetReponseText(postUrl);
 }
示例#3
0
        public natto(nattoenemies[] transactions, PlanType t)
        {
            this.transactions = transactions;

            baseline = pointPresets[t].Item1;
            perweek = pointPresets[t].Item2;

            InitializeComponent();
        }
示例#4
0
 public PlanAct(CreatureAI agent, string pathOut, string target, PlanType planType)
     : base(agent)
 {
     Type = planType;
     Name = "Plan to " + target;
     PlannerTimer = new Timer(1.0f, false);
     MaxExpansions = 1000;
     PathOut = pathOut;
     TargetName = target;
     PlanSubscriber = new PlanSubscriber(PlayState.PlanService);
     WaitingOnResponse = false;
     MaxTimeouts = 4;
     Timeouts = 0;
     Radius = 0;
 }
示例#5
0
        private async void LoadPlan(string filePath, PlanType fileFormat)
        {
            IPlanManager reader = planManagerFactory.Create(fileFormat);

            PlanImportData plan        = null;
            var            tokenSource = new CancellationTokenSource();
            var            progress    = new Progress <double>();

            ViewManager.ShowProgress("$Planner.Importing.WaitTitle", "$Planner.Importing.WaitText", tokenSource, progress);

            try
            {
                plan = await Task.Run(() => reader.Read(filePath, tokenSource.Token, progress));
            }
            catch (Exception ex)
            {
                tokenSource.Cancel();
                recentPlansManager.RemoveFromRecentList(new RecentPlan(filePath, fileFormat));
                Log.Error($"Unable to import observation plan: {ex}");
                ViewManager.ShowMessageBox("$Error", $"{Text.Get("Planner.Importing.Error")}: {ex.Message}");
            }

            if (!tokenSource.IsCancellationRequested)
            {
                tokenSource.Cancel();
                if (plan?.Objects.Any() == true)
                {
                    CreateNewPlan(plan);
                    recentPlansManager.AddToRecentList(new RecentPlan(filePath, fileFormat));
                }
                else if (ViewManager.ShowMessageBox("$Warning", Text.Get("Planner.Importing.NoCelestialObjectImported"), System.Windows.MessageBoxButton.YesNo) == System.Windows.MessageBoxResult.Yes)
                {
                    CreateNewPlan(null);
                }
            }
        }
示例#6
0
        private static bool TryGetPlanName(PlanType planType, out string planName)
        {
            switch (planType)
            {
            case PlanType.Free:
                planName = "Free";
                return(true);

            case PlanType.FamiliesAnnually:
            case PlanType.FamiliesAnnually2019:
                planName = "Families";
                return(true);

            case PlanType.TeamsAnnually:
            case PlanType.TeamsAnnually2019:
            case PlanType.TeamsMonthly:
            case PlanType.TeamsMonthly2019:
                planName = "Teams";
                return(true);

            case PlanType.EnterpriseAnnually:
            case PlanType.EnterpriseAnnually2019:
            case PlanType.EnterpriseMonthly:
            case PlanType.EnterpriseMonthly2019:
                planName = "Enterprise";
                return(true);

            case PlanType.Custom:
                planName = "Custom";
                return(true);

            default:
                planName = null;
                return(false);
            }
        }
 public IActionResult Update([FromBody] PlanType planType)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (planType.Id <= 0)
             {
                 return(BadRequest($"The plan'type id is required or is invalid: {planType.Id}"));
             }
             var updatedPlanType = ConnectionDB.PlansModule.DataPlanType.Save(planType);
             if (updatedPlanType != null)
             {
                 return(Ok());
             }
         }
         return(BadRequest());
     }
     catch (Exception e)
     {
         ErrorResponse errorResponse = ErrorResponse.From(e);
         return(StatusCode(500, errorResponse));
     }
 }
示例#8
0
        public JsonResult List(int start, int limit, PlanType type)
        {
            var statement = planServices.CreateQuery(type);

            return(Json(JsonDataList.CreateResult(statement, start, limit), JsonRequestBehavior.AllowGet));
        }
示例#9
0
		public RuinedShipPlans(PlanType type) : base(5360)
		{
			m_PlanType = type;
            m_Joined.Add(type);
		}
示例#10
0
        // Reads in a domain from a file.
        public static Domain GetDomain(string file, PlanType type)
        {
            bool readInStat = true;
            int  start      = 0;

            // The domain object.
            Domain domain = new Domain();

            // Set the domain's type.
            domain.Type = type;

            // Read the domain file into a string.
            string input = System.IO.File.ReadAllText(file);

            // Split the input string by space, line feed, character return, and tab.
            string[] words = input.Split(new char[] { ' ', '\r', '\n', '\t' });

            // Remove all empty elements of the word array.
            words = words.Where(x => !string.IsNullOrEmpty(x)).ToArray();

            // Loop through the word array.
            for (int i = 0; i < words.Length; i++)
            {
                // Set the domain name.
                if (words[i].Equals("(domain"))
                {
                    start       = i - 1;
                    domain.Name = words[i + 1].Remove(words[i + 1].Length - 1);
                }

                // Begin types definitions.
                if (words[i].Equals("(:types"))
                {
                    // If the list is not empty.
                    if (!words[i + 1].Equals(")"))
                    {
                        // Loop until list is finished.
                        while (words[i][words[i].Length - 1] != ')')
                        {
                            // Create a list for sub-types.
                            List <string> subTypes = new List <string>();

                            // Read in the sub-types.
                            while (!Regex.Replace(words[++i], @"\t|\n|\r", "").Equals("-"))
                            {
                                subTypes.Add(Regex.Replace(words[i], @"\t|\n|\r", ""));
                            }

                            // Associate sub-types with type in domain object.
                            domain.AddTypeList(subTypes, Regex.Replace(words[++i], @"\t|\n|\r|[()]", ""));
                        }
                    }
                }

                // Begin constants definitions.
                if (words[i].Equals("(:constants"))
                {
                    // If the list is not empty.
                    if (!words[i + 1].Equals(")"))
                    {
                        // Loop until list is finished.
                        while (words[i][words[i].Length - 1] != ')')
                        {
                            // Create a list for sub-types.
                            List <string> constants = new List <string>();

                            // Read in the sub-types.
                            while (!Regex.Replace(words[++i], @"\t|\n|\r", "").Equals("-"))
                            {
                                constants.Add(Regex.Replace(words[i], @"\t|\n|\r", ""));
                            }

                            // Associate sub-types with type in domain object.
                            domain.AddConstantsList(constants, Regex.Replace(words[++i], @"\t|\n|\r|[()]", ""));
                        }
                    }
                }

                // Begin predicates definitions.
                if (words[i].Equals("(:predicates"))
                {
                    // If the list is not empty.
                    if (!words[i + 1].Equals(")"))
                    {
                        // Loop until list is finished.
                        while ((words[i][words[i].Length - 1] != ')' || words[i][words[i].Length - 2] != ')') &&
                               (words[i][words[i].Length - 1] != ')' || !words[i + 1].Equals(")")))
                        {
                            Predicate pred = new Predicate();

                            pred.Name = Regex.Replace(words[++i], @"\t|\n|\r|[()]", "");

                            while (words[i][words[i].Length - 1] != ')')
                            {
                                Term term = new Term();
                                term.Variable = Regex.Replace(words[++i], @"\t|\n|\r|[()]", "");
                                if (Regex.Replace(words[i + 1], @"\t|\n|\r", "").Equals("-"))
                                {
                                    i++;
                                    term.Type = Regex.Replace(words[++i], @"\t|\n|\r|[()]", "");
                                    pred.Terms.Add(term);
                                }
                            }
                            domain.Predicates.Add(pred);
                        }
                    }
                }

                // Begin an action definition.
                if (words[i].Equals("(:action"))
                {
                    if (readInStat)
                    {
                        for (int stat = start; stat < i; stat++)
                        {
                            domain.staticStart += " " + words[stat];
                        }
                        readInStat = false;
                    }

                    IOperator temp = null;

                    if (type == PlanType.PlanSpace)
                    {
                        // Create an operator object.
                        temp = new Operator();
                    }
                    else if (type == PlanType.StateSpace)
                    {
                        // Create an action object.
                        temp = new Operator();
                    }

                    // Name the operator's predicate.
                    temp.Name = Regex.Replace(words[i + 1], @"\t|\n|\r", "");

                    // Add the operator to the domain object.
                    domain.Operators.Add(temp);
                }

                // Fill in an operator's internal information.
                if (words[i].Equals(":parameters"))
                {
                    // Add the operator's parameters.
                    while (!Regex.Replace(words[i++], @"\t|\n|\r", "").Equals(":precondition"))
                    {
                        if (words[i][0] == '(' || words[i][0] == '?')
                        {
                            // Create a new term using the variable name.
                            Term term = new Term(Regex.Replace(words[i], @"\t|\n|\r|[()]", ""));

                            // Check if the term has a specified type.
                            if (Regex.Replace(words[i + 1], @"\t|\n|\r", "").Equals("-"))
                            {
                                // Iterate the counter past the dash.
                                i++;

                                // Add the type to the term object.
                                term.Type = Regex.Replace(words[++i], @"\t|\n|\r|[()]", "");
                            }

                            // Add the term to the operator's predicate.
                            domain.Operators.Last().Predicate.Terms.Add(term);
                        }
                    }

                    // Create a list to hold the preconditions.
                    List <IPredicate> preconditions = new List <IPredicate>();

                    // Create a list to hold nonequality constraints
                    List <List <ITerm> > Nonequalities = new List <List <ITerm> >();
                    bool lastWasNonEquality            = false;
                    // Add the operator's preconditions
                    while (!Regex.Replace(words[i++], @"\t|\n|\r", "").Equals(":effect"))
                    {
                        if (words[i][0] == '(')
                        {
                            if (!words[i].Equals("(and"))
                            {
                                // Create a new precondition object.
                                Predicate pred = new Predicate();

                                // Check for a negative precondition.
                                if (words[i].Equals("(not"))
                                {
                                    // Iterate the counter.
                                    i++;

                                    // Set the effect's sign to false.
                                    pred.Sign = false;
                                }

                                // Set the precondition's name.
                                pred.Name = Regex.Replace(words[i], @"\t|\n|\r|[()]", "");

                                if (pred.Name.Equals("="))
                                {
                                    if (pred.Sign)
                                    {
                                        throw new System.Exception();
                                    }
                                    // this is a nonequality constraint
                                    lastWasNonEquality = true;
                                    Nonequalities.Add(new List <ITerm>());
                                }
                                else
                                {
                                    lastWasNonEquality = false;
                                    // Add the precondition to the operator.
                                    preconditions.Add(pred);
                                }
                            }
                        }
                        else
                        {
                            if (lastWasNonEquality)
                            {
                                if (!Regex.Replace(words[i], @"\t|\n|\r", "").Equals(":effect") && !words[i].Equals(")"))
                                {
                                    if (Regex.Replace(words[i], @"\t|\n|\r|[()]", "")[0] == '?')
                                    {
                                        Nonequalities.Last().Add(new Term(Regex.Replace(words[i], @"\t|\n|\r|[()]", "")));
                                    }
                                    else
                                    {
                                        Nonequalities.Last().Add(new Term(Regex.Replace(words[i], @"\t|\n|\r|[()]", ""), true));
                                    }
                                }
                            }
                            else
                            {
                                // Add the precondition's terms.
                                if (!Regex.Replace(words[i], @"\t|\n|\r", "").Equals(":effect") && !words[i].Equals(")"))
                                {
                                    if (Regex.Replace(words[i], @"\t|\n|\r|[()]", "")[0] == '?')
                                    {
                                        preconditions.Last().Terms.Add(new Term(Regex.Replace(words[i], @"\t|\n|\r|[()]", "")));
                                    }
                                    else
                                    {
                                        preconditions.Last().Terms.Add(new Term(Regex.Replace(words[i], @"\t|\n|\r|[()]", ""), true));
                                    }
                                }
                            }
                        }
                    }

                    // Add the preconditions to the last created operator.
                    domain.Operators.Last().Preconditions = preconditions;
                    domain.Operators.Last().NonEqualities = Nonequalities;

                    // Create a list to hold the effects.
                    List <IPredicate> effects = new List <IPredicate>();

                    // Add the operator's effects.
                    while (!Regex.Replace(words[i + 1], @"\t|\n|\r", "").Equals("(:action") && !Regex.Replace(words[i], @"\t|\n|\r", "").Equals(":agents") && i < words.Length - 2)
                    {
                        if (words[i][0] == '(')
                        {
                            // Check for a conditional effect.
                            // THIS SHOULD PROBABLY BE CONDENSED
                            if (words[i].Equals("(forall") || words[i].Equals("(when"))
                            {
                                // Create a new axiom object.
                                Axiom axiom = new Axiom();

                                if (words[i].Equals("(forall"))
                                {
                                    // Read in the axiom's terms.
                                    while (!Regex.Replace(words[++i], @"\t|\n|\r", "").Equals("(when"))
                                    {
                                        axiom.Terms.Add(new Term(Regex.Replace(words[i], @"\t|\n|\r|[()]", "")));
                                    }
                                }

                                // If the preconditions are conjunctive.
                                if (Regex.Replace(words[++i], @"\t|\n|\r", "").Equals("(and"))
                                {
                                    // Initialize a parentheses stack counter.
                                    int parenStack = 1;
                                    i++;

                                    // Use the stack to loop through the conjunction.
                                    while (parenStack > 0)
                                    {
                                        // Check for an open paren.
                                        if (words[i][0] == '(')
                                        {
                                            // Create new predicate.
                                            Predicate pred = new Predicate();

                                            // Check for a negative effect.
                                            if (words[i].Equals("(not"))
                                            {
                                                // Iterate the counter.
                                                i++;

                                                // Set the effect's sign to false.
                                                pred.Sign = false;
                                            }

                                            // Name the predicate.
                                            pred.Name = Regex.Replace(words[i++], @"\t|\n|\r|[()]", "");

                                            // Read in the terms.
                                            while (words[i][words[i].Length - 1] != ')')
                                            {
                                                pred.Terms.Add(new Term(Regex.Replace(words[i++], @"\t|\n|\r|[()]", "")));
                                            }

                                            // Read the last term.
                                            pred.Terms.Add(new Term(Regex.Replace(words[i++], @"\t|\n|\r|[()]", "")));

                                            // Add the predicate to the axiom's preconditions.
                                            axiom.Preconditions.Add(pred);
                                        }

                                        // Check for a close paren.
                                        if (words[i][words[i].Length - 1] == ')')
                                        {
                                            parenStack--;
                                        }
                                    }
                                }
                                else
                                {
                                    // Check for an open paren.
                                    if (words[i][0] == '(')
                                    {
                                        // Create new predicate.
                                        Predicate pred = new Predicate();

                                        // Check for a negative effect.
                                        if (words[i].Equals("(not"))
                                        {
                                            // Iterate the counter.
                                            i++;

                                            // Set the effect's sign to false.
                                            pred.Sign = false;
                                        }

                                        // Name the predicate.
                                        pred.Name = Regex.Replace(words[i++], @"\t|\n|\r|[()]", "");

                                        // Read in the terms.
                                        while (words[i][words[i].Length - 1] != ')')
                                        {
                                            pred.Terms.Add(new Term(Regex.Replace(words[i++], @"\t|\n|\r|[()]", "")));
                                        }

                                        // Read the last term.
                                        pred.Terms.Add(new Term(Regex.Replace(words[i], @"\t|\n|\r|[()]", "")));

                                        // Add the predicate to the axiom's preconditions.
                                        axiom.Preconditions.Add(pred);
                                    }
                                }

                                // If the preconditions are conjunctive.
                                if (Regex.Replace(words[++i], @"\t|\n|\r", "").Equals("(and"))
                                {
                                    // Initialize a parentheses stack counter.
                                    int parenStack = 1;
                                    i++;

                                    // Use the stack to loop through the conjunction.
                                    while (parenStack > 0)
                                    {
                                        // Check for an open paren.
                                        if (words[i][0] == '(')
                                        {
                                            // Create new predicate.
                                            Predicate pred = new Predicate();

                                            parenStack++;

                                            // Check for a negative effect.
                                            if (words[i].Equals("(not"))
                                            {
                                                // Iterate the counter.
                                                i++;

                                                // Set the effect's sign to false.
                                                pred.Sign = false;

                                                parenStack++;
                                            }

                                            // Name the predicate.
                                            pred.Name = Regex.Replace(words[i++], @"\t|\n|\r|[()]", "");

                                            // Read in the terms.
                                            while (words[i][words[i].Length - 1] != ')')
                                            {
                                                pred.Terms.Add(new Term(Regex.Replace(words[i++], @"\t|\n|\r|[()]", "")));
                                            }

                                            // Read the last term.
                                            pred.Terms.Add(new Term(Regex.Replace(words[i++], @"\t|\n|\r|[()]", "")));

                                            // Add the predicate to the axiom's effects.
                                            axiom.Effects.Add(pred);
                                        }

                                        // Check for a close paren.
                                        if (words[i - 1][words[i - 1].Length - 1] == ')')
                                        {
                                            parenStack--;
                                        }

                                        if (words[i - 1].Length > 1)
                                        {
                                            if (words[i - 1][words[i - 1].Length - 2] == ')')
                                            {
                                                parenStack--;
                                            }
                                        }

                                        if (words[i - 1].Length > 2)
                                        {
                                            if (words[i - 1][words[i - 1].Length - 3] == ')')
                                            {
                                                parenStack--;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    // Check for an open paren.
                                    if (words[i][0] == '(')
                                    {
                                        // Create new predicate.
                                        Predicate pred = new Predicate();

                                        // Check for a negative effect.
                                        if (words[i].Equals("(not"))
                                        {
                                            // Iterate the counter.
                                            i++;

                                            // Set the effect's sign to false.
                                            pred.Sign = false;
                                        }

                                        // Name the predicate.
                                        pred.Name = Regex.Replace(words[i++], @"\t|\n|\r|[()]", "");

                                        // Read in the terms.
                                        while (words[i][words[i].Length - 1] != ')')
                                        {
                                            pred.Terms.Add(new Term(Regex.Replace(words[i++], @"\t|\n|\r|[()]", "")));
                                        }

                                        // Read the last term.
                                        pred.Terms.Add(new Term(Regex.Replace(words[i++], @"\t|\n|\r|[()]", "")));

                                        // Add the predicate to the axiom's effects.
                                        axiom.Effects.Add(pred);
                                    }
                                }

                                // Add the axiom to the set of conditional effects.
                                domain.Operators.Last().Conditionals.Add(axiom);
                            }
                            else if (!words[i].Equals("(and"))
                            {
                                // Create a new effect object.
                                Predicate pred = new Predicate();

                                // Check for a negative effect.
                                if (words[i].Equals("(not"))
                                {
                                    // Iterate the counter.
                                    i++;

                                    // Set the effect's sign to false.
                                    pred.Sign = false;
                                }

                                // Set the effect's name.
                                pred.Name = Regex.Replace(words[i], @"\t|\n|\r|[()]", "");

                                // Add the effect to the operator.
                                effects.Add(pred);
                            }
                        }
                        else
                        {
                            // Add the effect's terms.
                            if (!Regex.Replace(words[i], @"\t|\n|\r", "").Equals("(:action") && !words[i].Equals(")"))
                            {
                                if (Regex.Replace(words[i], @"\t|\n|\r|[()]", "")[0] == '?')
                                {
                                    effects.Last().Terms.Add(new Term(Regex.Replace(words[i], @"\t|\n|\r|[()]", "")));
                                }
                                else
                                {
                                    effects.Last().Terms.Add(new Term(Regex.Replace(words[i], @"\t|\n|\r|[()]", ""), true));
                                }
                            }
                        }

                        // Iterate the counter.
                        i++;
                    }

                    // Add the effects to the last created operator.
                    domain.Operators.Last().Effects = effects;

                    // Create a list for storing consenting agents.
                    List <ITerm> consenting = new List <ITerm>();

                    // Check if the action has any consenting agents.
                    if (Regex.Replace(words[i], @"\t|\n|\r", "").Equals(":agents"))
                    {
                        // If so, iterate through them.
                        while (Regex.Replace(words[++i], @"\t|\n|\r", "")[Regex.Replace(words[i], @"\t|\n|\r", "").Length - 1] != ')')
                        {
                            // And add them to the list.
                            consenting.Add(new Term(Regex.Replace(words[i], @"\t|\n|\r|[()]", "")));
                        }

                        // Add the final item to the list.
                        consenting.Add(new Term(Regex.Replace(words[i], @"\t|\n|\r|[()]", "")));
                    }

                    // Add the consenting agents to the action.
                    domain.Operators.Last().ConsentingAgents = consenting;
                }
            }

            // Create a working copy of the domain file.
            Writer.DomainToPDDL(Parser.GetTopDirectory() + @"Benchmarks\" + domain.Name.ToLower() + @"\domrob.pddl", domain);

            return(domain);
        }
示例#11
0
        public async Task UpgradePlanAsync(Guid organizationId, PlanType plan, int additionalSeats)
        {
            var organization = await _organizationRepository.GetByIdAsync(organizationId);

            if (organization == null)
            {
                throw new NotFoundException();
            }

            if (string.IsNullOrWhiteSpace(organization.StripeCustomerId))
            {
                throw new BadRequestException("No payment method found.");
            }

            var existingPlan = StaticStore.Plans.FirstOrDefault(p => p.Type == organization.PlanType);

            if (existingPlan == null)
            {
                throw new BadRequestException("Existing plan not found.");
            }

            var newPlan = StaticStore.Plans.FirstOrDefault(p => p.Type == plan && !p.Disabled);

            if (newPlan == null)
            {
                throw new BadRequestException("Plan not found.");
            }

            if (existingPlan.Type == newPlan.Type)
            {
                throw new BadRequestException("Organization is already on this plan.");
            }

            if (existingPlan.UpgradeSortOrder >= newPlan.UpgradeSortOrder)
            {
                throw new BadRequestException("You cannot upgrade to this plan.");
            }

            if (!newPlan.CanBuyAdditionalSeats && additionalSeats > 0)
            {
                throw new BadRequestException("Plan does not allow additional seats.");
            }

            if (newPlan.CanBuyAdditionalSeats && newPlan.MaxAdditionalSeats.HasValue &&
                additionalSeats > newPlan.MaxAdditionalSeats.Value)
            {
                throw new BadRequestException($"Selected plan allows a maximum of " +
                                              $"{newPlan.MaxAdditionalSeats.Value} additional seats.");
            }

            var newPlanSeats = (short)(newPlan.BaseSeats + (newPlan.CanBuyAdditionalSeats ? additionalSeats : 0));

            if (!organization.Seats.HasValue || organization.Seats.Value > newPlanSeats)
            {
                var userCount = await _organizationUserRepository.GetCountByOrganizationIdAsync(organization.Id);

                if (userCount >= newPlanSeats)
                {
                    throw new BadRequestException($"Your organization currently has {userCount} seats filled. Your new plan " +
                                                  $"only has ({newPlanSeats}) seats. Remove some users.");
                }
            }

            if (newPlan.MaxSubvaults.HasValue &&
                (!organization.MaxSubvaults.HasValue || organization.MaxSubvaults.Value > newPlan.MaxSubvaults.Value))
            {
                var subvaultCount = await _subvaultRepository.GetCountByOrganizationIdAsync(organization.Id);

                if (subvaultCount > newPlan.MaxSubvaults.Value)
                {
                    throw new BadRequestException($"Your organization currently has {subvaultCount} subvaults. " +
                                                  $"Your new plan allows for a maximum of ({newPlan.MaxSubvaults.Value}) subvaults. " +
                                                  "Remove some subvaults.");
                }
            }

            var subscriptionService = new StripeSubscriptionService();

            if (string.IsNullOrWhiteSpace(organization.StripeSubscriptionId))
            {
                // They must have been on a free plan. Create new sub.
                var subCreateOptions = new StripeSubscriptionCreateOptions
                {
                    Items = new List <StripeSubscriptionItemOption>
                    {
                        new StripeSubscriptionItemOption
                        {
                            PlanId   = newPlan.StripePlanId,
                            Quantity = 1
                        }
                    }
                };

                if (additionalSeats > 0)
                {
                    subCreateOptions.Items.Add(new StripeSubscriptionItemOption
                    {
                        PlanId   = newPlan.StripeSeatPlanId,
                        Quantity = additionalSeats
                    });
                }

                await subscriptionService.CreateAsync(organization.StripeCustomerId, subCreateOptions);
            }
            else
            {
                // Update existing sub.
                var subUpdateOptions = new StripeSubscriptionUpdateOptions
                {
                    Items = new List <StripeSubscriptionItemUpdateOption>
                    {
                        new StripeSubscriptionItemUpdateOption
                        {
                            PlanId   = newPlan.StripePlanId,
                            Quantity = 1
                        }
                    }
                };

                if (additionalSeats > 0)
                {
                    subUpdateOptions.Items.Add(new StripeSubscriptionItemUpdateOption
                    {
                        PlanId   = newPlan.StripeSeatPlanId,
                        Quantity = additionalSeats
                    });
                }

                await subscriptionService.UpdateAsync(organization.StripeSubscriptionId, subUpdateOptions);
            }
        }
示例#12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Plan" /> class.
 /// </summary>
 /// <param name="identity">The identity object for the plan.</param>
 /// <param name="content">The content (<see cref="VotePartition"/>) of the plan.</param>
 /// <param name="planType">Type of the plan.</param>
 public Plan(Identity identity, VotePartition content, PlanType planType)
 {
     Identity = identity ?? throw new ArgumentNullException(nameof(identity));
     Content  = content ?? throw new ArgumentNullException(nameof(content));
     PlanType = planType;
 }
        public async Task Register(string name, string email, string birth, string tell, string city, string state, string provincy, PlanType plan, string id)
        {
            var form = new Form {
                BirthDate = Utils.FormatarData(birth),
                City      = city,
                Email     = email,
                Name      = name,
                Provincy  = provincy,
                State     = state.ToUpper(),
                Tell      = Utils.CleanFormat(tell),
                PersonId  = id,
                Plan      = plan,
                Status    = FormStatus.New,
            };

            await _context.AddAsync(form);

            await _context.SaveChangesAsync();
        }
示例#14
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 56, Configuration.FieldSeparator),
                       Id,
                       SetIdIn1.HasValue ? SetIdIn1.Value.ToString(culture) : null,
                       HealthPlanId?.ToDelimitedString(),
                       InsuranceCompanyId != null ? string.Join(Configuration.FieldRepeatSeparator, InsuranceCompanyId.Select(x => x.ToDelimitedString())) : null,
                       InsuranceCompanyName != null ? string.Join(Configuration.FieldRepeatSeparator, InsuranceCompanyName.Select(x => x.ToDelimitedString())) : null,
                       InsuranceCompanyAddress != null ? string.Join(Configuration.FieldRepeatSeparator, InsuranceCompanyAddress.Select(x => x.ToDelimitedString())) : null,
                       InsuranceCoContactPerson != null ? string.Join(Configuration.FieldRepeatSeparator, InsuranceCoContactPerson.Select(x => x.ToDelimitedString())) : null,
                       InsuranceCoPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, InsuranceCoPhoneNumber.Select(x => x.ToDelimitedString())) : null,
                       GroupNumber,
                       GroupName != null ? string.Join(Configuration.FieldRepeatSeparator, GroupName.Select(x => x.ToDelimitedString())) : null,
                       InsuredsGroupEmpId != null ? string.Join(Configuration.FieldRepeatSeparator, InsuredsGroupEmpId.Select(x => x.ToDelimitedString())) : null,
                       InsuredsGroupEmpName != null ? string.Join(Configuration.FieldRepeatSeparator, InsuredsGroupEmpName.Select(x => x.ToDelimitedString())) : null,
                       PlanEffectiveDate.HasValue ? PlanEffectiveDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       PlanExpirationDate.HasValue ? PlanExpirationDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       AuthorizationInformation?.ToDelimitedString(),
                       PlanType?.ToDelimitedString(),
                       NameOfInsured != null ? string.Join(Configuration.FieldRepeatSeparator, NameOfInsured.Select(x => x.ToDelimitedString())) : null,
                       InsuredsRelationshipToPatient?.ToDelimitedString(),
                       InsuredsDateOfBirth.HasValue ? InsuredsDateOfBirth.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       InsuredsAddress != null ? string.Join(Configuration.FieldRepeatSeparator, InsuredsAddress.Select(x => x.ToDelimitedString())) : null,
                       AssignmentOfBenefits?.ToDelimitedString(),
                       CoordinationOfBenefits?.ToDelimitedString(),
                       CoordOfBenPriority,
                       NoticeOfAdmissionFlag,
                       NoticeOfAdmissionDate.HasValue ? NoticeOfAdmissionDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ReportOfEligibilityFlag,
                       ReportOfEligibilityDate.HasValue ? ReportOfEligibilityDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ReleaseInformationCode?.ToDelimitedString(),
                       PreAdmitCertPac,
                       VerificationDateTime.HasValue ? VerificationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       VerificationBy != null ? string.Join(Configuration.FieldRepeatSeparator, VerificationBy.Select(x => x.ToDelimitedString())) : null,
                       TypeOfAgreementCode?.ToDelimitedString(),
                       BillingStatus?.ToDelimitedString(),
                       LifetimeReserveDays.HasValue ? LifetimeReserveDays.Value.ToString(Consts.NumericFormat, culture) : null,
                       DelayBeforeLRDay.HasValue ? DelayBeforeLRDay.Value.ToString(Consts.NumericFormat, culture) : null,
                       CompanyPlanCode?.ToDelimitedString(),
                       PolicyNumber,
                       PolicyDeductible?.ToDelimitedString(),
                       PolicyLimitAmount,
                       PolicyLimitDays.HasValue ? PolicyLimitDays.Value.ToString(Consts.NumericFormat, culture) : null,
                       RoomRateSemiPrivate,
                       RoomRatePrivate,
                       InsuredsEmploymentStatus?.ToDelimitedString(),
                       InsuredsAdministrativeSex?.ToDelimitedString(),
                       InsuredsEmployersAddress != null ? string.Join(Configuration.FieldRepeatSeparator, InsuredsEmployersAddress.Select(x => x.ToDelimitedString())) : null,
                       VerificationStatus,
                       PriorInsurancePlanId?.ToDelimitedString(),
                       CoverageType?.ToDelimitedString(),
                       Handicap?.ToDelimitedString(),
                       InsuredsIdNumber != null ? string.Join(Configuration.FieldRepeatSeparator, InsuredsIdNumber.Select(x => x.ToDelimitedString())) : null,
                       SignatureCode?.ToDelimitedString(),
                       SignatureCodeDate.HasValue ? SignatureCodeDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       InsuredsBirthPlace,
                       VipIndicator?.ToDelimitedString(),
                       ExternalHealthPlanIdentifiers != null ? string.Join(Configuration.FieldRepeatSeparator, ExternalHealthPlanIdentifiers.Select(x => x.ToDelimitedString())) : null,
                       InsuranceActionCode
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
        public async Task ValidateSponsorshipAsync_SponsoringOrgDisabledLessThanGrace_Valid(PlanType planType,
                                                                                            Organization sponsoredOrg, OrganizationSponsorship existingSponsorship, Organization sponsoringOrg,
                                                                                            SutProvider <ValidateSponsorshipCommand> sutProvider)
        {
            sponsoringOrg.PlanType       = planType;
            sponsoringOrg.Enabled        = true;
            sponsoringOrg.ExpirationDate = DateTime.UtcNow.AddDays(-1);
            existingSponsorship.SponsoringOrganizationId = sponsoringOrg.Id;

            sutProvider.GetDependency <IOrganizationSponsorshipRepository>()
            .GetBySponsoredOrganizationIdAsync(sponsoredOrg.Id).Returns(existingSponsorship);
            sutProvider.GetDependency <IOrganizationRepository>().GetByIdAsync(sponsoredOrg.Id).Returns(sponsoredOrg);
            sutProvider.GetDependency <IOrganizationRepository>().GetByIdAsync(sponsoringOrg.Id).Returns(sponsoringOrg);

            var result = await sutProvider.Sut.ValidateSponsorshipAsync(sponsoredOrg.Id);

            Assert.True(result);

            await AssertDidNotRemoveSponsoredPaymentAsync(sutProvider);
            await AssertDidNotRemoveSponsorshipAsync(sutProvider);
        }
 public void RemovePlan(string name, PlanType type)
 {
     service.RemovePlan(name, type);
 }
 public bool CreatePlan(string name, PlanType type, decimal monthPrice, decimal yearPrice, int userLimit, int privateRepoLimit)
 {
     return service.CreatePlan(name, type, monthPrice, yearPrice, userLimit, privateRepoLimit);
 }
 public Plan GetPlanByNameAndType(string name, PlanType type)
 {
     return service.GetPlanByNameAndType(name, type);
 }
 public Plan[] GetPlansByType(PlanType type)
 {
     return service.GetPlansByType(type);
 }
示例#20
0
 public static string FriendlyName(this PlanType type) => type switch
 {
示例#21
0
 public async Task <IActionResult> Post([FromBody] PlanType data)
 {
     data.TenantId  = Context.TenantId;
     data.CreatedOn = DateTime.Now;
     return(Respond(await _service.CreateAsync(data)));
 }
示例#22
0
 public FrmShowInfo(String info, PlanType type)
 {
     InitializeComponent();
     this.info = info;
     this.type = type;
 }
示例#23
0
        public bool DoPreferrentialReordering( ScreenGroup _Group,PlanType _PlanType,string _Year,string _DistId,string _DivnId,string _MultiEUSCode)
        {
            try
            {
                //this.USER_NAME = USER_NAME;
                this.SCREEN_NAME = _Group;
                this.PLAN_TYPE = _PlanType;
                this.YEAR = _Year;
                this.DIST_ID = _DistId;
                this.DIVN_ID = _DivnId;
                this.MULTI_EUS_CODE = _MultiEUSCode;
                bool File_Not_Found = false;

                if (!File.Exists(FILE_NAME))
                {
                    if (!File.Exists(ENCRYPTED_FILE_NAME))
                    {
                        DoCreateRowOrderingFile();
                        File_Not_Found = true;
                    }
                    else
                    {
                        CryptoProgressCallBack cb = new CryptoProgressCallBack(this.ProgressCallBackDecrypt);
                        FileCrypt.DecryptFile(ENCRYPTED_FILE_NAME, FILE_NAME, "", cb);
                        if (File.Exists(ENCRYPTED_FILE_NAME))
                            File.Delete(ENCRYPTED_FILE_NAME);
                        File_Not_Found = false;
                    }
                    //DoAddUserToConfigurationFile();
                }

                if (!File_Not_Found)
                {
                    DoCheckFileConfig();
                    if (EUS_EXIST_IN_DATA_SECTION && SCREEN_EXIST_IN_DATA_SECTION && RECORD_SPEC_EXIST_IN_DATA_SECTION)
                    {
                        if (!DoReordering())
                        {
                            //TODO throw exception
                        }
                        //ReorderAssociatedGrids();
                    }
                }
                return false;
            }
            catch
            {
                return true;
            }
        }
        public async Task ValidateSponsorshipAsync_SponsoringOrgDisabledUnknownTime_UpdatesStripePlan(PlanType planType,
                                                                                                      Organization sponsoredOrg, OrganizationSponsorship existingSponsorship, Organization sponsoringOrg,
                                                                                                      SutProvider <ValidateSponsorshipCommand> sutProvider)
        {
            sponsoringOrg.PlanType       = planType;
            sponsoringOrg.Enabled        = false;
            sponsoringOrg.ExpirationDate = null;
            existingSponsorship.SponsoringOrganizationId = sponsoringOrg.Id;

            sutProvider.GetDependency <IOrganizationSponsorshipRepository>()
            .GetBySponsoredOrganizationIdAsync(sponsoredOrg.Id).Returns(existingSponsorship);
            sutProvider.GetDependency <IOrganizationRepository>().GetByIdAsync(sponsoredOrg.Id).Returns(sponsoredOrg);
            sutProvider.GetDependency <IOrganizationRepository>().GetByIdAsync(sponsoringOrg.Id).Returns(sponsoringOrg);

            var result = await sutProvider.Sut.ValidateSponsorshipAsync(sponsoredOrg.Id);

            Assert.False(result);
            await AssertRemovedSponsoredPaymentAsync(sponsoredOrg, existingSponsorship, sutProvider);
            await AssertRemovedSponsorshipAsync(existingSponsorship, sutProvider);
        }
示例#25
0
        /// <summary>
        /// Checks to see if anyone is using a plan or not
        /// </summary>
        /// <param name="planID"></param>
        /// <param name="planType"></param>
        /// <returns></returns>
        public static List<string> IsPlanInUse(int planID, PlanType planType)
        {
            SqlConnection sql = new SqlConnection(ConfigurationManager.ConnectionStrings["DB"].ConnectionString);
            SqlCommand cmd = new SqlCommand("", sql);

            // How string that we send back for who is using the plan
            // If we have no data this will be returned NULL
            List<string> whoIsUsingPlan = null;
            try
            {
                // Figure out what plan it is then generate the command
                switch (planType)
                {
                    case PlanType.Company:
                        cmd.CommandText = "SELECT CompanyName AS Name FROM Companies WHERE OrgPlanID=@PlanID AND IsReseller=0";
                        break;
                    case PlanType.Mailbox:
                        cmd.CommandText = "SELECT UserPrincipalName AS Name FROM Users WHERE MailboxPlan=@PlanID";
                        break;
                    case PlanType.ActiveSync:
                        cmd.CommandText = "SELECT UserPrincipalName AS Name FROM Users WHERE ActiveSyncPlan=@PlanID";
                        break;
                    case PlanType.Citrix:
                        cmd.CommandText = "SELECT UserPrincipalName AS Name FROM Users WHERE ID IN (SELECT UserID FROM UserPlansCitrix WHERE CitrixPlanID=@PlanID)";
                        break;
                    case PlanType.PublicFolder:
                        cmd.CommandText = "SELECT CompanyName AS Name FROM Companies WHERE ExchPFPlan=@PlanID";
                        break;
                    default:
                        throw new Exception("Invalid plan type was specified.");
                }

                // Add parameter
                cmd.Parameters.AddWithValue("PlanID", planID);

                // Open connection
                sql.Open();

                // Read Data
                SqlDataReader r = cmd.ExecuteReader();
                if (r.HasRows)
                {
                    whoIsUsingPlan = new List<string>();

                    while (r.Read())
                    {
                        whoIsUsingPlan.Add(r["Name"].ToString());
                    }
                }

                // Close
                r.Close();
                sql.Close();

                // Return data
                return whoIsUsingPlan;
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                cmd.Dispose();
                sql.Dispose();
            }
                
        }
 public Plan[] GetPlansByType(PlanType type)
 {
     throw new NotImplementedException("Not implemented: " + MethodBase.GetCurrentMethod().Name);
 }
示例#27
0
        /// <summary>
        /// Gets the plans from a vote.
        /// </summary>
        /// <param name="vote">The vote.</param>
        /// <returns>Returns a list of all plans found within a vote.</returns>
        public static List <Plan> GetPlansFromVote(Vote vote)
        {
            if (vote == null)
            {
                throw new ArgumentNullException(nameof(vote));
            }

            if (!vote.IsValid)
            {
                throw new InvalidOperationException("This is not a valid vote.");
            }

            List <Plan> plans = new List <Plan>();

            var voteGrouping = vote.GetVoteMarkerGroups();

            bool checkForBasePlans = true;

            // Base plans
            while (checkForBasePlans && voteGrouping.Any())
            {
                var voteGroup = voteGrouping.First();

                Match m = anyPlanRegex.Match(voteGroup.Key);

                if (m.Groups["base"].Success && voteGroup.First().MarkerType == MarkerType.Vote && voteGroup.Count() > 1)
                {
                    var partition = new VotePartition(voteGroup, VoteType.Plan);
                    plans.Add(new Plan(m.Groups["planname"].Value, vote.Post.Identity, partition, PlanType.Base));
                    voteGrouping = voteGrouping.Skip(1);
                }
                else
                {
                    checkForBasePlans = false;
                }
            }

            // Vote labels
            if (voteGrouping.Any())
            {
                var voteGroup = voteGrouping.First();

                Match m = anyPlanRegex.Match(voteGroup.Key);

                if (m.Success && m.Groups["base"].Success == false && voteGroup.Count() == 1 &&
                    voteGroup.First().MarkerType == MarkerType.Vote)
                {
                    var labeledGroups = voteGrouping.TakeWhile(g => g.First().MarkerType == MarkerType.Vote ||
                                                               g.First().MarkerType == MarkerType.Approval);

                    var flattenedLines = labeledGroups.SelectMany(a => a).ToList();
                    var partition      = new VotePartition(flattenedLines, VoteType.Plan);

                    PlanType planType = labeledGroups.Skip(1).Any() ? PlanType.Label : PlanType.SingleLine;

                    voteGrouping = voteGrouping.Skip(labeledGroups.Count());

                    plans.Add(new Plan(m.Groups["planname"].Value, vote.Post.Identity, partition, planType));
                }
            }

            // Any other defined plans with content
            foreach (var voteGroup in voteGrouping)
            {
                Match m = anyPlanRegex.Match(voteGroup.Key);
                if (m.Success && voteGroup.Skip(1).Any())
                {
                    var partition = new VotePartition(voteGroup, VoteType.Plan);
                    plans.Add(new Plan(m.Groups["planname"].Value, vote.Post.Identity, partition, PlanType.Content));
                }
            }

            vote.StorePlans(plans);

            // Return all collected plans
            return(plans);
        }
 public void RemovePlan(string name, PlanType type)
 {
     throw new NotImplementedException("Not implemented: " + MethodBase.GetCurrentMethod().Name);
 }
示例#29
0
        public void LoadPlanTypes()
        {
            List <PlanType> ptList = new List <PlanType>();

            PlanType pt = new PlanType()
            {
                Type         = "Intracranial",
                Description  = "Brain (Intracranial) with 6DOF Skull tracking",
                IsLOT        = false,
                DesiredColor = "rgba(255,255,0,0.46)"
            };

            ptList.Add(pt);

            pt = new PlanType()
            {
                Type         = "Body, Spine Tracking",
                Description  = "Body with tracking on spine",
                IsLOT        = false,
                DesiredColor = "rgba(255,0,0,0.52)"
            };

            ptList.Add(pt);

            pt = new PlanType()
            {
                Type         = "Body, Fiducial",
                Description  = "Body using fiducials for motion tracking without Synchrony",
                IsLOT        = false,
                DesiredColor = "rgba(255,142,0,0.36)"
            };

            ptList.Add(pt);

            pt = new PlanType()
            {
                Type         = "Body, Synchrony",
                Description  = "Body using fiducials with Synchrony",
                IsLOT        = false,
                DesiredColor = "rgba(112,0,255,0.36)"
            };

            ptList.Add(pt);

            pt = new PlanType()
            {
                Type         = "Lung LOT",
                Description  = "Lung using LOT Planning",
                IsLOT        = true,
                DesiredColor = "rgba(0,254,58,0.34)"
            };

            ptList.Add(pt);

            pt = new PlanType()
            {
                Type         = "Prostate",
                Description  = "Prostate SRT",
                IsLOT        = true,
                DesiredColor = "rgba(0,140,255,0.34)"
            };

            ptList.Add(pt);
            ctx.PlanType.AddRange(ptList);
            ctx.SaveChanges();
        }
示例#30
0
 public RecentPlan(string path, PlanType type)
 {
     Path = path;
     Type = type;
 }
示例#31
0
 public static PlanReference Get(PlanType type, float price)
 {
     return(AllPlans.FirstOrDefault(p => p.Type == type && p.MinPrice <= price && p.MaxPrice >= price));
 }
示例#32
0
        public void AddMoves(List <Move> moves, Map map, State state, Tile source, Hero hero, PlayerType player, PlanType plan)
        {
            switch (plan)
            {
            case PlanType.Crashed: moves.Add(Move.Crashed); break;

            case PlanType.Stay: moves.Add(Move.Stay); break;

            case PlanType.ToMineClosetToTavern: GetToMineClosetToTavernPaths(moves, map, state, source, hero, player); return;

            case PlanType.ToMine: GetMinePaths(moves, map, state, source, hero, player); return;

            case PlanType.ToFreeMine: GetFreeMinePaths(moves, map, state, source, hero, player); return;

            case PlanType.ToOwnMine: GetOwnMinePaths(moves, map, state, source, hero, player); return;

            case PlanType.ToTavern: GetTavernPaths(moves, map, state, source, hero, player); return;

            case PlanType.Combat: GetCombatMoves(moves, map, state, source, hero, player); return;

            default: break;
            }
        }
 public Plan GetPlanByNameAndType(string name, PlanType type)
 {
     throw new NotImplementedException("Not implemented: " + MethodBase.GetCurrentMethod().Name);
 }
示例#34
0
        public ActionResult RevivalRequest(string UId, string CoId, string StId, string Plan, PlanType planType)
        {
            PlanReivalRequestViewModel viewmodel = new PlanReivalRequestViewModel();
            var uid  = EncryptionHelper.Unprotect(UId);
            var coid = EncryptionHelper.Unprotect(CoId);
            var stid = EncryptionHelper.Unprotect(StId);

            if (coid != null && PlansPrices.CompanyPlans.ContainsKey(Plan))
            {
                var company = unitOfWork.CompanyRepository.GetByID(coid);
                if (company.Admins.Any(u => u.UserId == WebSecurity.CurrentUserId))
                {
                    viewmodel.companyToRevive = company;
                    viewmodel.coId            = CoId;
                }
                else
                {
                    return(new RedirectToError());
                }
            }
            else if (stid != null && PlansPrices.StorePlans.ContainsKey(Plan))
            {
                var store = unitOfWork.StoreRepository.GetByID(stid);
                if (store.Admins.Any(u => u.UserId == WebSecurity.CurrentUserId))
                {
                    viewmodel.storeToRevive = store;
                    viewmodel.storeId       = StId;
                }
                else
                {
                    return(new RedirectToError());
                }
            }
            else if (uid != null && PlansPrices.UserPlans.ContainsKey(Plan))
            {
                var user = unitOfWork.ActiveUserRepository.GetByID(uid);
                if (user.UserId == WebSecurity.CurrentUserId)
                {
                    viewmodel.userToRevive = user;
                    viewmodel.userId       = UId;
                }
                else
                {
                    return(new RedirectToError());
                }
            }
            else
            {
                return(new RedirectToError());
            }

            viewmodel.plan     = Plan;
            viewmodel.planType = planType;
            return(View(viewmodel));
        }
 public bool CreatePlan(string name, PlanType type, decimal monthPrice, decimal yearPrice, int userLimit, int privateRepoLimit)
 {
     throw new NotImplementedException("Not implemented: " + MethodBase.GetCurrentMethod().Name);
 }
示例#36
0
        public ActionResult RevivalRequest(PlanReivalRequestViewModel ReviveRequest, string UId, string CoId, string StId, string Plan, PlanType planType)
        {
            var uid   = EncryptionHelper.Unprotect(UId);
            var ruid  = EncryptionHelper.Unprotect(ReviveRequest.userId);
            var coid  = EncryptionHelper.Unprotect(CoId);
            var rcoid = EncryptionHelper.Unprotect(ReviveRequest.coId);
            var stid  = EncryptionHelper.Unprotect(StId);
            var rstid = EncryptionHelper.Unprotect(ReviveRequest.storeId);

            if (ModelState.IsValid)
            {
                RevivalRequest revivalToInsert = new RevivalRequest();
                if (rcoid == coid && coid != null &&
                    rstid == null &&
                    ruid == null &&
                    planType == PlanType.Company &&
                    PlansPrices.CompanyPlans.ContainsKey(Plan))
                {
                    revivalToInsert.coID = EncryptionHelper.Unprotect(ReviveRequest.coId);
                }
                else if (rstid == stid && stid != null &&
                         rcoid == null &&
                         ruid == null &&
                         planType == PlanType.Store &&
                         PlansPrices.StorePlans.ContainsKey(Plan))
                {
                    revivalToInsert.storeID = EncryptionHelper.Unprotect(ReviveRequest.storeId);
                }
                else if (ruid == uid && uid != null &&
                         rcoid == null &&
                         rstid == null &&
                         planType == PlanType.User &&
                         PlansPrices.UserPlans.ContainsKey(Plan))
                {
                    revivalToInsert.userID = EncryptionHelper.Unprotect(ReviveRequest.userId);
                }
                else
                {
                    throw new JsonCustomException(ControllerError.ajaxError);
                }

                revivalToInsert.reqDate         = DateTime.UtcNow;
                revivalToInsert.planType        = ReviveRequest.planType;
                revivalToInsert.plan            = ReviveRequest.plan;
                revivalToInsert.requesterUserID = WebSecurity.CurrentUserId;

                unitOfWork.RevivalPlanRequestRepository.Insert(revivalToInsert);
                unitOfWork.Save();
                return(Json(new { URL = Url.Action("PayForPlan", "Payment", new { reqId = EncryptionHelper.Protect(revivalToInsert.reqID) }) }));
                //return RedirectToAction("PayForPlan", "Payment", new { reqId = EncryptionHelper.Protect(revivalToInsert.reqID) });
            }
            else
            {
                throw new ModelStateException(this.ModelState);
            }
        }
示例#37
0
        public static async Task <Response> CreatePlanAsync(string source, string target, string time, PlanType planType)
        {
            if (source == null || target == null || time == null)
            {
                return(null);
            }

            var session    = driver.AsyncSession();
            var parameters = new Dictionary <string, object>()
            {
                [nameof(source)] = source,
                [nameof(target)] = target,
                [nameof(time)]   = time
            };

            return(await RunQueryAsync(session, planType, parameters));
        }
示例#38
0
 public static Plan GetPlan(PlanType planType) =>
 Plans.FirstOrDefault(p => p.Type == planType);
示例#39
0
 public RuinedShipPlans(PlanType type) : base(5360)
 {
     m_PlanType = type;
     m_Joined.Add(type);
 }
示例#40
0
 public PaidOrganizationAutoDataAttribute(PlanType planType) : base(new SutProviderCustomization(),
                                                                    new PaidOrganization {
     CheckedPlanType = planType
 })
 {
 }
示例#41
0
        public override void Deserialize(GenericReader reader)
		{
		 	base.Deserialize(reader);
			int version = reader.ReadInt();
			m_PlanType = (PlanType)reader.ReadInt();

            int count = reader.ReadInt();
            for(int i = 0; i < count; i++)
                m_Joined.Add((PlanType)reader.ReadInt());
		}
示例#42
0
 public InlinePaidOrganizationAutoDataAttribute(PlanType planType, object[] values) : base(
         new ICustomization[] { new SutProviderCustomization(), new PaidOrganization {
                                    CheckedPlanType = planType
                                } }, values)
 {
 }
        public PlanViewModels(PlanType type, List <DateTime> dates)
        {
            if (dates == null)
            {
                return;
            }
            this.type  = type;
            this.dates = dates;
            db         = new PlanContext();
            switch (type)
            {
            case PlanType.ГГПЗ:
                db.PlanGGPZ.Load();
                {
                    List <PlanGGPZ> planDatas = db.PlanGGPZ.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                    foreach (DateTime dateTime in dates)
                    {
                        if (!planDatas.Any(x => DateTime.Parse(x.Date) == dateTime))
                        {
                            db.PlanGGPZ.Add(new PlanGGPZ()
                            {
                                Date = dateTime.ToLongDateString()
                            });
                        }
                    }
                }
                db.SaveChanges();
                PlanGGPZ = db.PlanGGPZ.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                break;

            case PlanType.НГП:
                db.PlanNGP.Load();
                {
                    List <PlanNGP> planDatas = db.PlanNGP.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                    foreach (DateTime dateTime in dates)
                    {
                        if (!planDatas.Any(x => DateTime.Parse(x.Date) == dateTime))
                        {
                            db.PlanNGP.Add(new PlanNGP()
                            {
                                Date = dateTime.ToLongDateString()
                            });
                        }
                    }
                }
                db.SaveChanges();
                PlanNGP = db.PlanNGP.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                break;

            case PlanType.ЮПГПЗ:
                db.PlanYPGPZ.Load();
                {
                    List <PlanYPGPZ> planDatas = db.PlanYPGPZ.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                    foreach (DateTime dateTime in dates)
                    {
                        if (!planDatas.Any(x => DateTime.Parse(x.Date) == dateTime))
                        {
                            db.PlanYPGPZ.Add(new PlanYPGPZ()
                            {
                                Date = dateTime.ToLongDateString()
                            });
                        }
                    }
                }
                db.SaveChanges();
                PlanYPGPZ = db.PlanYPGPZ.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                break;

            case PlanType.ЮБГПЗ:
                db.PlanYBGPZ.Load();
                {
                    List <PlanYBGPZ> planDatas = db.PlanYBGPZ.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                    foreach (DateTime dateTime in dates)
                    {
                        if (!planDatas.Any(x => DateTime.Parse(x.Date) == dateTime))
                        {
                            db.PlanYBGPZ.Add(new PlanYBGPZ()
                            {
                                Date = dateTime.ToLongDateString()
                            });
                        }
                    }
                }
                db.SaveChanges();
                PlanYBGPZ = db.PlanYBGPZ.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                break;

            case PlanType.МГПЗ:
                db.PlanMGPZ.Load();
                {
                    List <PlanMGPZ> planDatas = db.PlanMGPZ.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                    foreach (DateTime dateTime in dates)
                    {
                        if (!planDatas.Any(x => DateTime.Parse(x.Date) == dateTime))
                        {
                            db.PlanMGPZ.Add(new PlanMGPZ()
                            {
                                Date = dateTime.ToLongDateString()
                            });
                        }
                    }
                }
                db.SaveChanges();
                PlanMGPZ = db.PlanMGPZ.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                break;

            case PlanType.ВГПЗ:
                db.PlanVGPZ.Load();
                {
                    List <PlanVGPZ> planDatas = db.PlanVGPZ.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                    foreach (DateTime dateTime in dates)
                    {
                        if (!planDatas.Any(x => DateTime.Parse(x.Date) == dateTime))
                        {
                            db.PlanVGPZ.Add(new PlanVGPZ()
                            {
                                Date = dateTime.ToLongDateString()
                            });
                        }
                    }
                }
                db.SaveChanges();
                PlanVGPZ = db.PlanVGPZ.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                break;

            case PlanType.НВГПК:
                db.PlanNVGPK.Load();
                {
                    List <PlanNVGPK> planDatas = db.PlanNVGPK.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                    foreach (DateTime dateTime in dates)
                    {
                        if (!planDatas.Any(x => DateTime.Parse(x.Date) == dateTime))
                        {
                            db.PlanNVGPK.Add(new PlanNVGPK()
                            {
                                Date = dateTime.ToLongDateString()
                            });
                        }
                    }
                }
                db.SaveChanges();
                PlanNVGPK = db.PlanNVGPK.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                break;

            case PlanType.БГПК:
                db.PlanBGPK.Load();
                {
                    List <PlanBGPK> planDatas = db.PlanBGPK.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                    foreach (DateTime dateTime in dates)
                    {
                        if (!planDatas.Any(x => DateTime.Parse(x.Date) == dateTime))
                        {
                            db.PlanBGPK.Add(new PlanBGPK()
                            {
                                Date = dateTime.ToLongDateString()
                            });
                        }
                    }
                }
                db.SaveChanges();
                PlanBGPK = db.PlanBGPK.Local.ToBindingList().Where(x => Between(DateTime.Parse(x.Date), dates.First(), dates.Last())).ToList();
                break;
            }
        }
示例#44
0
        public List <DayPlan> Query(PlanType type, Boolean showCompleted, int planId)
        {
            var plan = CurrentDB.DayPlanTable.Where(o => o.Id == planId && o.IsCompleted).ToList();

            return(plan);
        }
示例#45
0
 public async Task <IActionResult> Put([FromBody] PlanType data)
 {
     data.UpdatedOn = DateTime.Now;
     return(Respond(await _service.UpdateAsync(data)));
 }
示例#46
0
        public static T_PlaningDTO ShipPlan(T_PlaningDTO dto, string cStartDate, string cEndDate, PlanType type)
        {
            // int moveDay = 0;

            int diffPODay     = 0;
            int diffActionDay = 0;

            int diffSpecPODay   = 0;
            int diffPOActionDay = 0;

            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            // spec
            DateTime SpecSTDate = Convert.ToDateTime(MMddYY(dto.SpecSDate));
            DateTime SpecETDate = Convert.ToDateTime(MMddYY(dto.SpecEDate));


            // po
            DateTime POSTDate = Convert.ToDateTime(MMddYY(dto.POSDate));
            DateTime POETDate = Convert.ToDateTime(MMddYY(dto.POEDate));

            diffPODay = (POETDate - POSTDate).Days;


            // action
            DateTime ActionSTDate = Convert.ToDateTime(MMddYY(dto.ActionSDate));
            DateTime ActionETDate = Convert.ToDateTime(MMddYY(dto.ActionEDate));

            diffActionDay = (ActionETDate - ActionSTDate).Days;



            diffSpecPODay = (POSTDate - SpecETDate).Days;

            diffPOActionDay = (ActionSTDate - POETDate).Days;;



            // Change
            DateTime ChangeSDate = Convert.ToDateTime(MMddYY(cStartDate));
            DateTime ChangeEDate = Convert.ToDateTime(MMddYY(cEndDate));

            //  moveDay = ChangeSDate.Day - SpecSTDate.Day;



            if (type == PlanType.Spec)
            {
                POSTDate = ChangeEDate.AddDays(diffSpecPODay); //15

                POETDate = POSTDate.AddDays(diffPODay);

                ActionSTDate = POETDate.AddDays(diffPOActionDay);

                ActionETDate = ActionSTDate.AddDays(diffActionDay);
            }
            else if (type == PlanType.PO)
            {
                POSTDate = ChangeSDate;
                POETDate = ChangeEDate;

                ActionSTDate = POETDate.AddDays(diffPOActionDay);

                ActionETDate = ActionSTDate.AddDays(diffActionDay);
            }
            else if (type == PlanType.Action)
            {
                ActionSTDate = ChangeSDate;
                ActionETDate = ChangeEDate;
            }

            /* if (POETDate.Day >= 25 && POETDate.Day <= 31)
             * {
             *   POETDate = new DateTime(POETDate.Year, POETDate.Month, 1).AddMonths(1).AddDays(-1);
             *
             * } else if (POETDate.Day > 14 && POETDate.Day <25)
             * {
             *   POETDate = new DateTime(POETDate.Year, POETDate.Month, 21);
             * }
             * else if (POETDate.Day > 14 && POETDate.Day < 21)
             * {
             *   POETDate = new DateTime(POETDate.Year, POETDate.Month, 14);
             * }
             * else if (POETDate.Day > 7 && POETDate.Day <= 13)
             * {
             *   POETDate = new DateTime(POETDate.Year, POETDate.Month, 7);
             * }
             * else if (POETDate.Day < 7)
             * {
             *   POETDate = POETDate.AddDays(-POETDate.Day);
             * }*/



            /*  if (ActionETDate.Day >= 25 && ActionETDate.Day <= 31)
             * {
             *    ActionETDate = new DateTime(ActionETDate.Year, ActionETDate.Month, 1).AddMonths(1).AddDays(-1);
             *
             * }
             * else if (ActionETDate.Day > 14 && ActionETDate.Day < 25)
             * {
             *    ActionETDate = new DateTime(ActionETDate.Year, ActionETDate.Month, 21);
             * }
             * else if (POETDate.Day > 14 && POETDate.Day < 21)
             * {
             *    POETDate = new DateTime(POETDate.Year, POETDate.Month, 14);
             * }
             * else if (ActionETDate.Day > 7 && ActionETDate.Day <= 13)
             * {
             *    ActionETDate = new DateTime(ActionETDate.Year, ActionETDate.Month, 7);
             * }
             * else if (ActionETDate.Day < 7)
             * {
             *    ActionETDate = ActionETDate.AddDays(-ActionETDate.Day);
             * }*/


            if (type == PlanType.Spec)
            {
                dto.SpecSDate = string.Format("{0}/{1}/{2}", ChangeSDate.Day.ToString("##00")
                                              , ChangeSDate.Month.ToString("##00")
                                              , ChangeSDate.Year.ToString());
                dto.SpecEDate = string.Format("{0}/{1}/{2}", ChangeEDate.Day.ToString("##00")
                                              , ChangeEDate.Month.ToString("##00")
                                              , ChangeEDate.Year.ToString());


                dto.POSDate = string.Format("{0}/{1}/{2}", POSTDate.Day.ToString("##00")
                                            , POSTDate.Month.ToString("##00")
                                            , POSTDate.Year.ToString());
                dto.POEDate = string.Format("{0}/{1}/{2}", POETDate.Day.ToString("##00")
                                            , POETDate.Month.ToString("##00")
                                            , POETDate.Year.ToString());



                dto.ActionSDate = string.Format("{0}/{1}/{2}", ActionSTDate.Day.ToString("##00")
                                                , ActionSTDate.Month.ToString("##00")
                                                , ActionSTDate.Year.ToString());
                dto.ActionEDate = string.Format("{0}/{1}/{2}", ActionETDate.Day.ToString("##00")
                                                , ActionETDate.Month.ToString("##00")
                                                , ActionETDate.Year.ToString());
            }
            else if (type == PlanType.PO)
            {
                dto.POSDate = string.Format("{0}/{1}/{2}", ChangeSDate.Day.ToString("##00")
                                            , ChangeSDate.Month.ToString("##00")
                                            , ChangeSDate.Year.ToString());
                dto.POEDate = string.Format("{0}/{1}/{2}", ChangeEDate.Day.ToString("##00")
                                            , ChangeEDate.Month.ToString("##00")
                                            , ChangeEDate.Year.ToString());


                dto.ActionSDate = string.Format("{0}/{1}/{2}", ActionSTDate.Day.ToString("##00")
                                                , ActionSTDate.Month.ToString("##00")
                                                , ActionSTDate.Year.ToString());
                dto.ActionEDate = string.Format("{0}/{1}/{2}", ActionETDate.Day.ToString("##00")
                                                , ActionETDate.Month.ToString("##00")
                                                , ActionETDate.Year.ToString());
            }
            else if (type == PlanType.Action)
            {
                dto.ActionSDate = string.Format("{0}/{1}/{2}", ChangeSDate.Day.ToString("##00")
                                                , ChangeSDate.Month.ToString("##00")
                                                , ChangeSDate.Year.ToString());
                dto.ActionEDate = string.Format("{0}/{1}/{2}", ChangeEDate.Day.ToString("##00")
                                                , ChangeEDate.Month.ToString("##00")
                                                , ChangeEDate.Year.ToString());
            }

            return(dto);
        }