예제 #1
0
 public UserFrontEnd TrimSize(UserFrontEnd input)
 {
     input.CustomerName            = limitString(input.CustomerName, 64);
     input.OrderItem               = limitString(input.OrderItem, 64);
     input.Secure_CreditCardNumber = limitString(input.Secure_CreditCardNumber, 64);
     input.Secure_LegacyPIN        = limitString(input.Secure_LegacyPIN, 64);
     input.Secure_SSN              = limitString(input.Secure_SSN, 64);
     return(input);
 }
예제 #2
0
        public UserFrontEnd AddOrEdit(UserFrontEnd editUser = null)
        {
            UserFrontEnd usr;

            if (editUser == null)
            {
                usr = new UserFrontEnd();
                var orderGuid = Guid.NewGuid();
                usr.InfoId = orderGuid;
                usr.PartId = GetPartId(orderGuid);
            }
            else
            {
                usr = editUser;
            }

            Console.Write("Customer Name: [{0}]", usr.CustomerName);
            var temp = Console.ReadLine();

            if (!String.IsNullOrEmpty(temp))
            {
                usr.CustomerName = temp;
            }

            Console.Write("Item purchased: [{0}]", usr.OrderItem);
            temp = Console.ReadLine();
            if (!String.IsNullOrEmpty(temp))
            {
                usr.OrderItem = temp;
            }

            Console.Write("Credit Card number: [{0}]", usr.Secure_CreditCardNumber);
            temp = Console.ReadLine();
            if (!String.IsNullOrEmpty(temp))
            {
                usr.Secure_CreditCardNumber = temp;
            }

            Console.Write("SSN: [{0}]", usr.Secure_SSN);
            temp = Console.ReadLine();
            if (!String.IsNullOrEmpty(temp))
            {
                usr.Secure_SSN = temp;
            }

            Console.Write("Legacy PIN: [{0}]", usr.Secure_LegacyPIN);
            temp = Console.ReadLine();
            if (!String.IsNullOrEmpty(temp))
            {
                usr.Secure_LegacyPIN = temp;
            }

            usr.Timestamp = DateTime.Now;

            usr = TrimSize(usr);
            return(usr);
        }
예제 #3
0
        public UserFrontEnd AddOrEdit(UserFrontEnd editUser=null)
        {
            UserFrontEnd usr;
            if (editUser == null)
            {
                usr = new UserFrontEnd();
                var orderGuid = Guid.NewGuid();
                usr.InfoId = orderGuid;
                usr.PartId = GetPartId(orderGuid);
            }
            else
            {
                usr = editUser;
            }

            Console.Write("Customer Name: [{0}]", usr.CustomerName);
            var temp = Console.ReadLine();
            if (!String.IsNullOrEmpty(temp))
                usr.CustomerName = temp;

            Console.Write("Item purchased: [{0}]", usr.OrderItem);
            temp = Console.ReadLine();
            if (!String.IsNullOrEmpty(temp))
                usr.OrderItem = temp;

            Console.Write("Credit Card number: [{0}]", usr.Secure_CreditCardNumber);
            temp = Console.ReadLine();
            if (!String.IsNullOrEmpty(temp))
                usr.Secure_CreditCardNumber = temp;

            Console.Write("SSN: [{0}]", usr.Secure_SSN);
            temp = Console.ReadLine();
            if (!String.IsNullOrEmpty(temp))
                usr.Secure_SSN = temp;

            Console.Write("Legacy PIN: [{0}]", usr.Secure_LegacyPIN);
            temp = Console.ReadLine();
            if (!String.IsNullOrEmpty(temp))
                usr.Secure_LegacyPIN = temp;

            usr.Timestamp = DateTime.Now;

            usr = TrimSize(usr);
            return usr;
        }
예제 #4
0
        public string PrintToString(UserFrontEnd o)
        {
            var sb = new StringBuilder();

            sb.AppendFormat("PartId:{0}, OrderId:{1}, {2} got {3} at {4} using CC {5},SSN={6}, PIN={7}. Metadata={8}" + Environment.NewLine,
                            o.PartId,
                            o.InfoId,
                            o.CustomerName,
                            o.OrderItem,
                            o.Timestamp,
                            o.Secure_CreditCardNumber,
                            o.Secure_SSN,
                            o.Secure_LegacyPIN,
                            o.Secure_MetadataDisplayField);

            sb.AppendLine("---------------------------------------------------------------");
            return(sb.ToString());
        }
예제 #5
0
        public UserFrontEnd CreateRandomUser()
        {
            //var rng = new SecureRandom();

            // Create a new order
            var rndUser = new UserFrontEnd();
            var orderGuid = Guid.NewGuid();
            var r = new UserRandomizer();

            rndUser.InfoId = orderGuid;
            rndUser.PartId = GetPartId(orderGuid);

            rndUser.OrderItem = r.GetRandomItem();
            rndUser.CustomerName = r.GetRandomNames();
            rndUser.Timestamp = r.GetRandomTime();
            rndUser.Secure_CreditCardNumber = r.GetRandomCC();
            rndUser.Secure_LegacyPIN = r.GetRandomPIN();
            rndUser.Secure_SSN = r.GetRandomSSN();
            rndUser.Secure_MetadataDisplayField = "Overwritten by CipherDb book-keeping";

            return rndUser;
        }
예제 #6
0
        public UserFrontEnd CreateRandomUser()
        {
            //var rng = new SecureRandom();

            // Create a new order
            var rndUser   = new UserFrontEnd();
            var orderGuid = Guid.NewGuid();
            var r         = new UserRandomizer();

            rndUser.InfoId = orderGuid;
            rndUser.PartId = GetPartId(orderGuid);

            rndUser.OrderItem                   = r.GetRandomItem();
            rndUser.CustomerName                = r.GetRandomNames();
            rndUser.Timestamp                   = r.GetRandomTime();
            rndUser.Secure_CreditCardNumber     = r.GetRandomCC();
            rndUser.Secure_LegacyPIN            = r.GetRandomPIN();
            rndUser.Secure_SSN                  = r.GetRandomSSN();
            rndUser.Secure_MetadataDisplayField = "Overwritten by CipherDb book-keeping";

            return(rndUser);
        }
예제 #7
0
 public UserFrontEnd TrimSize(UserFrontEnd input)
 {
     input.CustomerName = limitString(input.CustomerName, 64);
     input.OrderItem = limitString(input.OrderItem, 64);
     input.Secure_CreditCardNumber = limitString(input.Secure_CreditCardNumber, 64);
     input.Secure_LegacyPIN = limitString(input.Secure_LegacyPIN, 64);
     input.Secure_SSN = limitString(input.Secure_SSN, 64);
     return input;
 }
예제 #8
0
        public string PrintToString(UserFrontEnd o)
        {
            var sb = new StringBuilder();
            sb.AppendFormat("PartId:{0}, OrderId:{1}, {2} got {3} at {4} using CC {5},SSN={6}, PIN={7}. Metadata={8}" + Environment.NewLine,
                o.PartId,
                o.InfoId,
                o.CustomerName,
                o.OrderItem,
                o.Timestamp,
                o.Secure_CreditCardNumber,
                o.Secure_SSN,
                o.Secure_LegacyPIN,
                o.Secure_MetadataDisplayField);

            sb.AppendLine("---------------------------------------------------------------");
            return sb.ToString();
        }