예제 #1
0
        public static List <Parameter> getParameters(string tableName, string request)
        {
            List <Parameter>      allParameters = new List <Parameter>();
            List <List <string> > responses     = SQL.get(request, 6);

            foreach (List <string> response in responses)
            {
                allParameters.Add(new Parameter(tableName, response));
            }
            return(allParameters);
        }
예제 #2
0
        public static List <Employee> getEmployees(string request)
        {
            List <Employee>       allEmployees = new List <Employee>();
            List <List <string> > responses    = SQL.get(request, 6);

            foreach (List <string> response in responses)
            {
                allEmployees.Add(new Employee(response));
            }
            return(allEmployees);
        }
예제 #3
0
        public Parameter(string tableName, string name)
        {
            this.tableName = tableName;
            string        request = "Select * from " + tableName + " where id = " + id;
            List <string> result  = SQL.get(request, 2)[0];

            if (result == null)
            {
                string errorMessage = Translations.getRightString(6) + id;
                throw new Exception(errorMessage);
            }
            id   = result[0];
            name = result[1];
        }
예제 #4
0
        public Employee(string id)
        {
            string        request = "Select * from Employees where id = " + id;
            List <string> result  = SQL.get(request, 6)[0];

            if (result == null)
            {
                string errorMessage = Translations.getRightString(6) + id;
                throw new Exception(errorMessage);
            }

            DateTime lastIn = Convert.ToDateTime(result[5]);

            Id           = id;
            FirstName    = result[1];
            LastName     = result[2];
            LastMomentIn = lastIn;
        }
예제 #5
0
        public static string getRightString(int id)
        {
            string request  = "Select * from settings where name = 'language'";
            string language = SQL.get(request, 2)[0][1];

            language = SQL.get(request, 2)[0][1];
            int column;

            if (language == "English")
            {
                column = 1;
            }
            else if (language == "French")
            {
                column = 2;
            }
            else
            {
                throw new Exception("The database saved language is invalid");
            }
            request = "Select * from locale where id = " + id.ToString();
            return(SQL.get(request, 3)[0][column]);
        }