Beispiel #1
0
        public static bool UseSpell(DMEnv env, Investigator inv, string name)
        {
            Scenario sce = env.Sce;

            if (!inv.Spells.Contains(name))
            {
                env.Append(inv.Name + "还没学会" + name);
                return(false);
            }
            else if (!sce.Spells.TryGetValue(name, out Spell spell))
            {
                env.Append("不存在法术:" + name);
                return(false);
            }
            else if (!spell.Use(inv, out string reply))
            {
                env.Append("施法失败\n" + reply);
                return(false);
            }
            else
            {
                env.Save();
                env.Append(inv.Name + "使用了" + name + (inv.Is("HIDE_VALUE") ? "" : reply));
                return(true);
            }
        }
Beispiel #2
0
    public void ActionPerformed()
    {
        Investigator active = investigators[turnIndex];

        if (active.delayed) // Investigator is delayed
        {
            active.StopBeingDelayed();
            EndTurn();
        }
        else if (active.deathEncounter != null) // Investigator is dead
        {
            EndTurn();
        }
        else
        {
            actionsThisturn++;
            if (actionsThisturn == 2) // Current Investigator's Action turn is over
            {
                EndTurn();
            }
            else // Current Investigator needs to take another Action
            {
                App.View.actionPhaseView.ActionTurnStarted();
            }
        }
    }
Beispiel #3
0
    public void EndTurn()
    {
        turnIndex++;
        if (turnIndex == investigators.Count) // All Investigators have done their Action turn
        {
            // action phase is done
            GameManager.SingleInstance.ActionPhaseComplete();
        }
        else // More Investigators need to take their Action turn
        {
            Investigator active = investigators[turnIndex];
            if (active.delayed)
            {
                active.StopBeingDelayed();
                EndTurn();
            }
            else if (active.deathEncounter != null)
            {
                EndTurn();
            }
            else
            {
                int newIndex = App.Model.investigatorModel.GetInvestigatorIndex(active.investigatorName);
                App.Controller.investigatorController.NewActiveInvestigator(newIndex);
                actionsThisturn = 0;

                App.View.actionPhaseView.ActionTurnStarted();
            }
        }
    }
Beispiel #4
0
 public void DeadInvestigatorLeftLocation(Investigator i)
 {
     if (deadInvestigatorsOnLocation.Contains(i))
     {
         deadInvestigatorsOnLocation.Remove(i);
     }
 }
Beispiel #5
0
        /*******************************************************************/
        public void Add(string investigatorId)
        {
            Investigator investigator = investigatorRepository.Get(investigatorId);

            UpdateModel(investigator);
            UpdateView(investigatorId);
        }
 public static void DisplayInventory(DMEnv env, Investigator inv, string itemName)
 {
     if (inv.Inventory.Count == 0)
     {
         env.Next = $"{inv.Name}没有物品";
     }
     if (!string.IsNullOrEmpty(itemName))
     {
         if (inv.Inventory.TryGetValue(itemName, out Item it))
         {
             env.AppendLine($"{inv.Name}的 {itemName}:")
             .Append("技能名:").AppendLine(it.SkillName)
             .Append("类型:").AppendLine(it.Type)
             .Append("伤害:").AppendLine(it.Damage)
             .Append("贯穿:").AppendLine(it.Impale ? "是" : "否")
             .Append("连发数:").AppendLine(it.MaxCount.ToString())
             .Append("弹匣:").AppendLine(it.Capacity.ToString())
             .Append("故障值:").AppendLine(it.Mulfunction.ToString())
             .Append("弹药:").AppendLine(it.CurrentLoad.ToString())
             .Append("消耗:").Append(it.Cost.ToString());
         }
         else
         {
             env.Next = $"{inv.Name}没有{itemName}";
         }
         return;
     }
     foreach (Item item in inv.Inventory.Values)
     {
         env.LineAppend(item.Name);
     }
 }
Beispiel #7
0
        private void btnInvestigatorRegister_Click(object sender, RoutedEventArgs e)
        {
            investigatorCode = countryCode + cityCode + rankCode + txtSequenceNumber.Text;
            try
            {
                firebaseClient = new FireSharp.FirebaseClient(investigatorConfiguration);
                if (String.IsNullOrWhiteSpace(cmbInvestigatorCountry.Text) || String.IsNullOrWhiteSpace(cmbInvestigatorCity.Text) ||
                    String.IsNullOrWhiteSpace(txtSequenceNumber.Text) || String.IsNullOrWhiteSpace(txtPassword.Password) ||
                    String.IsNullOrWhiteSpace(txtInvestigatorName.Text) || String.IsNullOrWhiteSpace(txtInvestigatorSurname.Text) || String.IsNullOrWhiteSpace(cmbInvestigatorRank.SelectedItem.ToString()) || String.IsNullOrWhiteSpace(txtConfidenceValue.Text))
                {
                    MessageBox.Show("A required field was not filled", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                else
                {
                    Investigator investigator = new Investigator()
                    {
                        InvestigatorID      = investigatorCode,
                        InvestigatorName    = txtInvestigatorName.Text,
                        InvestigatorSurname = txtInvestigatorSurname.Text,
                        InvestigatorRank    = cmbInvestigatorRank.SelectedItem.ToString(),
                        Password            = hashCode.PasswordHass(txtPassword.Password),
                        ConfidenceValue     = double.Parse(txtConfidenceValue.Text.Trim(), CultureInfo.InvariantCulture.NumberFormat)
                    };

                    SetResponse set = firebaseClient.Set(cmbInvestigatorCountry.SelectedItem.ToString() + "/" + cmbInvestigatorCity.SelectedItem.ToString() + "/" + investigatorCode, investigator);
                    MessageBox.Show("You have successfully created a new account", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("Something went wrong, Please try again later!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
    public void NextEncounterTurn()
    {
        turnIndex++;
        if (turnIndex == investigators.Count) // All Investigators have done their encounter turn
        {
            // action phase is done
            GameManager.SingleInstance.EncounterPhaseComplete();
        }
        else // More Investigators need to take their Action turn
        {
            Investigator active   = investigators[turnIndex];
            int          newIndex = App.Model.investigatorModel.GetInvestigatorIndex(active.investigatorName);
            App.Controller.investigatorController.NewActiveInvestigator(newIndex);
            if (active.deathEncounter != null) // Investigator is dead
            {
                NextEncounterTurn();
                return;
            }

            if (active.currentLocation.monstersOnLocation.Count > 0)
            {
                // Fight monsters
                App.Controller.combatController.StartCombatEncounter(active, active.currentLocation.monstersOnLocation, false, CombatFinished);
            }
            else
            {
                // Choose Encounter
                App.View.encounterPhaseView.StartChooseEncounter();
            }
        }
    }
 public void StartTest(TestStat stat, int testMod, TestType testType, Investigator i, TestCallBack callBack)
 {
     App.Model.testModel.StartTest(stat, testMod, testType, i, callBack);
     App.Controller.queueController.CreateCallBackQueue(FinishPreTestEvent); // Create Queue
     App.Model.eventModel.PreTestEvent();                                    // Populate Queue
     App.Controller.queueController.StartCallBackQueue();                    // Start Queue
 }
 public static string GenResultStr(Investigator inv, CheckResult result, bool showTypeString)
 {
     return
         ((inv.Is("HIDE_VALUE") ? "(???)" : $"({result.target}/{result.value})") +
          $" => {result.points}" +
          (showTypeString ? $",{result.ActualTypeString}" : ""));
 }
Beispiel #11
0
 public void RemoveInvestigator(Investigator inv)
 {
     if (!App.Model.setupModel.reDrafting)
     {
         App.Model.setupModel.RemoveInvestigator(inv);
     }
 }
        public static bool TwiceCheck(DMEnv env, Investigator inv, string valueName, bool isBonus, int hardness)
        {
            Value       value   = inv.Values[valueName];
            CheckResult bigger  = value.Check(hardness);
            CheckResult smaller = value.Check(hardness);

            if (bigger.points < smaller.points)
            {
                CheckResult tmp = bigger;
                bigger  = smaller;
                smaller = tmp;
            }
            if (isBonus)
            {
                env.AppendLine($"{inv.Name}的奖励{valueName}:")
                .Append(GenResultStr(inv, smaller, false) + $"({bigger.points})," + smaller.ActualTypeString);
                return(smaller.succeed);
            }
            else
            {
                env.AppendLine($"{inv.Name}的惩罚{valueName}:")
                .Append(GenResultStr(inv, bigger, false) + $"({smaller.points})," + bigger.ActualTypeString);
                return(bigger.succeed);
            }
        }
Beispiel #13
0
 public void InvestigatorDevoured(Investigator i, DevouredCallBack callback)
 {
     currentDeadInvestigator = i;
     App.View.deadInvestigatorMenuView.InvestigatorDevoured();
     devoured         = true;
     devouredCallBack = callback;
 }
Beispiel #14
0
 public void InvestigatorDied(Investigator i, bool relocated)
 {
     currentDeadInvestigator = i;
     investigatorRelocated   = relocated;
     devoured = false;
     App.View.deadInvestigatorMenuView.InvestigatorDied();
 }
Beispiel #15
0
        /*******************************************************************/
        public void Swap(int positionToSwap, string investigatorId)
        {
            Investigator investigatorToSwap     = investigatorRepository.Get(investigatorId);
            string       investigatorFromSwapId = UpdateModel(positionToSwap, investigatorToSwap);

            UpdateView(investigatorId, investigatorFromSwapId);
        }
 public void SelectPreviewedInvestigatorFromList(Investigator i)
 {
     if (i.investigatorName != App.Model.previewedInvestigatorModel.previewedInvestigator.investigatorName) // We are changing previewed Investigator
     {
         App.Model.previewedInvestigatorModel.SetPreviewedInvestigator(i);
         if (i.investigatorName != App.Model.investigatorModel.activeInvestigator.investigatorName) // The active Investigator is not being previewed anymore
         {
             if (App.Model.minimizeModel.currentCallBack == null)                                   // The current Menu was not minimized
             {
                 App.Controller.openMenuController.HideOpenMenu();
             }
             else
             {
                 App.Controller.minimizeController.HideMaximizeButton();
             }
         }
         else // The active Investigator is becoming previewed again
         {
             if (App.Model.minimizeModel.currentCallBack == null) // The current Menu was not minimized
             {
                 App.Controller.openMenuController.EnableOpenMenu();
             }
             else // The current Menu was minimized
             {
                 App.Controller.minimizeController.EnableMaximizeButton();
             }
         }
     }
 }
        public static string LuckyOneOfDay(DMEnv env, Scenario sce)
        {
            Investigator luckOne = null;
            int          luckMax = 0;

            long   seed = DateTime.Today.Ticks;
            int    p    = (int)seed;
            string tlsn = GetTodayLuckySkillName(seed);

            foreach (Investigator inv in sce.Investigators.Values)
            {
                if (inv.Is("HIDE_VALUE"))
                {
                    continue;
                }
                int luck = CalcLuck(inv, p, tlsn);
                if (luckOne == null || luck > luckMax)
                {
                    luckOne = inv;
                    luckMax = luck;
                }
            }
            if (luckOne == null)
            {
                env.Append("今天没有幸运儿");
                return(null);
            }
            else
            {
                env.Append(string.Format(Templete, luckMax, luckOne.Name, luckOne.Desc));
                return(luckOne.Name);
            }
        }
    public void InvestigatorSelected(int index)
    {
        List <Investigator> investigators = owner.currentLocation.investigatorsOnLocation;

        for (int i = 0; i < investigators.Count; i++)
        {
            if (i == index)
            {
                improvingInvestigator = investigators[i];
            }
        }
        if (improvingInvestigator == null)
        {
            Debug.LogError("Error selecting investigator");
        }
        else
        {
            List <MultipleOptionMenuObject> options = new List <MultipleOptionMenuObject>();
            foreach (TestStat stat in improvingInvestigator.ImprovableSkills())
            {
                options.Add(new MultipleOptionMenuObject(MultipleOptionType.Stat, stat));
            }
            GameManager.SingleInstance.App.Controller.multipleOptionController.StartMultipleOption(options, "Select a Skill to Improve", SkillSelected);
        }
    }
 public static void DisplayValue(DMEnv env, Investigator inv, string valueName)
 {
     if (!string.IsNullOrEmpty(valueName))
     {
         if (inv.Values.TryWidelyGet(valueName, out Value value))
         {
             StringBuilder b = new StringBuilder()
                               .Append($"{inv.Name}的{valueName}:")
                               .Append(value.Val).Append('/')
                               .Append(value.HardVal).Append('/')
                               .Append(value.ExtremeVal);
             if (value.Max > 0)
             {
                 b.Append('(').Append(value.Max).Append(')');
             }
         }
         else
         {
             env.Next = $"未找到{inv.Name}的{valueName}";
         }
         return;
     }
     else
     {
         env.AppendLine($"{inv.Name}的数值:");
         foreach (string name in inv.Values.Names)
         {
             env.Append(name).Append(':').Append(inv.Values[name]).Append(' ');
         }
     }
 }
        public CardSelectorView SetCardInSelector(CardInfo cardRow, Investigator investigator)
        {
            CardSelectorView selector = cardSelectorsManager.GetSelectorByCardIdOrEmpty(cardRow.Id);
            int quantity = investigator.GetAmountOfThisCardInDeck(cardRow);

            selector.SetQuantity(quantity);
            SetSelector();
            if (quantity <= 0)
            {
                DesactivateSelector(selector);
            }
            return(selector);

            void SetSelector()
            {
                if (!selector.IsEmpty)
                {
                    return;
                }
                selector.SetSelector(cardRow.Id, imageCards.GetSprite(cardRow.Id));
                selector.SetName(cardRow.Name);
                selector.SetTransform(placeHolderZone);
                LayoutRebuilder.ForceRebuildLayoutImmediate(placeHolderZone);
            }
        }
Beispiel #21
0
    public override void FinishEncounter(bool passed)
    {
        Investigator active = GameManager.SingleInstance.App.Model.encounterMenuModel.currentInvestigator;

        if (passed)
        {
            // Gain this Clue
            Location l = active.currentLocation;
            Clue     c = l.cluesOnLocation[0];

            GameManager.SingleInstance.App.Controller.locationController.MoveClueFromLocation(c, l);
            active.GainClue(c);
            GameManager.SingleInstance.App.Model.clueModel.ClueClaimed(c);

            GameManager.SingleInstance.App.Controller.queueController.CreateCallBackQueue(ResearchClueClaimed); // Create Queue
            GameManager.SingleInstance.App.Model.eventModel.ResearchClueClaimedEvent();                         // Populate Queue
            GameManager.SingleInstance.App.Controller.queueController.StartCallBackQueue();                     // Start Queue
        }
        else
        {
            // Gain a Detained Condition

            GameManager.SingleInstance.App.Controller.encounterMenuController.CompleteEncounter(); // End Encounter
        }
    }
Beispiel #22
0
    public override void FinishEncounter(bool passed)
    {
        Investigator active = GameManager.SingleInstance.App.Model.encounterMenuModel.currentInvestigator;
        Location     l      = active.currentLocation;
        Clue         c      = l.cluesOnLocation[0];

        if (passed)
        {
            // Gain this Clue
            GameManager.SingleInstance.App.Controller.locationController.MoveClueFromLocation(c, l);
            active.GainClue(c);
            GameManager.SingleInstance.App.Model.clueModel.ClueClaimed(c);

            GameManager.SingleInstance.App.Controller.queueController.CreateCallBackQueue(ResearchClueClaimed); // Create Queue
            GameManager.SingleInstance.App.Model.eventModel.ResearchClueClaimedEvent();                         // Populate Queue
            GameManager.SingleInstance.App.Controller.queueController.StartCallBackQueue();                     // Start Queue
        }
        else
        {
            // Move this Clue to the nearest sea space
            List <Location> nearestSeaSpaces = GameManager.SingleInstance.App.Controller.locationController.FindNearestSpaceOfType(l, LocationType.Sea);
            // Send this to menu to pick from closest locations
            GameManager.SingleInstance.App.Controller.locationController.MoveClueFromLocation(c, l);
            GameManager.SingleInstance.App.Controller.locationController.MoveClueToLocation(c, nearestSeaSpaces[0]);

            GameManager.SingleInstance.App.Controller.encounterMenuController.CompleteEncounter(); // End Encounter
        }
    }
Beispiel #23
0
 public static void DestroyAll(Investigator role)
 {
     while (role.AllPrints.Count != 0)
     {
         role.AllPrints[0].Destroy();
     }
 }
Beispiel #24
0
        public static bool ThrowItem(DMEnv env, string name, string newName)
        {
            if (newName == null)
            {
                newName = name;
            }
            Scenario     sce = env.Sce;
            Investigator inv = env.Inv;

            if (sce.Desk.ContainsKey(newName))
            {
                env.Append($"桌子上已有物品:{newName},请重命名");
                return(false);
            }
            if (!inv.Inventory.TryGetValue(name, out Item item))
            {
                env.Append($"{inv.Name}的物品栏中不存在{name}");
                return(false);
            }
            inv.Inventory.Remove(name);
            item.Name           = newName;
            sce.Desk[item.Name] = item;
            env.Save();
            env.Append($"{inv.Name}丢弃了{name}" + (name == newName ? "" : ",并重命名为:" + newName));
            return(true);
        }
        public static int CalcLuck(Investigator inv, int p, string tlsn)
        {
            int con = 0;

            foreach (string key in Params)
            {
                if (inv.Values.TryGet(key, out Value value))
                {
                    con += (int)(p * Math.Min(1.0f, value.Val / (value.Max > 0f ? value.Max : 100f)));
                    if (con % 2 == 1)
                    {
                        con ^= value.Val;
                    }
                    else
                    {
                        con = con * 3 + 1;
                    }
                }
            }
            if (!string.IsNullOrEmpty(tlsn) && inv.Values.TryGet(tlsn, out Value lv))
            {
                con ^= lv.Val;
            }
            return(Math.Abs((int)((con ^ p) / (float)p * 10)));
        }
Beispiel #26
0
        public static bool PickItem(DMEnv env, string name, string newName)
        {
            if (newName == null)
            {
                newName = name;
            }
            Scenario     sce = env.Sce;
            Investigator inv = env.Inv;

            if (!sce.Desk.TryGetValue(name, out Item item))
            {
                env.Append($"桌子上没有物品:{name}");
                return(false);
            }
            if (inv.Inventory.ContainsKey(newName))
            {
                env.Append($"{inv.Name}的物品栏中已经存在{newName},请重命名");
                return(false);
            }
            item.Name = newName;
            inv.Inventory[item.Name] = item;
            sce.Desk.Remove(name);
            env.Save();
            env.Append($"{inv.Name}拾取了:{name}");
            return(true);
        }
Beispiel #27
0
        public static bool EditItem(DMEnv env, string name, string newName, Args dict)
        {
            if (newName == null)
            {
                newName = name;
            }
            Investigator inv = env.Inv;

            if (!inv.Inventory.TryGetValue(name, out Item item))
            {
                env.Append($"{inv.Name}的物品栏中不存在{name}");
                return(false);
            }
            string wiChanges = FillWeaponInfo(item, dict);

            if (!string.Equals(name, newName))
            {
                inv.Inventory.Remove(name);
                item.Name = newName;
                inv.Inventory[item.Name] = (item);
                env.Save();
                env.Append($"{inv.Name}重命名了物品:{name} => {newName}");
                return(true);
            }
            else
            {
                env.Save();
                env.Append($"{inv.Name}编辑了物品:{name}" + wiChanges);
                return(true);
            }
        }
Beispiel #28
0
    private void SetRollButtonText()
    {
        Investigator active  = App.Model.testModel.testingInvestigator;
        int          val     = active.CheckStat(App.Model.testModel.activeTestStat) + active.CheckMod(App.Model.testModel.activeTestStat);
        int          charMod = App.Model.testModel.currentBonus + App.Model.testModel.currentAdditionalDie;
        int          testMod = App.Model.testModel.activeTestMod;
        int          total   = App.Model.testModel.currentNumRolls;

        string buttonText;

        if (charMod == 0 && testMod == 0)
        {
            buttonText = "Test " + App.Model.testModel.activeTestStat + ": " + total;
        }
        else if (charMod == 0)
        {
            buttonText = "Test " + App.Model.testModel.activeTestStat + ": " + total + " (" + val + " + " + testMod + ")";
        }
        else if (testMod == 0)
        {
            buttonText = "Test " + App.Model.testModel.activeTestStat + ": " + total + " (" + val + " + " + charMod + ")";
        }
        else
        {
            buttonText = "Test " + App.Model.testModel.activeTestStat + ": " + total + " (" + val + " + " + charMod + " + " + testMod + ")";
        }

        rollDiceButtonText.text = buttonText;
    }
Beispiel #29
0
        public static void St(DMEnv env, Investigator inv, string str)
        {
            ValueSet values = inv.Values;

            env.Append(inv.Name).Append("的数值:");
            Regex reg = new Regex(@"(\D+)(\d+)");
            Match m   = reg.Match(str);
            int   i   = 0;

            while (m.Success)
            {
                int    val  = int.TryParse(m.Groups[2].Value, out int v) ? v : 1;
                string name = m.Groups[1].Value;
                if (values.TryWidelyGet(name, out Value value))
                {
                    value.Set(val);
                }
                else
                {
                    value = new Value(val);
                    values.Put(name, value);
                }
                if (i++ % 3 == 0)
                {
                    env.Line();
                }
                env.Append(name).Append(':').Append(value).Append(' ');
                m = m.NextMatch();
            }
            env.Save();
        }
    public void InvestigatorDied()
    {
        deadInvestigatorMenu.SetActive(true);
        App.Controller.openMenuController.OpenMenu(deadInvestigatorMenu);

        Investigator i = App.Model.deadInvestigatorMenuModel.currentDeadInvestigator;

        deadInvestigatorPortrait.sprite = i.investigatorPortrait;

        if (i.currentHealth <= 0)
        {
            deathTypeImage.sprite = App.Model.gameSpritesModel.healthSprite;
            deathText.text        = i.investigatorName + " has lost all Health and died!";
        }
        else
        {
            deathTypeImage.sprite = App.Model.gameSpritesModel.sanitySprite;
            deathText.text        = i.investigatorName + " has lost all Sanity and died!";
        }

        if (App.Model.deadInvestigatorMenuModel.investigatorRelocated)
        {
            relocateText.text = i.investigatorName + "'s body has been relocated to " + i.currentLocation.locationName;
        }
        else
        {
            relocateText.text = "";
        }
    }
        public ActionResult Create(Guid id, Investigator investigator)
        {
            var proposal = _proposalRepository.Queryable.Where(a => a.Guid == id).SingleOrDefault();
            var investigatorToCreate = new Investigator();
            investigatorToCreate.Proposal = proposal;

            var redirectCheck = RedirectCheck(this, proposal, investigatorToCreate, id, "add", true, "to");
            if (redirectCheck != null)
            {
                return redirectCheck;
            }

            TransferValues(investigator, investigatorToCreate);

            investigatorToCreate.TransferValidationMessagesTo(ModelState);
            if (investigatorToCreate.IsPrimary && Repository.OfType<Investigator>().Queryable.Where(a => a.Proposal == proposal && a.IsPrimary).Any())
            {
                ModelState.AddModelError("Investigator.IsPrimary", StaticValues.ModelError_MultiplePrimary);
            }

            if (ModelState.IsValid)
            {
                _investigatorRepository.EnsurePersistent(investigatorToCreate);

                Message = string.Format(StaticValues.Message_CreatedSuccessfully, "Investigator");

                return this.RedirectToAction<ProposalController>(a => a.Edit(id));
            }
            else
            {
                var viewModel = InvestigatorViewModel.Create(Repository, proposal);
                viewModel.Investigator = investigatorToCreate;

                return View(viewModel);
            }
        }
 public InvestigationModule()
 {
     Investigator investigator = new Investigator();
     thread = new Thread(investigator.Investigate);
 }
        private ActionResult RedirectCheck(InvestigatorController investigatorController, Proposal proposal, Investigator investigator, Guid proposalId, string action, bool extraCheck = true, string discriptor = "for")
        {
            if (proposal == null)
            {
                investigatorController.Message = string.Format(StaticValues.Message_NotFound, "Your proposal was");
                return investigatorController.RedirectToAction<ErrorController>(a => a.Index());
            }
            if (proposal.Email != CurrentUser.Identity.Name)
            {
                investigatorController.Message = string.Format(StaticValues.Message_NoAccess, "that");
                return investigatorController.RedirectToAction<ErrorController>(a => a.Index());
            }
            if (proposal.IsSubmitted)
            {
                investigatorController.Message = string.Format(StaticValues.Message_ProposalSubmitted, string.Format("{0} investigator {1}", action, discriptor), "proposal");
                return investigatorController.RedirectToAction<ProposalController>(a => a.Details(proposalId));
            }
            if (!proposal.CallForProposal.IsActive || proposal.CallForProposal.EndDate.Date < DateTime.Now.Date)
            {
                investigatorController.Message = string.Format(StaticValues.Message_ProposalNotActive, string.Format("Cannot {0} investigator", action));
                return investigatorController.RedirectToAction<ProposalController>(a => a.Edit(proposalId));
            }

            if (extraCheck)
            {
                if (investigator == null)
                {
                    investigatorController.Message = string.Format(StaticValues.Message_NotFound, "Investigator");
                    return investigatorController.RedirectToAction<ProposalController>(a => a.Edit(proposalId));
                }
                if (investigator.Proposal.Guid != proposalId)
                {
                    investigatorController.Message = string.Format(StaticValues.Message_NoAccess, "that");
                    return investigatorController.RedirectToAction<ErrorController>(a => a.Index());
                }
            }

            return null;
        }
 /// <summary>
 /// Transfer editable values from source to destination
 /// </summary>
 private static void TransferValues(Investigator source, Investigator destination)
 {
     destination.Address1 =      source.Address1;
     destination.Address2 =      source.Address2;
     destination.Address3 =      source.Address3;
     destination.City =          source.City;
     destination.Email =         source.Email;
     destination.Institution =   source.Institution;
     destination.IsPrimary =     source.IsPrimary;
     destination.Name =          source.Name;
     destination.Phone =         source.Phone;
     if (source.State != null)
     {
         destination.State = source.State.ToUpper();
     }
     destination.Zip =           source.Zip;
     destination.Position =      source.Position;
 }