public void AcceptAgreement(DeliveryMode delivery, ProfileKind acceptedByKind) { if (Status != AgreementStatus.WaitingForProducerApproval && Status != AgreementStatus.WaitingForStoreApproval) { throw SheaftException.Validation("Le partenariat ne peut pas être accepté, il n'est en attente d'acceptation."); } if (Status == AgreementStatus.WaitingForProducerApproval && acceptedByKind != ProfileKind.Producer) { throw SheaftException.Validation("Le partenariat doit être accepté par le producteur."); } if (Status == AgreementStatus.WaitingForStoreApproval && acceptedByKind != ProfileKind.Store) { throw SheaftException.Validation("Le partenariat doit être accepté par le magasin."); } if (delivery != null) { ChangeDelivery(delivery); } if (!DeliveryModeId.HasValue) { throw SheaftException.Validation("Le partenariat doit avoir un mode de livraison rattaché."); } Store.IncreaseProducersCount(); Status = AgreementStatus.Accepted; DomainEvents.Add(new AgreementAcceptedEvent(Id, acceptedByKind)); }
public virtual string GetString(ProfileKind kind) { string res = string.Empty; switch (kind) { case ProfileKind.Name: res = _name; break; } return(res); }
protected Business(Guid id, ProfileKind kind, string name, string firstname, string lastname, string email, UserAddress address, bool openForBusiness = true, string phone = null) : base(id, kind, name, firstname, lastname, email, phone) { if (address == null) { throw SheaftException.Validation("L'adresse du siège social est requise."); } SetOpenForNewBusiness(openForBusiness); SetAddress(address); Closings = new List <BusinessClosing>(); }
protected User(Guid id, ProfileKind kind, string name, string firstname, string lastname, string email, string phone = null) { Id = id; SetProfileKind(kind); SetUserName(name); SetEmail(email); SetPhone(phone); SetFirstname(firstname); SetLastname(lastname); Points = new List <UserPoint>(); Settings = new List <UserSetting>(); Pictures = new List <ProfilePicture>(); RefreshPoints(); }
public void CancelAgreement(string reason, ProfileKind cancelledByKind) { if (Status == AgreementStatus.Cancelled) { throw SheaftException.Validation("Le partenariat est déjà annulé."); } if (Status == AgreementStatus.Refused) { throw SheaftException.Validation("Le partenariat est déjà refusé."); } Status = AgreementStatus.Cancelled; Position = null; Reason = reason; Store.DecreaseProducersCount(); DomainEvents.Add(new AgreementCancelledEvent(Id, cancelledByKind)); }
public virtual int GetInt(ProfileKind kind) { int res = 0; switch (kind) { case ProfileKind.Unique: res = _id; break; case ProfileKind.Master: res = _master_id; break; case ProfileKind.Category: res = _category; break; case ProfileKind.Rarity: res = _rarity; break; } return(res); }
public override int GetInt(ProfileKind kind) { int res = 0; switch (kind) { case ProfileKind.Unique: res = _id; break; case ProfileKind.Master: res = _master_id; break; case ProfileKind.Category: res = _category; break; case ProfileKind.Rarity: res = _rarity; break; case ProfileKind.Level: res = _lv; break; case ProfileKind.Job: res = _job; break; } return res; }
public void RefuseAgreement(string reason, ProfileKind refusedByKind) { if (Status != AgreementStatus.WaitingForProducerApproval && Status != AgreementStatus.WaitingForStoreApproval) { throw SheaftException.Validation("Le partenariat n'est pas en attente d'acceptation."); } if (Status == AgreementStatus.WaitingForProducerApproval && refusedByKind != ProfileKind.Producer) { throw SheaftException.Validation("Le partenariat ne peut être refusé que par le producteur."); } if (Status == AgreementStatus.WaitingForStoreApproval && refusedByKind != ProfileKind.Store) { throw SheaftException.Validation("Le partenariat ne peut être refusé que par le magasin."); } Status = AgreementStatus.Refused; Position = null; Reason = reason; DomainEvents.Add(new AgreementRefusedEvent(Id, refusedByKind)); }
public AgreementCancelledEvent(Guid agreementId, ProfileKind requestedByKind) { AgreementId = agreementId; RequestedByKind = requestedByKind; }