Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Messages
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public enum AuthorisationAction { Authorise = 0, Decline = 1, } public enum ActionType { Undefined =-1, Created = 0, Updated = 1, Deleted = 3, Frozen = 4, Cancelled = 5, Unfrozen = 6, Authorised= 7, Declined= 8, Activated = 9, Deactivated =10, } public enum EntityType { Card = 0, User = 1, CreditCard=2, CardHolder=3, } public static string CheckEntityType(string entityType) { entityType = entityType == EntityType.CreditCard.ToString() ? "Credit card" : entityType; entityType = entityType == EntityType.CardHolder.ToString() ? "Card holder" : entityType; return entityType; } public static string GetMessageActionSucceededAndNotAuthorised(EntityType EntityType, ActionType action, bool multiple = false) { // if (action.ToString() == ActionType.Undefined.ToString()) // return string.Format("{}{0} {1} been {2} but need authorisation to be fully deactivated from the system", multiple ? "s" : string.Empty, multiple ? "have" : "has", action.ToString(), EntityType.ToString()); // else return string.Format("{3}{0} {1} been {2} but need authorisation to be fully deactivated from the system", multiple ? "s" : string.Empty, multiple ? "have" : "has", action.ToString().ToLowerInvariant(), CheckEntityType(EntityType.ToString())); } public static string GetMessageActionSucceededAndAuthorised(EntityType EntityType, ActionType action, bool multiple = false) { if (action.ToString() == ActionType.Undefined.ToString()) return string.Format("{2}{0} {1} been fully authorised", multiple ? "s" : string.Empty, multiple ? "have" : "has", CheckEntityType(EntityType.ToString())); else return string.Format("{3}{0} {1} been {2} and fully authorised successfully", multiple ? "s" : string.Empty, multiple ? "have" : "has", action.ToString().ToLowerInvariant(), CheckEntityType(EntityType.ToString())); } public static string GetMessageActionSucceededAndPartiallyAuthorised(EntityType EntityType, ActionType action, bool multiple = false) { if (action.ToString() == ActionType.Undefined.ToString()) return string.Format("{2}{0} {1} been partially authorised", multiple ? "s" : string.Empty, multiple ? "have" : "has", CheckEntityType(EntityType.ToString())); else return string.Format("{3}{0} {1} been {2} and partially authorised successfully", multiple ? "s" : string.Empty, multiple ? "have" : "has", action.ToString().ToLowerInvariant(), CheckEntityType(EntityType.ToString())); } public static string GetMessageActionSucceeded(EntityType EntityType, ActionType action, bool multiple = false) { return string.Format("{3}{0} {1} been {2} successfully but not authorised.", multiple ? "s" : string.Empty, multiple ? "have" : "has", action.ToString().ToLowerInvariant(), CheckEntityType(EntityType.ToString())); } public static string GetMessageActionSucceededAndUnAuthorised(EntityType EntityType, bool multiple = false) { var mesag = string.Format("{2}{0} {1} been declined successfully", multiple ? "s" : string.Empty, multiple ? "have" : "has", CheckEntityType(EntityType.ToString())); return mesag; } public static string GetMessageActionDeclineFailed(EntityType EntityType, bool multiple = false) { return string.Format("{1}{0} could not be declined", multiple ? "s" : string.Empty, CheckEntityType(EntityType.ToString())); } public static string GetMessageActionSucceededCannotAuthorise(EntityType EntityType, bool multiple = false) { return string.Format("You can't authorise {0} {1}{2} that you created/updated", multiple ? string.Empty : "a ", CheckEntityType(EntityType.ToString()).ToLowerInvariant(), multiple ? "s" : string.Empty); } public static void Main(string[] args) { //Your code goes here Console.WriteLine("Hello, world!"); // var actiontypeList = new List<String>(){ "Undefined", // "Created", // "Updated", //"Deleted", //"Frozen", // "Cancelled", //"Unfrozen", // "Authorised", //"Declined", // "Activated", // "Deactivated", }; var actiontypeList = Enum.GetValues(typeof(ActionType)).Cast<ActionType>(); // var entityTypeList= new List<String>(){ "Card", //"User" , // //"CreditCard", // " CardHolder" }; var entityTypeList = Enum.GetValues(typeof(EntityType)).Cast<EntityType>(); entityTypeList.ToList().ForEach(entityType => { actiontypeList.ToList().ForEach(actionType=> { // var message= Program.GetMessageActionSucceededAndAuthorised(entityType, actionType,false); var excludeActionList = new List<ActionType>(){ ActionType.Deleted }; if(entityType.ToString()==EntityType.CardHolder.ToString() && !excludeActionList.Contains(actionType)) Console.WriteLine(actionType.ToString()); ; // var message= Program.GetMessageActionSucceededAndAuthorised(entityType, actionType,true); // Console.WriteLine(message); }); } ); } } }
run
|
edit
|
history
|
help
0
MostFrequent
jdiwnnx cf
switch it
asdfghjiu
[REDACTED] database V0.1.6
project euler 13, C#
MIXED CONTENT - string and numbers separation in a large string
Compare list
list
Count occurences of Character