Пример #1
0
        public static string HelloWorld()
        {
            string res1 = AnotherThing.CallMe();
            string res2 = NestedUtil.HelloWorld();

            return(String.Format("Hello from user_mu collection-hosted MyCSMU, also {0} and {1}", res1, res2));
        }
        public object CreateObject(string line, List<string> headers)
        {
            string[] values = line.Split(';');
            AnotherThing thing = new AnotherThing();
            foreach (var property in thing.GetType().GetProperties())
            {
                string FileColumnsName = GetFileColumnsNameFromMappage(property, "AnotherThing");
                int IndexColumnsInFile = FileColumnsName != null ? GetIndexColumnsInFile(FileColumnsName, headers) : -1;
                object toInsert = null;
                if (IndexColumnsInFile != -1)
                {
                    switch (property.PropertyType.Name)
                    {
                        case "DateTime":
                            toInsert = DateTime.Parse(values[IndexColumnsInFile]);
                            break;

                        default:
                            DateTime TestOfString;
                            toInsert = string.IsNullOrEmpty(values[IndexColumnsInFile]) ? null : values[IndexColumnsInFile];
                            bool isDate = DateTime.TryParse(values[IndexColumnsInFile], out TestOfString);
                            if (isDate)
                            {
                                toInsert = TestOfString;
                            }

                            break;
                    }
                }
                property.SetValue(thing, toInsert, null);
            }

            if (string.IsNullOrEmpty(thing.Name))
            {
                throw new Exception("Name is mandatory");
            }
            return thing;
        }
Пример #3
0
        public static string HelloWorld()
        {
            string res = AnotherThing.CallMe();

            return(String.Format("Hello from user_mu collection-hosted MyCSMU, also {0}", res));
        }