Ejemplo n.º 1
0
        public ActionResult RegisterParty()
        {
            PartyVM modelObj = new PartyVM();

            modelObj.Registered = GetOption();
            return(View(modelObj));
        }
Ejemplo n.º 2
0
 public override void OnFinalize()
 {
     base.OnFinalize();
     _partyVm       = null;
     _parent        = null;
     _mainPartyList = null;
 }
Ejemplo n.º 3
0
        static void Postfix(PartyVM __instance)
        {
            if (!PartyManagerSettings.Settings.DisableUpdatedTroopLabel)
            {
                try
                {
                    GenericHelpers.LogDebug("PartyVM RefreshPartyInformation Patch", "Post called");
                    var logic = __instance.GetPartyScreenLogic();

                    if (logic == null)
                    {
                        GenericHelpers.LogDebug("RefreshPartyInformation.Postfix", "Logic null, skipping party label update");
                        return;
                    }

                    if (__instance.MainPartyTroops != null && logic?.RightOwnerParty?.PartySizeLimit != null)
                    {
                        __instance.MainPartyTroopsLbl = GetPMPartyListLabel(__instance.MainPartyTroopsLbl, __instance.MainPartyTroops, logic.RightOwnerParty.PartySizeLimit);
                    }

                    if (__instance.OtherPartyTroops != null && logic?.LeftOwnerParty?.PartySizeLimit != null)
                    {
                        __instance.OtherPartyTroopsLbl = GetPMPartyListLabel(__instance.OtherPartyTroopsLbl, __instance.OtherPartyTroops, logic.LeftOwnerParty.PartySizeLimit);
                    }
                }
                catch (Exception e)
                {
                    GenericHelpers.LogException("updateTroopLabelsPatch", e);
                }
            }
        }
Ejemplo n.º 4
0
        public ActionResult RegisterParty(PartyVM vmObject)
        {
            BillingEntities entity   = new BillingEntities();
            Party           modelObj = new Party();

            modelObj.Name        = vmObject.Name;
            modelObj.Address     = vmObject.Address;
            modelObj.MobileNo    = vmObject.MobileNo;
            modelObj.CompanyName = vmObject.CompanyName;
            modelObj.GSTN_Number = vmObject.GSTN_Number;
            modelObj.PanNo       = vmObject.PanNo;
            //modelObj.Registered = vmObject.Registered.Sele ;
            modelObj.Registered = "Registered";
            var val = Request.Form["Registered"];

            //if(ModelState.IsValid)
            //{
            entity.RegisterParty(modelObj.Name, modelObj.CompanyName, modelObj.Address, modelObj.MobileNo, modelObj.GSTN_Number, modelObj.PanNo);
            //}
            //else
            //{
            //    return View("RegisterParty");
            //}
            return(View("Success"));
        }
Ejemplo n.º 5
0
        public async Task <Response> AddParty(PartyVM party)
        {
            var Dto = Mapper.Map <PartyVM, Party>(party);

            Party Exist = await _db.Parties.Where(x => x.Party1.Trim() == party.Party1.Trim()).FirstOrDefaultAsync();

            if (Exist != null)
            {
                return(GenericResponses <int> .ResponseStatus(true, Constant.MDGNoAlreadyExist, (int)Constant.httpStatus.NoContent, 0));
            }

            _db.Parties.Add(Dto);

            int result = await _db.SaveChangesAsync();

            if (result == 1)
            {
                // Mapper.Initialize(cfg => cfg.CreateMap<User, UserVM>());

                return(GenericResponses <int> .ResponseStatus(false, Constant.MSGRecordFound, (int)Constant.httpStatus.Ok, result));
            }
            else
            {
                return(GenericResponses <int> .ResponseStatus(true, Constant.MDGNoLoginFailed, (int)Constant.httpStatus.NoContent, result));
            }
        }
Ejemplo n.º 6
0
        public async Task <Response> RemoveParty(PartyVM party)
        {
            try
            {
                var DTO = await _db.Parties.Where(x => x.Id == party.Id).FirstOrDefaultAsync();

                _db.Parties.Remove(DTO);

                int result = await _db.SaveChangesAsync();

                if (result == 1)
                {
                    // Mapper.Initialize(cfg => cfg.CreateMap<User, UserVM>());

                    return(GenericResponses <int> .ResponseStatus(false, Constant.MSGRecordFound, (int)Constant.httpStatus.Ok, result));
                }
                else
                {
                    return(GenericResponses <int> .ResponseStatus(true, Constant.MSGFailed, (int)Constant.httpStatus.NoContent, result));
                }
            }
            catch (Exception e)
            {
                return(GenericResponses <int> .ResponseStatus(true, e.Message, (int)Constant.httpStatus.NoContent, 0));
            }
        }
Ejemplo n.º 7
0
            public static bool Prefix(ref PartyVM __instance)
            {
                Main.Log($"PartyVM_SetGroup_Patch");
                //for (int index = 6;index < SlotsInParty; ++index) {
                //    Main.Log($"PartyVM_SetGroup_Patch - adding slot: {index}");
                //    __instance.CharactersVM.Add(new PartyCharacterVM(new Action<bool>(__instance.NextPrev), index));
                //}

                __instance.m_ActualGroup = Game.Instance.SelectionCharacter.ActualGroup;
                __instance.StartIndex    = 0;
                for (int index = 0; index < __instance.m_ActualGroup.Count; ++index)
                {
                    if (__instance.FullCharactersVM.Count == index)
                    {
                        __instance.FullCharactersVM.Add(new PartyCharacterVM(new Action <bool>(__instance.NextPrev), index));
                        __instance.CharactersVM.Add(new PartyCharacterVM(new Action <bool>(__instance.NextPrev), index));
                        Main.Log($"PartyVM_SetGroup_Patch - adding slot: {index}");
                    }
                    __instance.FullCharactersVM[index].SetUnitData(__instance.m_ActualGroup[index]);
                }
                while (__instance.FullCharactersVM.Count > __instance.m_ActualGroup.Count)
                {
                    Main.Log($"PartyVM_SetGroup_Patch - removing slot: {__instance.FullCharactersVM.Count - 1}");

                    PartyCharacterVM partyCharacterVm = __instance.FullCharactersVM[__instance.FullCharactersVM.Count - 1];
                    partyCharacterVm.Dispose();
                    __instance.FullCharactersVM.Remove(partyCharacterVm);
                }
                return(false);
            }
Ejemplo n.º 8
0
        public bool IsPartySaved(PartyVM itemVm)
        {
            Party item = new Party()
            {
                Name       = itemVm.Name,
                PreCode    = itemVm.PreCode,
                Code       = itemVm.Code,
                Contact    = itemVm.Contact,
                Address    = itemVm.Address,
                Email      = itemVm.Email,
                Image      = itemVm.Image,
                Date       = itemVm.Date,
                IsCustomer = itemVm.IsCustomer,
                IsSupplier = itemVm.IsSupplier
            };

            dbContext.Parties.Add(item);
            var isAdded = dbContext.SaveChanges();

            if (isAdded > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }

            return(false);
        }
Ejemplo n.º 9
0
        internal PartyVM[] GetOneParty(string id)
        {
            List <PartyVM> listOfparty = new List <PartyVM>();

            try
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand();
                sqlCommand.CommandText = "GetDataParti";
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Connection  = sqlConnection;

                InParam(sqlCommand, "@parti", id, 5, SqlDbType.NVarChar);

                SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
                while (sqlDataReader.Read())
                {
                    PartyVM party = new PartyVM();
                    party.Party             = (string)sqlDataReader["parti"];
                    party.Vote              = (string)sqlDataReader["rost"];
                    party.Year              = (string)sqlDataReader["rm"];
                    party.PercentageAbsence = (decimal)sqlDataReader["Procent"];
                    listOfparty.Add(party);
                }
            }
            finally
            {
                sqlConnection.Close();
            }
            return(listOfparty.ToArray());
        }
        public static UpgradeResults UpgradeTroops(PartyVM partyVm, PartyScreenLogic partyScreenLogic)
        {
            UpgradeResults results = new UpgradeResults();

            List <PartyCharacterVM> upgradableTroops = GetUpgradeableTroops(partyVm);

            if (upgradableTroops.IsEmpty())
            {
                Global.Helpers.Message("No troops available to upgrade");
                return(results);
            }

            List <Tuple <PartyCharacterVM, PartyScreenLogic.PartyCommand> > commands = PrepareUpgradeCommands(upgradableTroops, partyScreenLogic, ref results);

            if (results.UpgradedTotal == 0)
            {
                Global.Helpers.Message(results.MultiPathSkipped > 0
                                           ? $"No troops upgraded. {results.MultiPathSkipped} troop types with multi-path upgrades were skipped. To prevent any skipping enable split upgrades and disable player decision in the settings"
                                           : "No troops upgraded");
            }
            else
            {
                ExecuteCommands(commands, partyVm, partyScreenLogic);
            }

            return(results);
        }
Ejemplo n.º 11
0
        public static void ExecuteRecruitAll(this PartyVM partyVM)
        {
            PartyScreenLogic partyScreenLogic = GetPartyScreenLogic(partyVM);
            int num  = partyScreenLogic.RightOwnerParty.PartySizeLimit - partyScreenLogic.MemberRosters[1].TotalManCount;
            int num2 = 0;
            int num3 = 0;

            foreach (PartyCharacterVM item in partyVM.MainPartyPrisoners.OrderByDescending((PartyCharacterVM o) => o.Character.Tier).ToList())
            {
                if (num <= 0)
                {
                    break;
                }
                if (!item.IsHero && item.NumOfRecruitablePrisoners > 0)
                {
                    int num4 = Math.Min(item.NumOfRecruitablePrisoners, num);
                    num2++;
                    num  -= num4;
                    num3 += num4;
                    PartyScreenLogic.PartyCommand partyCommand = new PartyScreenLogic.PartyCommand();
                    partyCommand.FillForRecruitTroop(item.Side, item.Type, item.Character, num4);
                    partyVM.CurrentCharacter = item;
                    ProcessCommand(partyScreenLogic, partyCommand);
                }
            }
            RefreshPartyScreen(partyVM);
            if (num2 > 0)
            {
                InformationManager.DisplayMessage(new InformationMessage($"招募 {num3} 兵 ({num2})"));
            }
            if (num <= 0)
            {
                InformationManager.DisplayMessage(new InformationMessage("队伍成员达到上限."));
            }
        }
Ejemplo n.º 12
0
        public async Task <JsonResult> RemoveExpense(PartyVM party)
        {
            Response r = await Repository.RemoveParty(party);

            //  List<UserVM> employees = ((IEnumerable)r.Value).Cast<UserVM>().ToList(); ;
            return(Json(r, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 13
0
 public TransferWoundedTroopsVM(PartyEnhancementsVM parent, PartyVM partyVm, bool shouldShow)
 {
     _parent                    = parent;
     _partyVm                   = partyVm;
     _mainPartyList             = partyVm?.MainPartyTroops;
     _shouldShowTransferWounded = shouldShow;
     _woundedHint               = new HintViewModel(new TextObject("Transfer All Wounded"));
 }
Ejemplo n.º 14
0
        public ActionResult Details(long id)
        {
            Party party = _partyBll.FindParty(id);

            PartyVM partyVm = Mapper.Map <PartyVM>(party);

            return(PartialView("_Details", partyVm));
        }
 public SortAllTroopsVM(PartyVM partyVm, PartyScreenLogic logic)
 {
     _partyVM            = partyVm;
     _partyLogic         = logic;
     _mainPartyList      = _partyVM.MainPartyTroops;
     _mainPartyPrisoners = _partyVM.MainPartyPrisoners;
     _sortHint           = new HintViewModel(new TextObject("Sort Troops\nCtrl Click to sort just main party"));
 }
 public override void OnFinalize()
 {
     base.OnFinalize();
     _mainPartyPrisoners = null;
     _mainPartyList      = null;
     _partyLogic         = null;
     _partyVM            = null;
 }
 public RecruitPrisonerVM(PartyEnhancementsVM parent, PartyVM partyVm, PartyScreenLogic logic)
 {
     _parent             = parent;
     _partyVM            = partyVm;
     _partyLogic         = logic;
     _mainPartyPrisoners = _partyVM.MainPartyPrisoners;
     _recruitHint        = new HintViewModel(new TextObject("Recruit All Prisoners.\nClick with CTRL pressed to ignore party size limits"));
 }
Ejemplo n.º 18
0
 public RecruitAllPrisonersWidget(UIContext context) : base(context)
 {
     if (ScreenManager.TopScreen is GauntletPartyScreen)
     {
         this._partyVM       = (PartyVM)((GauntletPartyScreen)ScreenManager.TopScreen).GetField("_dataSource");
         this._partyLogic    = (PartyScreenLogic)this._partyVM.GetField("_partyScreenLogic");
         this._mainPartyList = this._partyVM.MainPartyTroops;
     }
 }
Ejemplo n.º 19
0
        public async Task <JsonResult> AddParty(PartyVM party)
        {
            party.EcomID    = (int)Session["Comp"];
            party.CreatedOn = DateTime.Today;
            Response r = await Repository.AddParty(party);

            //  List<UserVM> employees = ((IEnumerable)r.Value).Cast<UserVM>().ToList(); ;
            return(Json(r, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 20
0
 public static void Postfix(PartyVM __instance)
 {
     Game.Instance.UI.PartyBarkManager = (Kingmaker.Assets.Code.UI.Overtip.IBarkPlayer)__instance;
     for (int index = 6; index < SlotsInParty; ++index)
     {
         __instance.CharactersVM.Add(new PartyCharacterVM(new Action <bool>(__instance.NextPrev), index));
     }
     __instance.SetGroup();
 }
        public UpgradeAllTroopsVM(PartyEnhancementsVM parent, PartyVM partyVm, PartyScreenLogic logic)
        {
            _parent        = parent;
            _partyVM       = partyVm;
            _partyLogic    = logic;
            _mainPartyList = _partyVM.MainPartyTroops;

            _upgradeHint =
                new HintViewModel(new TextObject("Upgrade All Troops\nRight click to upgrade only paths set by you"));
        }
Ejemplo n.º 22
0
        static bool Prefix(PartyVM __instance)
        {
            if (PartyManagerSettings.Settings.EnableAutoSort)
            {
                GenericHelpers.LogDebug("PartyVM RefreshValues Patch", "Pre Update called");
                PartyController.CurrentInstance.PartyVM = __instance;
                PartyController.CurrentInstance.SortPartyScreen(SortType.Default, true);
            }

            return(true);
        }
        public static bool PrefixOpenUpgrade(ref PartyVM __instance)
        {
            if (Utilities.IsControlDown())
            {
                // Upgrade all troops, don't just upgrade paths set by user.
                PartyEnhancementLayerPatch.enhancementVm.UpgradeAllTroops.UpgradeAllTroopsPath(0);
                return(false);
            }

            return(true);
        }
        public static bool PrefixOpenRecruit(ref PartyVM __instance)
        {
            if (Utilities.IsControlDown())
            {
                // Upgrade all troops, don't just upgrade paths set by user.
                PartyEnhancementLayerPatch.enhancementVm.RecruitAllPrisoners.RecruitAll();
                return(false);
            }

            return(true);
        }
 private static void PostfixActivate(ScreenBase __instance, ScreenLayer layer)
 {
     if (__instance is GauntletPartyScreen && screenLayer == null)
     {
         GauntletPartyScreen obj   = (GauntletPartyScreen)__instance;
         PartyVM             value = Traverse.Create(obj).Field <PartyVM>("_dataSource").Value;
         screenLayer = new GauntletLayer(99);
         screenLayer.LoadMovie("AutoPartyManager", new AutoPartyManagerVM(value));
         screenLayer.InputRestrictions.SetInputRestrictions();
         obj.AddLayer(screenLayer);
     }
 }
Ejemplo n.º 26
0
        public ActionResult Edit(PartyVM itemVm)
        {
            if (ModelState.IsValid)
            {
                if (partyDa.IsPartyUpdated(itemVm))
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View(itemVm));
        }
Ejemplo n.º 27
0
        public ActionResult Edit(PartyVM partyVm)
        {
            Party party = Mapper.Map <Party>(partyVm);

            if (ModelState.IsValid)
            {
                if (_partyBll.IsPartyUpdated(party))
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View(partyVm));
        }
Ejemplo n.º 28
0
        public static void Postfix(ref ScreenBase __instance)
        {
            if (__instance is GauntletPartyScreen partyScreen && screenLayer == null)
            {
                screenLayer = new GauntletLayer(10);

                var        traverser  = Traverse.Create(partyScreen);
                PartyVM    partyVM    = traverser.Field <PartyVM>("_dataSource").Value;
                PartyState partyState = traverser.Field <PartyState>("_partyState").Value;

                enhancementVm = new PartyEnhancementsVM(partyVM, partyState.PartyScreenLogic, partyScreen);
                screenLayer.LoadMovie("PartyScreenEnhancements", enhancementVm);
                screenLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
                partyScreen.AddLayer(screenLayer);
            }
        }
Ejemplo n.º 29
0
        public ActionResult Create(PartyVM itemVm, HttpPostedFileBase ItemCategoryFile)
        {
            itemVm.Date  = DateTime.Now;
            itemVm.Image = imageData.ImageConvertToByte(ItemCategoryFile);

            if (ModelState.IsValid)
            {
                if (partyDa.IsPartySaved(itemVm))
                {
                    return(RedirectToAction("Index"));
                }
            }

            ModelVm.Code = partyDa.GetPartyCode();
            return(View(ModelVm));
        }
Ejemplo n.º 30
0
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ModelVm = partyDa.FindParty(id);

            if (ModelVm == null)
            {
                return(HttpNotFound());
            }

            return(View(ModelVm));
        }