Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
Merge pull request #64 from difi/b_leggTilManglendeEnums
Browse files Browse the repository at this point in the history
Lagt til manglende enums
  • Loading branch information
asjafjell committed Mar 2, 2015
2 parents 27ff57a + 9c10e52 commit 59ed6d6
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
61 changes: 61 additions & 0 deletions SikkerDigitalPost.Domene/Enums/PMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using SikkerDigitalPost.Domene.Entiteter.Post;

namespace SikkerDigitalPost.Domene.Enums
{
internal enum PMode
{
FormidleDigitalPost,
FormidleFysiskPost,
KvitteringsForespoersel
}

internal static class PModeHelper
{
private const string FormidleDigitalPostReferanse = "http://begrep.difi.no/SikkerDigitalPost/1.0/transportlag/Meldingsutveksling/FormidleDigitalPostForsendelse";
private const string FormidleFysiskPostReferanse = "http://begrep.difi.no/SikkerDigitalPost/1.0/transportlag/Meldingsutveksling/FormidleFysiskPostForsendelse";

internal static string EnumToRef(PMode pMode)
{
switch (pMode)
{
case PMode.FormidleDigitalPost:
return FormidleDigitalPostReferanse;
case PMode.FormidleFysiskPost:
return FormidleFysiskPostReferanse;
case PMode.KvitteringsForespoersel:
return FormidleDigitalPostReferanse;
default:
throw new ArgumentOutOfRangeException("pMode", pMode.ToString(), "Fant ingen referanse for angitt pMode");
}
}

internal static PMode FromPostInfo(PostInfo postInfo)
{
var type = postInfo.GetType();

if(type == typeof(FysiskPostInfo))
return PMode.FormidleFysiskPost;

if (type == typeof (DigitalPostInfo))
return PMode.FormidleDigitalPost;

throw new ArgumentOutOfRangeException("postInfo", type, "PostInfo har feil type.");

}
}
}
7 changes: 7 additions & 0 deletions SikkerDigitalPost.Domene/Enums/Postmetode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace SikkerDigitalPost.Domene.Entiteter.Post
{
public enum Postmetode
{
Fysisk, Digital
}
}

0 comments on commit 59ed6d6

Please sign in to comment.