예제 #1
0
        public void GetUser(string email, string password)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlDataReader baglayici;
                MySqlCommand    komut      = new MySqlCommand();
                string          sqlsorgusu = "SELECT * FROM daybook.User Where Email='" + email + "' AND Password='******'";
                komut.CommandText = sqlsorgusu;
                komut.Connection  = awsConnection.sqlConnection;
                baglayici         = komut.ExecuteReader();
                if (baglayici.Read())
                {
                    Console.WriteLine("Başarılı");
                }
                else
                {
                    Console.WriteLine("Email veya password hatalı...");
                }
            }
            else
            {
                Console.WriteLine("bağlantı basarısızzzzzz");
            }
            awsConnection.sqlConnection.Close();
        }
예제 #2
0
        public void GetUserId(string email, string password)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlDataAdapter baglayici  = new MySqlDataAdapter();
                MySqlCommand     komut      = new MySqlCommand();
                string           sqlsorgusu = "SELECT Id FROM daybook.User Where Email='" + email + "' AND Password='******'";
                DataTable        tablo      = new DataTable();

                komut.CommandText       = sqlsorgusu;
                komut.Connection        = awsConnection.sqlConnection;
                baglayici.SelectCommand = komut;
                baglayici.Fill(tablo);

                // Console.WriteLine(tablo);
                int userId;

                foreach (DataRow dataRow in tablo.Rows)
                {
                    foreach (var item in dataRow.ItemArray)
                    {
                        userId = (int)item;
                        Console.WriteLine(item);
                    }
                }
            }
            else
            {
                Console.WriteLine("basarısızzzzzz");
            }
            awsConnection.sqlConnection.Close();
        }
예제 #3
0
        public Result GetUserEmail(string email)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlDataReader baglayici;
                MySqlCommand    komut      = new MySqlCommand();
                string          sqlsorgusu = "SELECT * FROM daybook.User Where Email='" + email + "'";
                komut.CommandText = sqlsorgusu;
                komut.Connection  = awsConnection.sqlConnection;
                baglayici         = komut.ExecuteReader();
                if (baglayici.Read())
                {
                    awsConnection.sqlConnection.Close();
                    return(new SuccessResult(Message.LoginSucces));
                }
                else
                {
                    awsConnection.sqlConnection.Close();
                    return(new ErrorResult(Message.InvalidMailOrPassword));
                }
            }
            else
            {
                awsConnection.sqlConnection.Close();
                return(new ErrorResult(Message.Error));
            }
        }
예제 #4
0
        public Result AddToDo(Meeting meeting)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlCommand komut  = new MySqlCommand();
                string       ekleme = "INSERT INTO daybook.Meeting(UId,from,to,eventName,notes,location,isAllDay,startTimeZone,endTimeZone) VALUES('" + meeting.UId + "','" + meeting.from + "','" + meeting.to + "','" + meeting.eventName + "','" + meeting.notes + "','" + meeting.location + "','" + meeting.isAllDay + "','" + meeting.startTimeZone + "','" + meeting.endTimeZone + "',)";

                komut.Connection  = awsConnection.sqlConnection;
                komut.CommandText = ekleme;
                komut.ExecuteNonQuery();
                return(new SuccessResult(Message.succces));
            }
            awsConnection.sqlConnection.Close();
            return(new ErrorResult(Message.Error));
        }
예제 #5
0
        public void DeleteToDo(ToDo toDo)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlCommand komut = new MySqlCommand();
                string       sil   = "DELETE FROM daybook.ToDo WHERE Todo='" + toDo.toDo + "'";

                komut.Connection  = awsConnection.sqlConnection;
                komut.CommandText = sil;
                komut.ExecuteNonQuery();
                Console.WriteLine("basarılı");
            }
            else
            {
                Console.WriteLine("basarısızzzzzz");
            }
        }
예제 #6
0
파일: AwsNotes.cs 프로젝트: clkadem/Daybook
        public void DeleteNotes(Note note)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlCommand komut = new MySqlCommand();
                string       sil   = "DELETE FROM daybook.Notes WHERE Id='" + note.Id + "'";

                komut.Connection  = awsConnection.sqlConnection;
                komut.CommandText = sil;
                komut.ExecuteNonQuery();
                Console.WriteLine("basarılı");
            }
            else
            {
                Console.WriteLine("basarısızzzzzz");
            }
        }
예제 #7
0
        public DataResult <ObservableCollection <Meeting> > GetMeeting(int UId)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlDataAdapter baglayici  = new MySqlDataAdapter();
                MySqlCommand     komut      = new MySqlCommand();
                string           sqlsorgusu = "SELECT * FROM daybook.Meeting Where UId='" + UId + "'";
                DataTable        tablo      = new DataTable();

                komut.CommandText       = sqlsorgusu;
                komut.Connection        = awsConnection.sqlConnection;
                baglayici.SelectCommand = komut;
                baglayici.Fill(tablo);

                ObservableCollection <Meeting> collection = new ObservableCollection <Meeting>();


                foreach (DataRow dataRow in tablo.Rows)
                {
                    Meeting meeting = new Meeting();
                    meeting.Id            = (int)dataRow["Id"];
                    meeting.UId           = (int)dataRow["UId"];
                    meeting.from          = (DateTime)dataRow["from"];
                    meeting.to            = (DateTime)dataRow["to"];
                    meeting.eventName     = (string)dataRow["eventName"];
                    meeting.notes         = (string)dataRow["notes"];
                    meeting.location      = (string)dataRow["location"];
                    meeting.isAllDay      = (bool)dataRow["isAllDay"];
                    meeting.startTimeZone = (string)dataRow["startTimeZone"];
                    meeting.endTimeZone   = (string)dataRow["endTimeZone"];

                    collection.Add(meeting);
                }
                return(new SuccessDataResult <ObservableCollection <Meeting> >(collection, Message.succces));
            }
            awsConnection.sqlConnection.Close();
            return(new ErrorDataResult <ObservableCollection <Meeting> >(Message.Error));
        }
예제 #8
0
        //Parola yenileme ekle
        //Dataresult kullanımı


        public void AddUser(string name, string lastName, string email, string password)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlCommand komut  = new MySqlCommand();
                string       ekleme = "INSERT INTO daybook.User(Name,Lastname,Email,Password) VALUES('" + name + "','" + lastName + "','" + email + "','" + password + "')";

                komut.Connection  = awsConnection.sqlConnection;
                komut.CommandText = ekleme;
                komut.ExecuteNonQuery();
                Console.WriteLine("başarılı");
            }
            else
            {
                Console.WriteLine("basarısızzzzzz");
            }
            awsConnection.sqlConnection.Close();
        }
예제 #9
0
        public void UpdateIsChecked(ToDo toDo)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlCommand komut    = new MySqlCommand();
                string       güncelle = "UPDATE daybook.ToDo SET IsChecked='" + toDo.IsChecked + "' WHERE Todo='" + toDo.toDo + "'";

                komut.Connection  = awsConnection.sqlConnection;
                komut.CommandText = güncelle;
                komut.ExecuteNonQuery();
                Console.WriteLine("basarılı");
            }
            else
            {
                Console.WriteLine("basarısızzzzzz");
            }
            awsConnection.sqlConnection.Close();
        }
예제 #10
0
        //Ekleme,Güncelleme(sadece İschecked ),Getirme,Silme

        public void AddToDo(ToDo toDo)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlCommand komut  = new MySqlCommand();
                string       ekleme = "INSERT INTO daybook.ToDo(UId,IsChecked,Todo) VALUES('" + toDo.UId + "','" + toDo.IsChecked + "','" + toDo.toDo + "')";

                komut.Connection  = awsConnection.sqlConnection;
                komut.CommandText = ekleme;
                komut.ExecuteNonQuery();
                Console.WriteLine("başarılı");
            }
            else
            {
                Console.WriteLine("basarısızzzzzz");
            }
            awsConnection.sqlConnection.Close();
        }
예제 #11
0
파일: AwsNotes.cs 프로젝트: clkadem/Daybook
        public void UpdateNotes(Note note)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlCommand komut    = new MySqlCommand();
                string       güncelle = "UPDATE daybook.Notes SET Header='" + note.Header + "',Notes='" + note.Notes + "' WHERE UId='" + note.UId + "'";

                komut.Connection  = awsConnection.sqlConnection;
                komut.CommandText = güncelle;
                komut.ExecuteNonQuery();
                Console.WriteLine("basarılı");
            }
            else
            {
                Console.WriteLine("basarısızzzzzz");
            }
            awsConnection.sqlConnection.Close();
        }
예제 #12
0
파일: AwsNotes.cs 프로젝트: clkadem/Daybook
        public void AddNotes(Note note)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlCommand komut  = new MySqlCommand();
                string       ekleme = "INSERT INTO daybook.Notes(UId,Header,Notes) VALUES('" + note.UId + "','" + note.Header + "','" + note.Notes + "')";

                komut.Connection  = awsConnection.sqlConnection;
                komut.CommandText = ekleme;
                komut.ExecuteNonQuery();
                Console.WriteLine("başarılı");
            }
            else
            {
                Console.WriteLine("basarısızzzzzz");
            }
            awsConnection.sqlConnection.Close();
        }
예제 #13
0
        public void GetToDo(int UId)
        {
            AwsConnection awsConnection = new AwsConnection();

            awsConnection.sqlConnection.Open();
            if (awsConnection.sqlConnection.State != ConnectionState.Closed)
            {
                MySqlDataAdapter baglayici  = new MySqlDataAdapter();
                MySqlCommand     komut      = new MySqlCommand();
                string           sqlsorgusu = "SELECT * FROM daybook.ToDo Where UId='" + UId + "'";
                DataTable        tablo      = new DataTable();

                komut.CommandText       = sqlsorgusu;
                komut.Connection        = awsConnection.sqlConnection;
                baglayici.SelectCommand = komut;
                baglayici.Fill(tablo);
            }
            else
            {
                Console.WriteLine("basarısızzzzzz");
            }
            awsConnection.sqlConnection.Close();
        }