Пример #1
0
        // Overload
        // Collect and store user data in temp list
        private static List <Object> TempUserInfoHolder(Dictionary <string, string> fieldNames, int status)
        {
            // local variable to hold the new values
            var temp = CollegeLists.TempObjectList();


            foreach (KeyValuePair <string, string> kvp in fieldNames)
            {
                // Find what type of data we have to collect
                if (kvp.Value.Contains("integer"))
                {
                    // collect data => student status
                    temp.Add(status + 1);
                }
                else if (kvp.Value.Contains("decimal"))
                {
                    // collect data => salary
                    temp.Add(CollectDecimalData(kvp.Key));
                }
                else if (kvp.Value.Contains("id"))
                {
                    // GENERATE data => lecturerId/studentId
                    temp.Add(GenerateID(status + 1));
                }
                else
                {
                    // Normal string data
                    temp.Add(ReadInput(kvp.Key));
                }
            }
            return(temp);
        }
Пример #2
0
        // Collect and store
        // user data in temp list
        private static List <Object> TempUserInfoHolder(Dictionary <string, string> fieldNames)
        {
            // local variable to hold the new values
            var temp = CollegeLists.TempObjectList();

            // Read student status
            int status = ReadStudentStatus();

            foreach (KeyValuePair <string, string> kvp in fieldNames)
            {
                if (kvp.Value.Contains("decimal"))
                {
                    // collect data => salary
                    temp.Add(CollectDecimalData(kvp.Key));
                }
                else if (kvp.Value.Contains("id"))
                {
                    // GENERATE data => lecturerId/studentId
                    try
                    {
                        temp.Add(GenerateID(status + 1));
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                else
                {
                    // Normal string data
                    temp.Add(ReadInput(kvp.Key));
                }
            }
            temp.Add(status);
            return(temp);
        }