Exemple #1
0
 public int assignVolunteer(string usrn)
 {
     System.Diagnostics.Debug.WriteLine("Hello !!");
     IntelligentSystem I = new IntelligentSystem();
     int result = I.assignVolunteer(usrn);
     return result;
 }
Exemple #2
0
        public int assignVolunteer(string usrn)
        {
            System.Diagnostics.Debug.WriteLine("Hello !!");
            IntelligentSystem I = new IntelligentSystem();
            int result          = I.assignVolunteer(usrn);

            return(result);
        }
Exemple #3
0
        public int registerStudent(string sid, string pwd, string fname, string lname, string eid, string sex, string atime, string airline, string flight, string address1)
        {
            //atime should be of this format "MM/dd/yyyy HH:mm:ss"
            int result = 39;

            try
            {
                SqlConnection sqlConnection1 = new SqlConnection(ConfigurationManager.ConnectionStrings["pickdb"].ConnectionString);
                SqlCommand    cmd            = new SqlCommand();
                result = 45;

                string   pattern = "MM/dd/yyyy HH:mm:ss";
                DateTime parsedDate;
                if (DateTime.TryParseExact(atime, pattern, null, DateTimeStyles.None, out parsedDate))
                {
                    Console.WriteLine("Converted to {1:d}.", atime, parsedDate);
                }
                else
                {
                    Console.WriteLine("Unable to convert '{0}' to a date and time.", atime);
                }

                cmd.CommandText = "INSERT into student (studentid,passwd,firstname,lastname,email,gender,arrivaltime,airlines,flight,address1) VALUES ('" + sid + "','" + pwd + "','" + fname + "','" + lname + "','" + eid + "','" + sex + "','" + parsedDate + "','" + airline + "','" + flight + "','" + address1 + "')";

                cmd.CommandType = CommandType.Text;
                cmd.Connection  = sqlConnection1;
                sqlConnection1.Open();
                result = cmd.ExecuteNonQuery();
                sqlConnection1.Close();
                if (result == 1)
                {
                    IntelligentSystem I = new IntelligentSystem();
                    result = I.assignVolunteer(sid);
                }
            }
            catch (Exception e)
            {
                e.GetBaseException();
            }
            return(result);
        }
Exemple #4
0
        public int registerVolunteer(string sid, string pwd, string fname, string lname, string eid, string sex, string ph, string address1, byte mon, byte tue, byte wed, byte thu, byte fri, byte sat, byte sun)
        {
            int           result = 35;
            SqlDataReader reader;

            try
            {
                SqlConnection sqlConnection1 = new SqlConnection(ConfigurationManager.ConnectionStrings["pickdb"].ConnectionString);
                SqlCommand    cmd            = new SqlCommand();
                result          = 34;
                cmd.CommandText = "INSERT into Volunteer(studentid,passwd,firstname,lastname,email,gender,phone,address,MonAvailability, TueAvailability, WedAvailability, ThuAvailability, FriAvailability, SatAvailability, SunAvailability) VALUES ('" + sid + "','" + pwd + "','" + fname + "','" + lname + "','" + eid + "','" + sex + "','" + ph + "','" + address1 + "','" + mon + "','" + tue + "','" + wed + "','" + thu + "','" + fri + "','" + sat + "','" + sun + "')";
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = sqlConnection1;
                sqlConnection1.Open();
                Console.WriteLine("hi anvesh");

                result = cmd.ExecuteNonQuery();
                sqlConnection1.Close();


                cmd.CommandText = "SELECT * FROM student where Volunteerid = '0' ";
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = sqlConnection1;
                sqlConnection1.Open();
                reader = cmd.ExecuteReader();
                reader.Read();
                IntelligentSystem I = new IntelligentSystem();
                while (reader.Read())
                {
                    result = I.assignVolunteer(reader.GetString(0));
                    Console.WriteLine("hello1" + reader.GetString(0));
                }
                sqlConnection1.Close();
            }
            catch (Exception e)
            {
                e.GetBaseException();
            }
            return(result);
        }
Exemple #5
0
        public int registerVolunteer(string sid, string pwd, string fname, string lname, string eid, string sex, string ph, string address1, byte mon, byte tue, byte wed, byte thu, byte fri, byte sat, byte sun)
        {
            int result = 35;
            SqlDataReader reader;
            try
            {
                SqlConnection sqlConnection1 = new SqlConnection(ConfigurationManager.ConnectionStrings["pickdb"].ConnectionString);
                SqlCommand cmd = new SqlCommand();
                result = 34;
                cmd.CommandText = "INSERT into Volunteer(studentid,passwd,firstname,lastname,email,gender,phone,address,MonAvailability, TueAvailability, WedAvailability, ThuAvailability, FriAvailability, SatAvailability, SunAvailability) VALUES ('" + sid + "','" + pwd + "','" + fname + "','" + lname + "','" + eid + "','" + sex + "','" + ph + "','" + address1 + "','" + mon + "','" + tue + "','" + wed + "','" + thu + "','" + fri + "','" + sat + "','" + sun + "')";
                cmd.CommandType = CommandType.Text;
                cmd.Connection = sqlConnection1;
                sqlConnection1.Open();
                Console.WriteLine("hi anvesh");

                result = cmd.ExecuteNonQuery();
                sqlConnection1.Close();

                cmd.CommandText = "SELECT * FROM student where Volunteerid = '0' ";
                cmd.CommandType = CommandType.Text;
                cmd.Connection = sqlConnection1;
                sqlConnection1.Open();
                reader = cmd.ExecuteReader();
                reader.Read();
                IntelligentSystem I = new IntelligentSystem();
                while (reader.Read())
                {
                    result = I.assignVolunteer(reader.GetString(0));
                    Console.WriteLine("hello1" + reader.GetString(0));
                }
                sqlConnection1.Close();

            }
            catch (Exception e)
            {
                e.GetBaseException();

            }
            return result;
        }
Exemple #6
0
        public int registerStudent(string sid, string pwd,string fname, string lname,string eid,string sex, string atime,string airline,string flight,string address1)
        {
            //atime should be of this format "MM/dd/yyyy HH:mm:ss"
            int result = 39;
            try
            {
                SqlConnection sqlConnection1 = new SqlConnection(ConfigurationManager.ConnectionStrings["pickdb"].ConnectionString);
                SqlCommand cmd = new SqlCommand();
                result = 45;

                string pattern = "MM/dd/yyyy HH:mm:ss";
                DateTime parsedDate;
                   if (DateTime.TryParseExact(atime, pattern, null, DateTimeStyles.None, out parsedDate))
                       Console.WriteLine("Converted to {1:d}.", atime, parsedDate);
                   else
                       Console.WriteLine("Unable to convert '{0}' to a date and time.", atime);

                   cmd.CommandText = "INSERT into student (studentid,passwd,firstname,lastname,email,gender,arrivaltime,airlines,flight,address1) VALUES ('" + sid + "','" + pwd + "','" + fname + "','" + lname + "','" + eid + "','" + sex + "','" + parsedDate + "','" + airline + "','" + flight + "','" + address1 + "')";

                cmd.CommandType = CommandType.Text;
                cmd.Connection = sqlConnection1;
                sqlConnection1.Open();
                result = cmd.ExecuteNonQuery();
                sqlConnection1.Close();
                if (result == 1) {
                IntelligentSystem I = new IntelligentSystem();
                 result = I.assignVolunteer(sid);
                }
            }
            catch (Exception e)
            {
                e.GetBaseException();

            }
            return result;
        }
Exemple #7
0
        public int updateStudentDetails(string sid, string fname, string lname, string eid, string sex, string atime, string airline, string flight, string address1)
        {
            //atime should be of this format "MM/dd/yyyy HH:mm:ss"
            int      result = 39;
            String   ff     = "";
            DateTime parsedDate;
            DateTime dbDate = DateTime.Today;

            try
            {
                SqlConnection sqlConnection1 = new SqlConnection(ConfigurationManager.ConnectionStrings["pickdb"].ConnectionString);
                SqlCommand    cmd            = new SqlCommand();
                SqlDataReader reader;
                result = 45;

                string pattern = "MM/dd/yyyy HH:mm:ss";

                if (DateTime.TryParseExact(atime, pattern, null, DateTimeStyles.None, out parsedDate))
                {
                    Console.WriteLine("Converted to {1:d}.", atime, parsedDate);
                }
                else
                {
                    Console.WriteLine("Unable to convert '{0}' to a date and time.", atime);
                }

                cmd.CommandText = "SELECT * from student where studentid ='" + sid + "'";

                cmd.CommandType = CommandType.Text;
                cmd.Connection  = sqlConnection1;
                sqlConnection1.Open();
                reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        dbDate = reader.GetDateTime(6);
                        ff     = reader.GetString(10);
                        sqlConnection1.Close();

                        if ((!ff.Equals("0")) && (!parsedDate.Equals(dbDate)))
                        {
                            cmd.CommandText = " UPDATE Volunteer SET noOfStudents = noOfStudents - 1 WHERE studentid = " + ff;
                            cmd.CommandType = CommandType.Text;
                            cmd.Connection  = sqlConnection1;
                            sqlConnection1.Open();
                            result = cmd.ExecuteNonQuery();
                            sqlConnection1.Close();
                        }
                        cmd.CommandText = " UPDATE student SET firstname = '" + fname + "' , lastname = '" + lname + "' , email = '" + eid + "' , gender = '" + sex + "' , arrivaltime = '" + parsedDate + "' , airlines = '" + airline + "' , flight = '" + flight + "' , address1 = '" + address1 + "' WHERE studentid = " + sid;

                        cmd.CommandType = CommandType.Text;
                        cmd.Connection  = sqlConnection1;
                        sqlConnection1.Open();
                        result = cmd.ExecuteNonQuery();
                        sqlConnection1.Close();

                        if ((result == 1) && (!parsedDate.Equals(dbDate)))
                        {
                            IntelligentSystem I = new IntelligentSystem();
                            result = I.assignVolunteer(sid);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                e.GetBaseException();
            }
            return(result);
        }