示例#1
0
        /// <summary>
        /// Extension method for InputFormatOne type to convert the object of InputFormatOne into StandardFormat
        /// </summary>
        /// <param name="item">Object of InputFormatOne</param>
        /// <returns>Object of StandardFormat</returns>
        public static StandardFormat ToStandardFormat(this InputFormatOne item)
        {
            StandardFormat result = null;

            result = new StandardFormat
            {
                AccountCode = item.Identifier.Split('|')[1],
                Name        = item.Name,
                Type        = item.Type.ToAccountType(),
                OpenDate    = item.Opened,
                Currency    = item.Currency.ToCurrencyCode(),
            };
            return(result);
        }
        /// <summary>
        /// Mock code to load Input format one data
        /// </summary>
        /// <returns></returns>
        //TODO: Replace this code with actual code to read the details from CSV file
        static private List <InputFormatOne> LoadFormatOne()
        {
            List <InputFormatOne> inputFormaterList = new List <InputFormatOne>();
            InputFormatOne        item1             = new InputFormatOne
            {
                Identifier = "123|AbcCode",
                Name       = "My Account",
                Type       = 1,
                Opened     = Convert.ToDateTime("01-01-2018"),
                Currency   = "CD"
            };

            inputFormaterList.Add(item1);

            InputFormatOne item2 = new InputFormatOne
            {
                Identifier = "456|TestCode",
                Name       = "Test Account",
                Type       = 2,
                Opened     = Convert.ToDateTime("03-02-2018"),
                Currency   = "US"
            };

            inputFormaterList.Add(item2);

            InputFormatOne item3 = new InputFormatOne
            {
                Identifier = "789|SomeCode",
                Name       = "Some Account",
                Type       = 3,
                Opened     = Convert.ToDateTime("03-12-2018"),
                Currency   = "CD"
            };

            inputFormaterList.Add(item3);

            return(inputFormaterList);
        }