Exemple #1
0
        private bool TryGetAwardType(out AwardType awardType)
        {
            var awardCategory = Context.NominationListContext.NominationList.AwardCategory;
            var parameter     = new AwardTypeParameter(awardCategory);

            return(TryGetArgumentValue(parameter, out awardType));
        }
Exemple #2
0
	public void GetAward(AwardType type){
		if (type == AwardType.DualSword) {
			TurnToDualSword();
		} else if(type == AwardType.Gun){
			TurnToGun();
		}
	}
Exemple #3
0
        private IEnumerable <AwardWinner> GetCertificateRecipientsForAwardType(AwardType awardType)
        {
            var awardWinners = GetWinnersForAwardType(awardType);

            return(awardWinners
                   .Where(w => OfficeLocation.OfficeLocationsForCertificatePrinting.Any(ol => ol == w.OfficeLocation)));
        }
Exemple #4
0
        private static Nomination LoadQuarterlyAwardsNominationFromSurveyExport(Row row, int rowNumber)
        {
            var isAnonymousNominator            = row[10] != @"Display My Name (Recommended)";
            var nominatorName                   = PersonName.CreateForNominator(row[9], isAnonymousNominator);
            var nomineeName                     = PersonName.Create(row[12]);
            var awardType                       = AwardType.FindByAwardName(row[13]);
            var nomineeOfficeLocation           = OfficeLocation.FindByName(row[15]);
            var hasContinuouslyImproving        = !string.IsNullOrWhiteSpace(row[16]);
            var hasDrivingInnovation            = !string.IsNullOrWhiteSpace(row[17]);
            var hasDelightingCustomers          = !string.IsNullOrWhiteSpace(row[18]);
            var hasBehavingWithIntegrity        = !string.IsNullOrWhiteSpace(row[19]);
            var hasDeliveringMeaningfulOutcomes = !string.IsNullOrWhiteSpace(row[20]);
            var hasStreamingGood                = !string.IsNullOrWhiteSpace(row[21]);
            var writeUp        = NominationWriteUp.Create(nomineeName, row[22]);
            var writeUpSummary = NominationWriteUpSummary.Create(row[24]);

            var companyValues = GetCompanyValues(hasContinuouslyImproving, hasDrivingInnovation, hasDelightingCustomers,
                                                 hasBehavingWithIntegrity, hasDeliveringMeaningfulOutcomes, hasStreamingGood);

            var nominee = Person.Create(nomineeName, nomineeOfficeLocation, nomineeName.DerivedEmailAddress);

            var nomination = new Nomination(rowNumber, NomineeVotingIdentifier.Unknown, nominee, awardType,
                                            nominatorName, companyValues, writeUp, writeUpSummary);

            return(nomination);
        }
Exemple #5
0
        protected string pageName    = string.Empty;        //页名称

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IntParam == 0)
            {
                return;
            }

            AwardInfo awardInfo = FacadeManage.aideNativeWebFacade.GetAwardInfo(IntParam);

            if (awardInfo != null)
            {
                awardName   = awardInfo.AwardName;
                bigImage    = Fetch.GetUploadFileUrl(awardInfo.BigImage);
                description = Utility.HtmlDecode(awardInfo.Description);
                inventory   = awardInfo.Inventory;
                price       = awardInfo.Price;
                status      = awardInfo.Nullity;

                //面包屑
                AwardType awardType = FacadeManage.aideNativeWebFacade.GetAwardType(awardInfo.TypeID);
                if (awardType != null)
                {
                    pageName = awardType.TypeName;
                    if (awardType.ParentID != 0)
                    {
                        awardType = FacadeManage.aideNativeWebFacade.GetAwardType(awardType.ParentID);
                        pageName  = awardType.TypeName + " -> " + pageName;
                    }
                }
                pageName += " -> " + awardInfo.AwardName;
            }
        }
Exemple #6
0
        private void SetNomineeIdentifiers(AwardType awardType)
        {
            var nominationsByNominee = Nominations
                                       .Where(n => n.AwardType == awardType)
                                       .Select((n, i) => new { Index = i, Nomination = n })
                                       .GroupBy(x => x.Nomination.Nominee);

            foreach (var group in nominationsByNominee)
            {
                var nomineeIndexes   = group.Select(x => x.Index).ToList();
                var votingIdentifier = NomineeVotingIdentifier.Create(nomineeIndexes);

                foreach (var item in group)
                {
                    var nomination = item.Nomination;

                    if (nomination.VotingIdentifier == votingIdentifier)
                    {
                        continue;
                    }

                    nomination.SetVotingIdentifier(votingIdentifier);
                }
            }
        }
        private static void ImportAwardsList()
        {
            var awards = oldDatabaseConnection.Query("SELECT * FROM awards_list").ToList();

            Log("Importing " + awards.Count + " awards");

            using (var session = sessionFactory.OpenSession())
            {
                session.Transaction.Begin();
                session.CreateSQLQuery("SET IDENTITY_INSERT [dbo].AwardType ON").ExecuteUpdate();
                var maxId = 0;
                foreach (var _row in awards)
                {
                    var entity = new AwardType();
                    entity.AwardTypeId = (int)_row.ID;
                    entity.Name        = ((string)_row.name ?? "").Trim();
                    if (string.IsNullOrWhiteSpace(entity.Name))
                    {
                        continue; // skip blank names
                    }
                    session.Save(entity, entity.AwardTypeId);
                    if (entity.AwardTypeId > maxId)
                    {
                        maxId = entity.AwardTypeId;
                    }
                }
                session.Flush();
                session.CreateSQLQuery("SET IDENTITY_INSERT [dbo].AwardType OFF").ExecuteUpdate();
                session.CreateSQLQuery("DBCC CHECKIDENT ('dbo.AwardType', RESEED, " + (maxId + 1) + ")").ExecuteUpdate();
                session.Transaction.Commit();
                session.Close();
            }
        }
Exemple #8
0
        public void SelectNomineeAsAwardWinner(AwardType awardType, Person nominee)
        {
            if (awardType == null)
            {
                throw new ArgumentNullException(nameof(awardType));
            }
            if (nominee == null)
            {
                throw new ArgumentNullException(nameof(nominee));
            }

            if (GetIsAwardWinner(awardType, nominee))
            {
                return;
            }

            var nominations = GetNominationsForNominee(awardType, nominee);

            if (nominations.Count == 0)
            {
                throw new ArgumentException(@"There is no such nominee for that award type.", nameof(awardType));
            }

            var awardWinner = new AwardWinner(awardType, nominee);

            _awardWinners.Add(awardWinner);
            MarkAsDirty($@"Upserted winner {nominee.Name.FullName}");
        }
Exemple #9
0
        public ActionResult DeleteConfirmed(int id)
        {
            AwardType awardtype = db.AwardTypes.Single(a => a.AwardTypeId == id);

            db.AwardTypes.DeleteObject(awardtype);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 /// <summary>
 /// Содержит приз и его компоненты
 /// </summary>
 public Award(AwardType currentPrize, string message = "", int money = 0, int reputation = 0, string seedName = "")
 {
     CurrentPrize = currentPrize;
     Message      = message;
     Money        = money;
     Reputation   = reputation;
     SeedName     = seedName;
 }
Exemple #11
0
        public bool HasWinnersForAward(AwardType awardType)
        {
            if (awardType == null)
            {
                throw new ArgumentNullException(nameof(awardType));
            }

            return(GetWinnersForAwardType(awardType).Any());
        }
Exemple #12
0
        public bool HasNominationsForAward(AwardType awardType)
        {
            if (awardType == null)
            {
                throw new ArgumentNullException(nameof(awardType));
            }

            return(Nominations.Any(n => n.AwardType == awardType));
        }
Exemple #13
0
 public LocalTaskData(int id, string des, AwardType awardType, TaskType taskType, int expValue, int awardValue)
 {
     this.id         = id;
     this.des        = des;
     this.awardType  = awardType;
     this.taskType   = taskType;
     this.expValue   = expValue;
     this.awardValue = awardValue;
 }
Exemple #14
0
 /// <summary>
 /// 数据初始化
 /// </summary>
 private void Inition()
 {
     if (IntParam > 0)
     {
         AwardType type = FacadeManage.aideNativeWebFacade.GetAwardTypeByID(IntParam);
         CtrlHelper.SetText(txtSortID, type.SortID.ToString());
         CtrlHelper.SetText(txtTypeName, type.TypeName);
         rbNullity.SelectedValue = type.Nullity.ToString();
     }
 }
Exemple #15
0
        //
        // GET: /AwardType/Delete/5

        public ActionResult Delete(int id = 0)
        {
            AwardType awardtype = db.AwardTypes.Single(a => a.AwardTypeId == id);

            if (awardtype == null)
            {
                return(HttpNotFound());
            }
            return(View(awardtype));
        }
 public void InsertAwardTypeInfo(AwardType awardType)
 {
     System.Data.DataRow dataRow = this.aideAwardTypeProvider.NewRow();
     dataRow["TypeName"]    = awardType.TypeName;
     dataRow["ParentID"]    = awardType.ParentID;
     dataRow["SortID"]      = awardType.SortID;
     dataRow["Nullity"]     = awardType.Nullity;
     dataRow["CollectDate"] = awardType.CollectDate;
     this.aideAwardTypeProvider.Insert(dataRow);
 }
        public bool UpdateAwardTypeInfo(AwardType awardType)
        {
            int num = aideNativeWebData.UpdateAwardTypeInfo(awardType);

            if (num <= 0)
            {
                return(false);
            }
            return(true);
        }
Exemple #18
0
 public ActionResult Edit(AwardType awardtype)
 {
     if (ModelState.IsValid)
     {
         db.AwardTypes.Attach(awardtype);
         db.ObjectStateManager.ChangeObjectState(awardtype, EntityState.Modified);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(awardtype));
 }
Exemple #19
0
        public ActionResult Create(AwardType awardtype)
        {
            if (ModelState.IsValid)
            {
                db.AwardTypes.AddObject(awardtype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(awardtype));
        }
Exemple #20
0
 public void GetAward(AwardType type)
 {
     if (type == AwardType.DualSword)
     {
         TurnToDualSword();
     }
     else if (type == AwardType.Gun)
     {
         TurnToGun();
     }
 }
Exemple #21
0
 public void GetAward(AwardType type)
 {
     if (type == AwardType.DualSword)
     {
         WeaponTime.instance.dualSwordTime += 10.0f;
     }
     else if (type == AwardType.Gun)
     {
         WeaponTime.instance.gunTime += 10.0f;
     }
 }
Exemple #22
0
        /// <summary>
        /// 绑定商品
        /// </summary>
        protected void BindShop()
        {
            //查询条件
            string where = " WHERE Nullity=0";
            if (IntParam != 0)
            {
                where += string.Format(" AND ( TypeID IN (SELECT TypeID FROM AwardType WHERE ParentID={0}) OR TypeID={0} ) ", IntParam);
                AwardType awardType = FacadeManage.aideNativeWebFacade.GetAwardType(IntParam);
                if (awardType != null)
                {
                    pageName = awardType.TypeName;
                    if (awardType.ParentID != 0)
                    {
                        awardType = FacadeManage.aideNativeWebFacade.GetAwardType(awardType.ParentID);
                        pageName  = awardType.TypeName + " -> " + pageName;
                    }
                }
            }

            //登录用户查能兑换商品
            int range = GameRequest.GetQueryInt("range", 0);

            if (range == 1)
            {
                if (!Fetch.IsUserOnline())
                {
                    string url = string.Format("/login.aspx?url={0}", Utility.UrlEncode(Utils.GameRequest.GetUrl()));
                    Response.Redirect(url);
                    Response.End();
                }
                else
                {
                    Message  msg  = FacadeManage.aideAccountsFacade.GetUserGlobalInfo(Fetch.GetUserCookie().UserID, 0, "");
                    UserInfo user = msg.EntityList[0] as UserInfo;
                    where    = string.Format(" WHERE Price<={1} AND Nullity=0", IntParam, user.UserMedal);
                    pageName = "我能兑换的商品";
                }
            }

            //排序方法
            string orderBy = GetOrderBy();

            //绑定数据

            PagerSet pagerSet = FacadeManage.aideNativeWebFacade.GetList(AwardInfo.Tablename, PageIndex, anpPage.PageSize, orderBy, where);

            anpPage.RecordCount = pagerSet.RecordCount;
            if (pagerSet.PageSet.Tables[0].Rows.Count > 0)
            {
                rptShop.DataSource = pagerSet.PageSet;
                rptShop.DataBind();
            }
        }
Exemple #23
0
 public void GetAward(AwardType type)
 {
     if (type == AwardType.Gun)
     {
         TurnGun();
     }
     if (type == AwardType.DualSword)
     {
         TurnDualSword();
     }
     //TurnWeapon(type);
 }
        private AwardType GetAwardTypeByMargin(int margin)
        {
            AwardType result = AwardType.Medal;;

            switch (margin)
            {
            case 0:
                result = AwardType.Medal;
                break;

            case -10:
                result = AwardType.Star;
                break;

            case -20:
                result = AwardType.Cup;
                break;

            case -30:
                result = AwardType.Crown;
                break;

            case -40:
                result = AwardType.GoldenHelmet;
                break;

            case -50:
                result = AwardType.DiamondHelmet;
                break;

            case -60:
                result = AwardType.GrapheneHelmet;
                break;

            case -70:
                result = AwardType.Wheel;
                break;

            case -80:
                result = AwardType.BronzeBook;
                break;

            case -90:
                result = AwardType.SilverBook;
                break;

            case -100:
                result = AwardType.GoldenBook;
                break;
            }
            return(result);
        }
Exemple #25
0
 public AwardData(AwardType type, int id, int num)
 {
     this.awardType = type;
     this.id        = id;
     this.num       = num;
     switch (type)
     {
     case AwardType.Property:
         PropertySetting setting = DataTable.FindPropertySetting(id);
         sprt = ResourceManager.Instance.GetObj <Sprite>(ConstantVal.propertyIconFolderPath + setting.iconName);
         break;
     }
 }
Exemple #26
0
        private void SelectAwardWinner(AwardType awardType)
        {
            var nominationList = Context.NominationListContext.NominationList;
            var nominees       = nominationList.GetNomineesForAward(awardType, true);
            var parameter      = new NomineeToSelectAsAwardWinnerParameter(awardType, nominees);

            if (!TryGetArgumentValue(parameter, out Person nominee))
            {
                return;
            }

            nominationList.SelectNomineeAsAwardWinner(awardType, nominee);
        }
 public int UpdateAwardTypeInfo(AwardType awardType)
 {
     System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
     stringBuilder.Append("UPDATE AwardType SET ").Append("TypeName=@TypeName,").Append("ParentID=@ParentID,").Append("SortID=@SortID,").Append("Nullity=@Nullity,").Append("CollectDate=@CollectDate").Append(" WHERE TypeID= @TypeID");
     System.Collections.Generic.List <System.Data.Common.DbParameter> list = new System.Collections.Generic.List <System.Data.Common.DbParameter>();
     list.Add(base.Database.MakeInParam("TypeName", awardType.TypeName));
     list.Add(base.Database.MakeInParam("ParentID", awardType.ParentID));
     list.Add(base.Database.MakeInParam("SortID", awardType.SortID));
     list.Add(base.Database.MakeInParam("Nullity", awardType.Nullity));
     list.Add(base.Database.MakeInParam("CollectDate", awardType.CollectDate));
     list.Add(base.Database.MakeInParam("TypeID", awardType.TypeID));
     return(base.Database.ExecuteNonQuery(System.Data.CommandType.Text, stringBuilder.ToString(), list.ToArray()));
 }
Exemple #28
0
 internal Nomination(int id, NomineeVotingIdentifier votingIdentifier, Person nominee,
                     AwardType nomineeAwardType, PersonName nominatorName, IEnumerable <CompanyValue> companyValues,
                     NominationWriteUp writeUp, NominationWriteUpSummary writeUpSummary)
     : base(id)
 {
     VotingIdentifier = votingIdentifier;
     Nominee          = nominee ?? throw new ArgumentNullException(nameof(nominee));
     AwardType        = nomineeAwardType ?? throw new ArgumentNullException(nameof(nomineeAwardType));
     NominatorName    = nominatorName ?? throw new ArgumentNullException(nameof(nominatorName));
     CompanyValues    = companyValues?.ToList() ?? new List <CompanyValue>();
     WriteUp          = writeUp;
     WriteUpSummary   = writeUpSummary;
 }
Exemple #29
0
 public void GetAward(AwardType type)
 {
     if (type == AwardType.SWORD)
     {
         SwitchToDualSword();
         UIAttack._instance.SwitchToDoubleAttack();
     }
     else if (type == AwardType.GUN)
     {
         SwitchToGun();
         UIAttack._instance.SwitchToSingleAttack();
     }
 }
Exemple #30
0
        public IReadOnlyList <Nomination> GetNominationsForNominee(AwardType awardType, Person nominee)
        {
            if (awardType == null)
            {
                throw new ArgumentNullException(nameof(awardType));
            }
            if (nominee == null)
            {
                throw new ArgumentNullException(nameof(nominee));
            }

            return(Nominations.Where(n => n.Nominee == nominee && n.AwardType == awardType).ToList());
        }
Exemple #31
0
        public void AwardModelValidationTest(string description, int position, AwardType type, bool expectedResult)
        {
            var awardModel = new AwardModel
            {
                Description = description,
                Position    = position,
                Type        = type
            };

            var validation = new AwardModelValidation();
            var result     = validation.Validate(awardModel);

            Assert.IsTrue(result.IsValid == expectedResult);
        }
 public AwardTypeViewModel(AwardType awardType, UrlHelper url)
 {
     Name = awardType.Name;
     EditURL = url.GetURL<AwardsAdminController>(c => c.EditAwardType(awardType.AwardTypeId));
 }
Exemple #33
0
 public bool IsDropXP(AwardType _awardtype, GameType _gametype)
 {
     return ((DropDictionary_[_awardtype][_gametype.GetType().ToString()] & FlagXP) != 0);
 }