Пример #1
0
 /// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void onSaving(object sender, SavingEventArgs e)
 {
     if (!Game1.IsMultiplayer || Game1.IsMasterGame)
     {
         this.Helper.Data.WriteSaveData("building-exteriors", savedExteriors);
     }
 }
Пример #2
0
        /// <summary>
        /// Handles the Saving event of the parent ViewModel.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="SavingEventArgs"/> instance containing the event data.</param>
        private async Task OnParentViewModelSavingAsync(object sender, SavingEventArgs e)
        {
            // The parent view model is saved, save our view model as well
            if (ViewModel != null)
            {
                if (ReferenceEquals(sender, ViewModel))
                {
                    Log.Warning("Parent view model '{0}' is exactly the same instance as the current view model, ignore Saving event", sender.GetType().FullName);
                    return;
                }

                if (e.Cancel)
                {
                    Log.Info("Parent view model '{0}' is saving, but saving is canceled by another view model, saving of view model '{1}' will not continue", _parentViewModel.GetType(), ViewModel.GetType());
                    return;
                }

                Log.Info("Parent view model '{0}' is saving, saving view model '{1}' as well", _parentViewModel.GetType(), ViewModel.GetType());

                if (!ViewModel.IsClosed)
                {
                    e.Cancel = !await ViewModel.SaveViewModelAsync();
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 保存单据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void EditForm_Saving(object sender, SavingEventArgs e)
        {
            List<string> msgs = new List<string>();
            T_FB_SUMSETTINGSMASTER entCurr = this.OrderEntity.Entity as T_FB_SUMSETTINGSMASTER;
            entCurr.CHECKSTATES = 0;
            entCurr.EDITSTATES = 1;
            
            if (string.IsNullOrWhiteSpace(entCurr.OWNERID) || string.IsNullOrWhiteSpace(entCurr.OWNERNAME))
            {
                msgs.Add("汇总人不能为空");
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
                return;
            }

            ObservableCollection<FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_SUMSETTINGSDETAIL).Name);

            ObservableCollection<FBEntity> list0 = new ObservableCollection<FBEntity>();
          
            //明细为为0的不能提交
            if (details.ToList().Count <= 1)
            {
                msgs.Add("预算汇总设置中添加的公司至少超过一家");
            }
            if (msgs.Count > 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
            }
        }
Пример #4
0
        //private static bool savingInProgress = false;

        private void OnSave(object sender, SavingEventArgs e)
        {
            VoidshroomTree.RemovalAll();
            //CaveCarrot.RemoveAll();
            ModState.visitedMineshafts.Clear();
            ModState.SaveMod();
        }
Пример #5
0
 private void OnSaving(object sender, SavingEventArgs e)
 {
     if (Game1.IsMasterGame)
     {
         Helper.Data.WriteSaveData("Platonymous.ATM.BankAccount", bankAccount);
     }
 }
Пример #6
0
 private void OnSaving(object sender, SavingEventArgs e)
 {
     if (Config.IsEnableFavoriteItems)
     {
         ConvenientInventory.SaveFavoriteItemSlots();
     }
 }
Пример #7
0
        private void Save(object sender, SavingEventArgs e)
        {
            if (DeliveryEnabled() && Config.WaitForWizardShop)
            {
                Game1.addMailForTomorrow("DeliveryServiceWizardMail");
            }
            if (!Context.IsMainPlayer)
            {
                return;
            }
            List <SaveDataModel> save = new List <SaveDataModel>();

            foreach (DeliveryChest chest in this.DeliveryChests.Values)
            {
                if (chest == null || !chest.Exists())
                {
                    continue;
                }
                SaveDataModel data = new SaveDataModel(chest);
                if (data.Send.Count > 0 || data.Receive.Count > 0)
                {
                    save.Add(data);
                }
            }
            Helper.Data.WriteSaveData("delivery-service", save);
        }
Пример #8
0
        /// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnSaving(object sender, SavingEventArgs e)
        {
            if (!Context.IsMainPlayer)
            {
                return;
            }

            //cleanup any spawned monsters
            foreach (GameLocation l in Game1.locations)
            {
                for (int index = l.characters.Count - 1; index >= 0; --index)
                {
                    if (l.characters[index] is Monster && !(l.characters[index] is GreenSlime))
                    {
                        l.characters.RemoveAt(index);
                    }
                }
            }

            if (IsEclipse)
            {
                IsEclipse = false;
            }

            //moon works after frost does
            OurMoon.HandleMoonAtSleep(Game1.getFarm());
        }
Пример #9
0
        /// <summary>Raised before/after the game writes data to save file (except the initial save creation).
        /// This is also raised for farmhands in multiplayer.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void Saving(object sender, SavingEventArgs e)
        {
            string[] QuestsComplete = Game1.player.modData[$"{this.ModManifest.UniqueID}.QuestsCompleted"].Split('/');

            // Remove quests already in mod data so they aren't added again
            foreach (string questid in QuestsComplete)
            {
                if (questid != "")
                {
                    ModEntry.perScreen.Value.QuestsCompleted.Remove(int.Parse(questid));
                }
            }

            // Add any newly completed quests to mod data
            foreach (int questid in ModEntry.perScreen.Value.QuestsCompleted)
            {
                Game1.player.modData[$"{this.ModManifest.UniqueID}.QuestsCompleted"] = Game1.player.modData[$"{this.ModManifest.UniqueID}.QuestsCompleted"] + $"{questid}/";
            }

            // Clear quest data for new day
            ModEntry.perScreen.Value.QuestsCompleted.Clear();

            // Update old tracker
            Game1.player.modData[$"{this.ModManifest.UniqueID}.DeathCountMarried"] = ModEntry.perScreen.Value.DeathCountMarried.ToString();
            Game1.player.modData[$"{this.ModManifest.UniqueID}.PassOutCount"]      = ModEntry.perScreen.Value.PassOutCount.ToString();
            this.Monitor.Log("Trackers updated for new day");
        }
        /// <summary>Raised before the game begins writing data to the save file</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void Saving(object sender, SavingEventArgs e)
        {
            // Has player not passed out but DidPlayerPassOutYesterday property is true?
            if (Game1.player.modData[$"{this.ModManifest.UniqueID}.DidPlayerPassOutYesterday"] == "true" &&
                (Game1.player.isInBed.Value == true ||
                 Game1.player.modData[$"{this.ModManifest.UniqueID}.DidPlayerWakeupinClinic"] == "true") &&
                togglesperscreen.Value.shouldtogglepassoutdata == true)
            {
                // Yes, fix this so the new day will load correctly

                // Change DidPlayerPassOutYesterday field to false
                Game1.player.modData[$"{this.ModManifest.UniqueID}.DidPlayerPassOutYesterday"] = "false";
            }

            // Is DidPlayerWakeupinClinic true?
            if (Game1.player.modData[$"{this.ModManifest.UniqueID}.DidPlayerWakeupinClinic"] == "true")
            {
                //Is player in bed or has player passed out? (player has not died)
                if (Game1.player.isInBed.Value == true || Game1.player.modData[$"{this.ModManifest.UniqueID}.DidPlayerPassOutYesterday"] == "true")
                {
                    // Yes, fix this so the new day will load correctly

                    // Change field to false
                    Game1.player.modData[$"{this.ModManifest.UniqueID}.DidPlayerWakeupinClinic"] = "false";
                }
            }

            // Set shouldtogglepassoutdata if needed so DidPlayerPassOutYesterday will toggle normally again
            togglesperscreen.Value.shouldtogglepassoutdata = true;
        }
Пример #11
0
 private void OnSaving(object sender, SavingEventArgs e)
 {
     if (Game1.IsMasterGame)
     {
         saveRoomData();
     }
 }
Пример #12
0
        /// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnSaving(object sender, SavingEventArgs e)
        {
            if (Context.IsMainPlayer)
            {
                this.Monitor.Log("Packing custom objects...", LogLevel.Trace);
                ItemEvents.FireBeforeSerialize();
                Dictionary <string, InstanceState> data = new Dictionary <string, InstanceState>();
                foreach (GameLocation loc in Game1.locations)
                {
                    foreach (Chest chest in loc.Objects.Values.OfType <Chest>())
                    {
                        this.Serialize(data, chest.items);
                    }
                }

                this.Serialize(data, Game1.player.Items);
                FarmHouse house = Game1.getLocationFromName("FarmHouse") as FarmHouse;

                if (house.fridge.Value != null)
                {
                    this.Serialize(data, house.fridge.Value.items);
                }
                this.Helper.Data.WriteSaveData("custom-items", data);
                ItemEvents.FireAfterSerialize();
            }
        }
Пример #13
0
 private void Saving(object sender, SavingEventArgs e)
 {
     if (GameState.Current?.Activated != true)
     {
         return;
     }
 }
Пример #14
0
 private void BeforeSaving(object?sender, SavingEventArgs e)
 {
     if (Context.IsMainPlayer)
     {
         VolcanoChestAdjuster.SaveData(this.Helper.Data, this.Helper.Multiplayer);
     }
 }
Пример #15
0
        /// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnSaving(object sender, SavingEventArgs e)
        {
            if (!Context.IsMainPlayer)
            {
                return;
            }

            if (OurMoon.MoonTracker is null)
            {
                OurMoon.MoonTracker = new LunarInfo();
            }

            this.Helper.Data.WriteSaveData("moon-tracker", OurMoon.MoonTracker);

            //cleanup any spawned monsters
            foreach (GameLocation l in Game1.locations)
            {
                for (int index = l.characters.Count - 1; index >= 0; --index)
                {
                    if (l.characters[index] is Monster && !(l is SlimeHutch))
                    {
                        l.characters.RemoveAt(index);
                    }
                }
            }

            BloodMoonTracker.Clear();
        }
Пример #16
0
        /// <summary>
        /// 保存单据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void EditForm_Saving(object sender, SavingEventArgs e)
        {
            List <string>          msgs    = new List <string>();
            T_FB_SUMSETTINGSMASTER entCurr = this.OrderEntity.Entity as T_FB_SUMSETTINGSMASTER;

            entCurr.CHECKSTATES = 0;
            entCurr.EDITSTATES  = 1;

            if (string.IsNullOrWhiteSpace(entCurr.OWNERID) || string.IsNullOrWhiteSpace(entCurr.OWNERNAME))
            {
                msgs.Add("汇总人不能为空");
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
                return;
            }

            ObservableCollection <FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_SUMSETTINGSDETAIL).Name);

            ObservableCollection <FBEntity> list0 = new ObservableCollection <FBEntity>();

            //明细为为0的不能提交
            if (details.ToList().Count <= 1)
            {
                msgs.Add("预算汇总设置中添加的公司至少超过一家");
            }
            if (msgs.Count > 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
            }
        }
Пример #17
0
 private void Saving(object sender, SavingEventArgs e)
 {
     using (var file = File.Create(fileName))
     {
         Serializer.Serialize(file, db);
     }
 }
Пример #18
0
        /// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnSaving(object sender, SavingEventArgs e)
        {
            // reset data
            this.WasExhausted = false;
            this.WasCollapsed = false;

            // update player data
            this.PlayerData.CurrentExp += this.Config.ExpForSleeping;
            if (this.PlayerData.OriginalMaxStamina == 0)
            {
                this.PlayerData.OriginalMaxStamina = Game1.player.MaxStamina; //grab the initial stamina value
            }
            if (this.PlayerData.CurrentLevel < this.Config.MaxLevel)
            {
                while (this.PlayerData.CurrentExp >= this.PlayerData.ExpToNextLevel)
                {
                    this.PlayerData.CurrentLevel             += 1;
                    this.PlayerData.CurrentExp                = this.PlayerData.CurrentExp - this.PlayerData.ExpToNextLevel;
                    this.PlayerData.ExpToNextLevel            = (this.Config.ExpCurve * this.PlayerData.ExpToNextLevel);
                    Game1.player.MaxStamina                  += this.Config.StaminaIncreasePerLevel;
                    this.PlayerData.CurrentLevelStaminaBonus += this.Config.StaminaIncreasePerLevel;
                }
            }
            this.PlayerData.ClearModEffects = false;
            this.PlayerData.NightlyStamina  = Game1.player.MaxStamina;

            // save data
            this.Helper.Data.WriteJsonFile(this.RelativeDataPath, this.PlayerData);
        }
Пример #19
0
        /// <summary>Raised before the game begins writing data to the save file</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void Saving(object sender, SavingEventArgs e)
        {
            // Save data from data model to respective JSON file
            this.Helper.Data.WriteJsonFile <PlayerData>($"data\\{Constants.SaveFolderName}.json", ModEntry.PlayerData);

            // Has player not passed out but DidPlayerPassOutYesterday property is true?
            if (ModEntry.PlayerData.DidPlayerPassOutYesterday == true && (Game1.player.isInBed.Value == true || ModEntry.PlayerData.DidPlayerWakeupinClinic == true))
            {
                // Yes, fix this so the new day will load correctly

                // Change DidPlayerPassOutYesterday property to false
                ModEntry.PlayerData.DidPlayerPassOutYesterday = false;
            }

            // Is DidPlayerWakeupinClinic true?
            if (ModEntry.PlayerData.DidPlayerWakeupinClinic == true)
            {
                //Is player in bed or has player passed out? (player has not died)
                if (Game1.player.isInBed.Value == true || ModEntry.PlayerData.DidPlayerPassOutYesterday == true)
                {
                    // Yes, fix this so the new day will load correctly

                    // Change property to false
                    ModEntry.PlayerData.DidPlayerWakeupinClinic = false;
                }
            }

            // Save change to respective JSON file
            this.Helper.Data.WriteJsonFile <PlayerData>($"data\\{Constants.SaveFolderName}.json", ModEntry.PlayerData);
        }
Пример #20
0
 /*********
 ** Private methods
 *********/
 /// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 public void OnSaving(object sender, SavingEventArgs e)
 {
     if (Game1.IsFall && Game1.dayOfMonth == 27)
     {
         Game1.weatherForTomorrow = Game1.weather_snow;
     }
 }
Пример #21
0
        /// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnSaving(object sender, SavingEventArgs e)
        {
            if (!Context.IsMainPlayer)
            {
                return;
            }

            //cleanup any spawned monsters
            foreach (GameLocation l in Game1.locations)
            {
                for (int index = l.characters.Count - 1; index >= 0; --index)
                {
                    if (l.characters[index] is Monster && !(l.characters[index] is GreenSlime))
                    {
                        l.characters.RemoveAt(index);
                    }
                }
            }

            BloodMoonTracker.Clear();

            if (IsEclipse)
            {
                IsEclipse = false;
            }
        }
Пример #22
0
 private async Task ViewModelOnSavingAsync(object sender, SavingEventArgs e)
 {
     _closingViewModel       = new ProgressWindowViewModel();
     _closingViewModel.Title = "Saving...";
     _closingViewModel.SetOwnerWindow(this);
     _visualizerService.ShowDialogAsync(_closingViewModel);
 }
Пример #23
0
        private void OnSaving(object sender, SavingEventArgs e)
        {
            Monitor.Log("Reverting trees to vanilla before serialization:", LogLevel.Trace);
            var locations = GetLocations();

            CalmTrees(locations);
        }
Пример #24
0
        void EditForm_Saving(object sender, SavingEventArgs e)
        {
            ObservableCollection<FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_PERSONBUDGETADDDETAIL).Name);
            if (details.Count == 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(ErrorMessage.NoDetailInfo);
                return;
            }
            List<string> msgs = new List<string>();

            details.ToList().ForEach(item =>
            {
                T_FB_PERSONBUDGETADDDETAIL detail = item.Entity as T_FB_PERSONBUDGETADDDETAIL;
                if (detail.BUDGETMONEY < 0)
                {
                    string errorMessage = string.Format(ErrorMessage.BudgetMoneyZero, detail.T_FB_SUBJECT.SUBJECTNAME);
                    msgs.Add(errorMessage);

                }
                if (detail.USABLEMONEY.LessThan(detail.BUDGETMONEY))
                {
                    msgs.Add(string.Format(ErrorMessage.BudgetMoneyBigger, detail.T_FB_SUBJECT.SUBJECTNAME));
                }

            });
            if (msgs.Count > 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
            }

        }
Пример #25
0
 private void onSaving(object sender, SavingEventArgs e)
 {
     if (Game1.IsMasterGame)
     {
         Helper.Data.WriteSaveData("FrostDungeon.SaveData", saveData);
     }
 }
Пример #26
0
        void EditForm_Saving(object sender, SavingEventArgs e)
        {
            ObservableCollection <FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_COMPANYBUDGETAPPLYDETAIL).Name);

            if (details.Count == 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(ErrorMessage.NoDetailInfo);
                return;
            }

            List <string> msgs = new List <string>();

            details.ToList().ForEach(item =>
            {
                T_FB_COMPANYBUDGETAPPLYDETAIL detail = item.Entity as T_FB_COMPANYBUDGETAPPLYDETAIL;
                if (detail.BUDGETMONEY < 0)
                {
                    string errorMessage = string.Format(ErrorMessage.BudgetMoneyZero, detail.T_FB_SUBJECT.SUBJECTNAME);
                    msgs.Add(errorMessage);
                }
                //if (detail.USABLEMONEY.LessThan(detail.BUDGETMONEY))
                //{
                //    msgs.Add(string.Format(ErrorMessage.BudgetMoneyBigger, detail.T_FB_SUBJECT.SUBJECTNAME));
                //}
            });
            if (msgs.Count > 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
            }
        }
Пример #27
0
        public void OnSaving(object sender, SavingEventArgs e)
        {
            if (this.serverManager.IsActive && this.ActiveSaveData != null)
            {
                // Restore Data so when someone uses it with his normal character, it doesn't get saved
                // This could possible get the headless client suck at perk selection
                this.monitor.Log($"Restoring {nameof(HostPlayerData)}", LogLevel.Info);
                HostPlayerData.RestoreHostData(this.helper);
                this.monitor.Log($"Backuping {nameof(HostPlayerData)}", LogLevel.Info);
                HostPlayerData.BackupHostData(this.helper);

                if (Game1.activeClickableMenu is ShippingMenu menu)
                {
                    var totalString = "----";
                    var totals      = this.helper.Reflection.GetFieldValueEx <List <int> >(menu, "categoryTotals", null, this.monitor);
                    var totalIndex  = (int)ShippingMenuTotal.Total;
                    if (totals != null && totals.Count >= totalIndex)
                    {
                        totalString = totals[totalIndex].ToString();
                    }

                    this.monitor.Log($"Skipping {nameof(ShippingMenu)}. Total {totalString}G received for {Game1.dayOfMonth - 1} {Game1.CurrentSeasonDisplayName}", LogLevel.Info);

                    // okClicked is getting invoked by reflection since ShippingMenu checks for CanReceiveInput and so blocks leftClicks
                    this.helper.Reflection.GetMethod(menu, "okClicked").Invoke();
                }
            }
        }
Пример #28
0
        /// <summary>
        /// Saves the data.
        /// </summary>
        /// <returns>
        /// <c>true</c> if successful; otherwise <c>false</c>.
        /// </returns>
        bool MVVM.IViewModel.SaveViewModel()
        {
            if (IsClosed)
            {
                return(false);
            }

            if (!base.CanSave)
            {
                return(false);
            }

            var e = new SavingEventArgs();

            _catelSaving.SafeInvoke(this, e);
            if (e.Cancel)
            {
                return(false);
            }

            base.Save(this, new ExecuteEventArgs());

            _catelSaved.SafeInvoke(this);

            // Was original call, but not supported in SL
            //base.DoSave();
            return(true);
        }
Пример #29
0
 private void OnSaving(object sender, SavingEventArgs e)
 {
     if (Context.IsMainPlayer && this.PlayerData != null)
     {
         this.Helper.Data.WriteSaveData("data", this.PlayerData);
     }
 }
Пример #30
0
        /// <summary>
        /// Saves the data.
        /// </summary>
        /// <returns>
        /// <c>true</c> if successful; otherwise <c>false</c>.
        /// </returns>
        Task <bool> MVVM.IViewModel.SaveViewModel()
        {
            return(Task.Factory.StartNew(() =>
            {
                if (IsClosed)
                {
                    return false;
                }

                if (!base.CanSave)
                {
                    return false;
                }

                var e = new SavingEventArgs();
                _catelSaving.SafeInvoke(this, e);
                if (e.Cancel)
                {
                    return false;
                }

                base.Save(this, new ExecuteEventArgs());

                _catelSaved.SafeInvoke(this);

                // Was original call, but not supported in SL
                //base.DoSave();
                return true;
            }));
        }
Пример #31
0
 public void OnSaving(object sender, SavingEventArgs args)
 {
     if (Context.IsMainPlayer)
     {
         Bot.ConvertBotsToChests();
     }
 }
Пример #32
0
        /// <summary>
        /// Method that will be called before saving.
        /// Will load the data from <see cref="ChestController"/>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Saving(object sender, SavingEventArgs e)
        {
            var chests    = _chestController.GetChests();
            var chestData = ToChestData(chests);

            ModEntry.Instance.Helper.Data.WriteJsonFile($"save_data/{Constants.SaveFolderName}.json",
                                                        new SaveData(chestData));
        }
Пример #33
0
        /// <summary>
        /// 保存单据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void EditForm_Saving(object sender, SavingEventArgs e)
        {
            List<string> msgs = new List<string>();
            T_FB_PERSONMONEYASSIGNMASTER entCurr = this.OrderEntity.Entity as T_FB_PERSONMONEYASSIGNMASTER;
            if (string.IsNullOrWhiteSpace(entCurr.ASSIGNCOMPANYID) || string.IsNullOrWhiteSpace(entCurr.ASSIGNCOMPANYNAME))
            {
                msgs.Add("下拨公司不能为空");
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
                return;
            }

            ObservableCollection<FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_PERSONMONEYASSIGNDETAIL).Name);

            ObservableCollection<FBEntity> list0 = new ObservableCollection<FBEntity>();


            details.ToList().ForEach(item =>
            {
                T_FB_PERSONMONEYASSIGNDETAIL detail = item.Entity as T_FB_PERSONMONEYASSIGNDETAIL;

                if (detail.BUDGETMONEY <= 0 || detail.BUDGETMONEY == null)
                {
                    string errorMessage = detail.OWNERNAME + "的下拨金额为零请删除";
                    msgs.Add(errorMessage);
                }
            });

            //明细为为0的不能提交
            if (details.ToList().Count <= 0)
            {
                msgs.Add("下拨明细不能为空");
            }
            if (msgs.Count > 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
            }

            //删除多余的关联
            if (entCurr == null)
            {
                return;
            }

            if (entCurr.T_FB_PERSONMONEYASSIGNDETAIL == null)
            {
                return;
            }

            entCurr.T_FB_PERSONMONEYASSIGNDETAIL.Clear();
        }
Пример #34
0
        void EditForm_Saving(object sender, SavingEventArgs e)
        {
            List<string> msgs = null;
            if (DataCore.GetSetting("CanAddLessThanZero") == "1")
            {
                msgs = CheckSaveB();
            }
            else
            {
                msgs = CheckSaveA();
            }
            if (msgs.Count > 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
            }

        }
Пример #35
0
        void Core_SaveRequested(object sender, SavingEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("WARNING!!! Core_SaveRequested NOT IMPLEMENTED !!!!!");

            // Saves game.
            SaveGame(true);

            // If e.CloseAfterSave, close the game.
            if (e.CloseAfterSave)
            {
                NavigateToAppHome(true);
            }
        }
Пример #36
0
        void EditForm_Saving(object sender, SavingEventArgs e)
        {

            List<string> msgs = new List<string>();

            // 调入,调出单位是否相同
            string strFrom = this.OrderEntity.GetObjValue("Entity." + FIELDNAME_TRANSFERFROM).ToString();
            string strTo = this.OrderEntity.GetObjValue("Entity." + FIELDNAME_TRANSFERTO).ToString();
            if (strFrom == strTo)
            {                
                msgs.Add(Msg_SaveTransfer);
            }

            // 调出金额不可大于可用金额

            ObservableCollection<FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_COMPANYTRANSFERDETAIL).Name);

            if (details.Count == 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(ErrorMessage.NoDetailInfo);
                return;
            }

            details.ToList().ForEach(item =>
            {
                T_FB_COMPANYTRANSFERDETAIL detail = item.Entity as T_FB_COMPANYTRANSFERDETAIL;

                if (detail.TRANSFERMONEY < 0)
                {
                    string errorMessage = string.Format(ErrorMessage.BudgetMoneyZero, detail.T_FB_SUBJECT.SUBJECTNAME);
                    msgs.Add(errorMessage);
                }

                if (detail.USABLEMONEY.LessThan(detail.TRANSFERMONEY))
                {
                    if (detail.TRANSFERMONEY > 0)
                    {
                        msgs.Add(string.Format(ErrorMessage.TransMoneyBigger, detail.T_FB_SUBJECT.SUBJECTNAME));
                    }
                }

            });
            if (msgs.Count > 0)
            {
                CommonFunction.ShowErrorMessage(msgs);
                e.Action = Actions.Cancel;
            }
        }
Пример #37
0
        private static Task OnViewModelSavingAsync(object sender, SavingEventArgs e)
        {
            if (!AuditingManager.IsAuditingEnabled)
            {
                return TaskHelper.Completed;
            }

            AuditingManager.OnViewModelSaving((IViewModel)sender);

            return TaskHelper.Completed;
        }
Пример #38
0
        //void EditForm_SaveCompleted(object sender, SavingEventArgs e)
        //{
        //    if (e.Action != Actions.Cancel && e.Action != Actions.NoAction)
        //    {
        //        InitData();
        //    }
            
        //}

        void EditForm_Saving(object sender, SavingEventArgs e)
        {
            FBEntity modifiedEntity = e.SaveFBEntity;

            ObservableCollection<FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_COMPANYBUDGETMODDETAIL).Name);
            if (details.Count == 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(ErrorMessage.NoDetailInfo);
                return;
            }

            List<string> msgs = new List<string>();
            decimal dTotalMoney = 0;
            if (((T_FB_COMPANYBUDGETMODMASTER)modifiedEntity.Entity).BUDGETMONEY != null)
            {
                dTotalMoney = ((T_FB_COMPANYBUDGETMODMASTER)modifiedEntity.Entity).BUDGETMONEY.Value;
            }

            var resultCheck = details.Where(item =>
                {
                    T_FB_COMPANYBUDGETMODDETAIL detail = item.Entity as T_FB_COMPANYBUDGETMODDETAIL;
                    if (detail.BUDGETMONEY < 0)
                    {
                        string errorMessage = string.Format(ErrorMessage.BudgetMoneyZero, detail.T_FB_SUBJECT.SUBJECTNAME);
                        msgs.Add(errorMessage);
                    }

                    return (item.Entity as T_FB_COMPANYBUDGETMODDETAIL).BUDGETMONEY == 0;
                });

            //if (dTotalMoney <= 0)
            //{
            //    string errorMessage = "申请的预算总额必须大于零!";
            //    msgs.Add(errorMessage);
            //}

            if (msgs.Count > 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
            }

            details.ToList().ForEach(item =>
                {
                    if (item.IsNewEntity())
                    {
                        item.FBEntityState = FBEntityState.Added;
                        item.SetObjValue("Entity.CREATEUSERID", this.OrderEntity.GetObjValue("Entity.CREATEUSERID"));

                        var q = (T_FB_COMPANYBUDGETMODDETAIL)item.Entity;
                        if (string.IsNullOrEmpty(q.CREATEUSERID))
                        {
                            MessageBox.Show("T_FB_COMPANYBUDGETAPPLYDETAIL CREATEUSERID == null");
                        }

                        item.SetObjValue("Entity.CREATEDATE", this.OrderEntity.GetObjValue("Entity.CREATEDATE"));
                    }
                });

            
        }
Пример #39
0
 private static void OnViewModelSaving(object sender, SavingEventArgs e)
 {
     AuditingManager.OnViewModelSaving((IViewModel)sender);
 }
Пример #40
0
 void EditForm_Saving(object sender, SavingEventArgs e)
 {
    
     e.SaveFBEntity.CollectionEntity.Clear();
 }
Пример #41
0
		/// <summary>
		/// Raises the save cartridge event.
		/// </summary>
		/// <param name="sender">Sender of event.</param>
		/// <param name="args">Saving event arguments.</param>
		public void OnSaveCartridge(object sender, SavingEventArgs args)
		{
			this.Save();

			if (args.CloseAfterSave)
			{
				// Close log file
				this.DestroyEngine();

				// Leave game
				App.GameNavigation.CurrentPage.Navigation.PopModalAsync();
			}
		}
Пример #42
0
        private void Core_SaveRequested(object sender, SavingEventArgs e)
        {
            // Saves game.
            SaveGame(true);

            // If e.CloseAfterSave, close the game.
            if (e.CloseAfterSave)
            {
                // Wait for the engine to be done doing what it's doing.
                BeginRunOnIdle(() =>
                {
                    // Shows a message box for that.
                    System.Windows.MessageBox.Show("The cartridge has requested to be terminated. The game has been automatically saved, and you will now be taken back to the main menu of the app.", "The game is ending.", MessageBoxButton.OK);

                    // Back to app home.
					NavigationManager.NavigateToAppHome(true);
                });
            }
        }
Пример #43
0
        /// <summary>
        /// Handles the Saving event of the parent ViewModel.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="SavingEventArgs"/> instance containing the event data.</param>
        private async Task OnParentViewModelSavingAsync(object sender, SavingEventArgs e)
        {
            // The parent view model is saved, save our view model as well
            if (ViewModel != null)
            {
                if (ReferenceEquals(sender, ViewModel))
                {
                    Log.Warning("Parent view model '{0}' is exactly the same instance as the current view model, ignore Saving event", sender.GetType().FullName);
                    return;
                }

                if (e.Cancel)
                {
                    Log.Info("Parent view model '{0}' is saving, but saving is canceled by another view model, saving of view model '{1}' will not continue", _parentViewModel.GetType(), ViewModel.GetType());
                    return;
                }

                Log.Info("Parent view model '{0}' is saving, saving view model '{1}' as well", _parentViewModel.GetType(), ViewModel.GetType());

                if (!ViewModel.IsClosed)
                {
                    e.Cancel = !await ViewModel.SaveViewModelAsync();
                }
            }
        }
Пример #44
0
        private void EditForm_SaveCompleted(object sender, SavingEventArgs e)
        {
            CloseProcess();

            if (e.Action == Actions.Save)
            {
                CommonFunction.ShowMessage("保存成功!");
                OnRefreshData();
                
            }

            if (e.Action != Actions.Cancel)
            {
                CommonFunction.ShowMessage("保存成功!");
                OnClose();
            }
            
        }
Пример #45
0
		public void OnSaveCartridge (object sender, SavingEventArgs args)
		{
			Save ();

			if (args.CloseAfterSave) {
				// Close log file
				locationManager.StopUpdatingLocation ();
				DestroyEngine ();
				appDelegate.CartStop ();
			}
		}