Beispiel #1
0
 public MatchEntity(string id, string name, List <PlayerEntity> houseTeamPlayers, List <PlayerEntity> awayTeamPlayers, ManagerEntity houseTeamManager, ManagerEntity awayTeamManager, RefereeEntity referee, DateTime date)
 {
     Id               = id;
     Name             = name;
     HouseTeamPlayers = houseTeamPlayers;
     AwayTeamPlayers  = awayTeamPlayers;
     HouseTeamManager = houseTeamManager;
     AwayTeamManager  = awayTeamManager;
     Referee          = referee;
     Date             = date;
 }
Beispiel #2
0
 public NominationMessageTest()
 {
     this._referee = new RefereeEntity() { Id = Guid.NewGuid(), FirstName = "Michał", LastName = "Jagusiak" };
     this._nominationMessage = new NominationMessage()
     {
         Type = "game",
         Mailadr = "*****@*****.**",
         NominationId = 1231,
         RefereeId = this._referee.Id,
         HashConfirmation = "somehash"
     };
 }
Beispiel #3
0
 public ActionResult Edit(RefereeEntity refereeentity, FormCollection form)
 {
     if (refereeentity.Id != CurrentReferee.Id)
     {
         return RedirectToAction("Profile", "Home");
     }
     DateTime dtDOB;
     DateTime.TryParse(String.Format("{0}-{1}-{2}", form["DOBYear"], form["DOBmonth"], form["DOBday"]), out dtDOB);
     refereeentity.DOB = dtDOB;
     string[] selectedRoles = Roles.GetRolesForUser(refereeentity.Mailadr);
     string Password = HashString.SHA1(String.Format("{0}{1}", refereeentity.Mailadr, DateTime.Now.ToUniversalTime().ToLongDateString())).Substring(0, 8);
     AddCredentialsIfNotExists(refereeentity.Mailadr, Password);
     try
     {
         if (ModelState.IsValid)
         {
             AssignRole(refereeentity.Mailadr, selectedRoles);
             if (refereeentity.Id == CurrentReferee.Id)
             {
                 Unit.RefereeRepository.UpdateProfile(refereeentity, CurrentReferee);
             }
             else
             {
                 Unit.RefereeRepository.Update(refereeentity);
             }
             Unit.Save();
             return RedirectToAction("Profile", "Home");
         }
     }
     catch (Exception e)
     {
         ModelState.AddModelError(String.Empty, e.Message);
     }
     PopulateDropDowns(refereeentity);
     return View(refereeentity);
 }
Beispiel #4
0
        public ActionResult Edit(RefereeEntity refereeentity, FormCollection form)
        {
            DateTime dtDOB;
            DateTime.TryParse(String.Format("{0}-{1}-{2}", form["DOBYear"], form["DOBmonth"], form["DOBday"]), out dtDOB);
            refereeentity.DOB = dtDOB;
            string[] selectedRoles = new string[] { };
            if (!String.IsNullOrEmpty(Request.Form["Roles"]))
            {
                selectedRoles = Request.Form["Roles"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            }

            string Password = HashString.SHA1(String.Format("{0}{1}", refereeentity.Mailadr, DateTime.Now.ToUniversalTime().ToLongDateString())).Substring(0, 8);
            ///Trzeba to zmienić w wersji docelowej.
            //Password = "******";
            AddCredentialsIfNotExists(refereeentity.Mailadr, Password);
            try
            {
                if (ModelState.IsValid)
                {
                    AssignRole(refereeentity.Mailadr, selectedRoles);
                    if (refereeentity.Id == CurrentReferee.Id)
                    {
                        Unit.RefereeRepository.UpdateProfile(refereeentity, CurrentReferee);
                    }
                    else
                    {
                        Unit.RefereeRepository.Update(refereeentity);
                    }
                    Unit.Save();
                    return RedirectToAction("Index");
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError(String.Empty, e.Message);
            }
            PopulateDropDowns(refereeentity);
            return View(refereeentity);
        }
Beispiel #5
0
        public ActionResult Create(RefereeEntity refereeentity, FormCollection form, HttpPostedFileBase Photo)
        {
            Guid NewUserGuid = Guid.Empty;

            string[] selectedRoles = new string[] { };
            if (!String.IsNullOrEmpty(Request.Form["Roles"]))
            {
                selectedRoles = Request.Form["Roles"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            }

            string Password = SetPassword(refereeentity);
            ///Trzeba to zmienić w wersji docelowej.
            //Password = "******";
            try {
                if (ModelState.IsValid)
                {
                    CreateUser(refereeentity.Mailadr, Password, Password, out NewUserGuid);
                    AssignRole(refereeentity.Mailadr, selectedRoles);
                    refereeentity.Id = NewUserGuid;
                    DateTime dtDOB;
                    DateTime.TryParse(String.Format("{0}-{1}-{2}", form["DOBYear"], form["DOBmonth"], form["DOBday"]), out dtDOB);
                    refereeentity.DOB = dtDOB;
                    ///Upload Referee Photo
                    if (Photo != null)
                    {
                        refereeentity.DestinationFolder = String.Format("{0}{1}/", FileUploader.DestinationFolder, HashString.SHA1(refereeentity.Id.ToString()));
                        refereeentity.Photo = UploadRefereePhoto(Photo, refereeentity.DestinationFolder);
                    }
                    else
                    {
                        refereeentity.DestinationFolder = "";
                        refereeentity.Photo = "";
                    }

                    Unit.RefereeRepository.Insert(refereeentity);
                    Unit.Save();
                    if (this.GetConfigValue("SendEmails") == "1" && this.GetConfigValue("SendNewAccountEmail") == "1")
                    {
                        MailHelper.CreateNewAccountMessage(refereeentity.Mailadr, Password);
                        if (MailHelper.ErrorMessage != MailHelper._success)
                        {
                            ///TODO: logowanie błędów
                        }
                    }
                    return RedirectToAction("Index");
                }
            }
            catch(Exception e)
            {
                if (NewUserGuid != Guid.Empty)
                {
                    Membership.DeleteUser(refereeentity.Mailadr);
                }
                ModelState.AddModelError(String.Empty, e.Message);
            }

            PopulateDropDowns(refereeentity);
            return View(refereeentity);
        }
Beispiel #6
0
 public RefereeEntityService(RefereeEntity Referee)
 {
     this.RefereeObject = Referee;
 }
Beispiel #7
0
 public UserDomain(RefereeEntity referee)
 {
     this._data = referee;
 }