예제 #1
0
        //Log-in process and validation email is clear
        public void GetAdmin(string email)
        {
            Query query = database.Collection("Users").WhereEqualTo("EMail", email);

            query.Get().AddOnCompleteListener(new QueryListener((task) =>
            {
                if (task.IsSuccessful)
                {
                    var snapshot = (QuerySnapshot)task.Result;
                    if (!snapshot.IsEmpty)
                    {
                        var document = snapshot.Documents;
                        foreach (DocumentSnapshot item in document)
                        {
                            string adminemail    = item.GetString("EMail");
                            string adminName     = item.GetString("Name");
                            string adminphonenum = item.GetString("PhoneNum");
                            string adminsport    = item.GetString("Sport");
                            string profilepic    = item.GetString("Profile");
                            Admin1 a             = new Admin1(adminsport, adminName, adminphonenum, adminemail, profilepic);
                            MyStuff.PutToShared(a);
                        }
                    }
                }
                Intent i = new Intent(this, typeof(MainPageActivity));
                Toasty.Success(this, "Logged-In Successfully", 5, true).Show();
                StartActivity(i);
            }
                                                                ));
        }
예제 #2
0
        //builds calendarview
        public void OnSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth)
        {
            abc = 0;
            string txt = MyStuff.MakeDateString(year, month + 1, dayOfMonth);

            for (int i = 0; i < dates.Count; i++)
            {
                if (dates[i] == txt)
                {
                    abc++;
                }
            }
            int year1  = int.Parse(DateTime.Today.Year.ToString());
            int month1 = int.Parse(DateTime.Today.Month.ToString());
            int day1   = int.Parse(DateTime.Today.Day.ToString());

            if (txt == MyStuff.MakeDateString(year1, month1, day1))
            {
                MainPageTitleTV2.Text = $"You have {abc} trainings Today";
            }
            else
            {
                MainPageTitleTV2.Text = $"You have {abc} trainings on the {MyStuff.MakeDateString(year, month + 1, dayOfMonth)}";
            }
        }
예제 #3
0
        private void OnDateSet(object sender, DatePickerDialog.DateSetEventArgs e)
        {
            string txt;

            if (e.Date.Month < 10 && e.Date.Day < 10)
            {
                txt = string.Format("0{0}.0{1}.{2}", e.Date.Day, e.Date.Month, e.Date.Year);
            }
            else if (e.Date.Day < 10)
            {
                txt = string.Format("0{0}.{1}.{2}", e.Date.Day, e.Date.Month, e.Date.Year);
            }
            else if (e.Date.Month < 10)
            {
                txt = string.Format("{0}.0{1}.{2}", e.Date.Day, e.Date.Month, e.Date.Year);
            }
            else
            {
                txt = string.Format("{0}.{1}.{2}", e.Date.Day, e.Date.Month, e.Date.Year);
            }

            if (MyStuff.IsDateLegit(e.Date, this))
            {
                DateBtn.Text = txt;
            }
            else
            {
                Toasty.Config.Instance
                .TintIcon(true)
                .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf"));
                Toasty.Error(this, "InValid Date", 5, true).Show();
            }
        }
예제 #4
0
 //intents back to main page
 private void AddStudentExplenationETLayout_Click(object sender, EventArgs e)
 {
     AddStudentExplenationET.RequestFocus();
     MyStuff.showSoftKeyboard(this, AddStudentExplenationET);
     //@Tomer
     //https://gist.github.com/icalderond/742f98f2f8cda1fae1b0bc877df76bbc @Javier Pardo
 }
예제 #5
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     sp = this.GetSharedPreferences("details", FileCreationMode.Private);
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.AddTrainingLayout);
     admin = MyStuff.GetAdmin();
     BuildAddTrainingScreen();
 }
예제 #6
0
 //https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/graphics-and-animation
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.AddMeetingLayout);
     database = MyStuff.database;
     admin    = MyStuff.GetAdmin();
     GetGroups();
 }
예제 #7
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     sp = this.GetSharedPreferences("details", FileCreationMode.Private);
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.MainPageLayout);
     admin1   = MyStuff.GetAdmin();
     database = MyStuff.database;
     GetDates();
 }
예제 #8
0
        //Menu inflator
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.menuItem1:
            {
                Intent tryIntent = new Intent(this, typeof(AddGroupActivity));
                StartActivity(tryIntent);
                return(true);
            }

            case Resource.Id.menuItem2:
            {
                Intent tryIntent = new Intent(this, typeof(AddMeetingActivity));
                StartActivity(tryIntent);
                return(true);
            }

            case Resource.Id.menuItem3:
            {
                Intent tryIntent = new Intent(this, typeof(AddExerciseActivity));
                StartActivity(tryIntent);
                return(true);
            }

            case Resource.Id.menuItem4:
            {
                Intent tryIntent = new Intent(this, typeof(AddStudentActivity));
                StartActivity(tryIntent);
                return(true);
            }

            case Resource.Id.menuItem5:
            {
                Intent tryIntent = new Intent(this, typeof(BuildTrainingActivity));
                StartActivity(tryIntent);
                return(true);
            }

            case Resource.Id.menuItem6:
            {
                Intent tryIntent = new Intent(this, typeof(EditAdminActivity));
                StartActivity(tryIntent);
                return(true);
            }

            case Resource.Id.menuItem7:
            {
                MyStuff.RemoveFromShared();
                Intent intent3 = new Intent(this, typeof(RegisterActivity));
                StartActivity(intent3);
                return(true);
            }
            }
            return(base.OnOptionsItemSelected(item));
        }
예제 #9
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     Times = new List <int>();
     sp    = this.GetSharedPreferences("details", FileCreationMode.Private);
     base.OnCreate(savedInstanceState);
     this.SetContentView(Resource.Layout.BuildGroupLayout);
     database = Context.database;
     admin    = MyStuff.GetAdmin();
     GetExercises();
     // Create your application here
 }
예제 #10
0
        protected override void OnCreate(Bundle savedInstanceState)

        {
            sp = this.GetSharedPreferences("details", FileCreationMode.Private);
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.AddStudentsLayout);
            database = Context.database;
            admin    = MyStuff.GetAdmin();
            groups   = GetGroups();
            // Create your application here
        }
예제 #11
0
        //Building the AddStudent Screen
        private void AddStudentButton_Click(object sender, EventArgs e)
        {
            if (IsValidName(NameAddStudentET.Text) && MyStuff.isValidEmail(EmailAddStudentET.Text, this) && currGroup != "Choose Group")
            {
                if (Parent1NameAddStudentET.Text != "" && Parent2NameAddStudentET.Text != "")
                {
                    student = new Student(NameAddStudentET.Text, PhoneNumAddStudentET.Text, EmailAddStudentET.Text, Parent1NameAddStudentET.Text, Parent2NameAddStudentET.Text, AddStudentExplenationET.Text, currGroup);
                }
                if (Parent1NameAddStudentET.Text == "" && Parent2NameAddStudentET.Text != "")
                {
                    student = new Student(NameAddStudentET.Text, PhoneNumAddStudentET.Text, EmailAddStudentET.Text, Parent2NameAddStudentET.Text, AddStudentExplenationET.Text, currGroup);
                }
                if (Parent1NameAddStudentET.Text != "" && Parent2NameAddStudentET.Text == "")
                {
                    student = new Student(NameAddStudentET.Text, PhoneNumAddStudentET.Text, EmailAddStudentET.Text, Parent1NameAddStudentET.Text, AddStudentExplenationET.Text, currGroup);
                }
                if (Parent1NameAddStudentET.Text == "" && Parent2NameAddStudentET.Text == "")
                {
                    student = new Student(NameAddStudentET.Text, PhoneNumAddStudentET.Text, EmailAddStudentET.Text, AddStudentExplenationET.Text, currGroup);
                }

                HashMap map = new HashMap();
                map.Put("Name", student.name);
                map.Put("PhoneNum", student.phoneNumber);
                map.Put("Email", student.email);
                map.Put("Parent1", student.parentName1);
                map.Put("Parent2", student.parentName2);
                map.Put("Notes", student.notes);
                map.Put("Group", student.group);
                DocumentReference docref = database.Collection("Users").Document(admin.email).Collection("Students").Document(student.name + " " + student.phoneNumber);
                docref.Set(map);
                Toasty.Config.Instance
                .TintIcon(true)
                .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf"));
                Toasty.Success(this, "Student Added Sucesfully", 5, true).Show();
                NameAddStudentET.Text        = "";
                PhoneNumAddStudentET.Text    = "05";
                EmailAddStudentET.Text       = "";
                Parent1NameAddStudentET.Text = "";
                Parent2NameAddStudentET.Text = "";
                AddStudentExplenationET.Text = "";
                spin.SetSelection(0);
            }
            else
            {
                Toasty.Config.Instance
                .TintIcon(true)
                .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf"));
                Toasty.Error(this, "Input InValid", 5, true).Show();
            }
        }
예제 #12
0
        //Drag Events
        public void BuildDialog()
        {
            //Dialog
            DurationDialog = new Dialog(this);
            DurationDialog.SetCancelable(false);
            DurationDialog.SetContentView(Resource.Layout.MyDialog);
            LinearLayout DurationDialogLayout = DurationDialog.FindViewById <LinearLayout>(Resource.Id.AbcDEF);

            DurationDialogLayout.Orientation = Orientation.Vertical;
            DurationDialogLayout.SetGravity(GravityFlags.Center);
            //Text view
            TextView DurationDialogTV = new TextView(this);

            DurationDialogTV.LayoutParameters = vlp;
            DurationDialogTV.Text             = "Duration: ";
            DurationDialogTV.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            DurationDialogTV.TextSize         = 30;
            //Edit text
            DurationDialogET = new TextInputEditText(this);
            DurationDialogET.SetBackgroundResource(Resource.Drawable.MyBackground);
            DurationDialogET.Hint             = "Duration";
            DurationDialogET.LayoutParameters = vlp;
            DurationDialogET.TextSize         = 30;
            DurationDialogET.InputType        = InputTypes.ClassPhone;
            //Input Layout
            LinearLayout DialogInputLayout = new LinearLayout(this);

            DialogInputLayout.LayoutParameters = vOneTwentyParams;
            DialogInputLayout.Orientation      = Orientation.Horizontal;
            //addind to layout
            DialogInputLayout.AddView(DurationDialogTV);
            DialogInputLayout.AddView(DurationDialogET);
            //Linear Layout
            DurationDialogLayout.AddView(DialogInputLayout);
            //button
            MyButton DialogMyButton = new MyButton(this);

            DialogMyButton.LayoutParameters = vlp;
            DialogMyButton.Text             = "Add";
            DialogMyButton.TextSize         = 30;
            DialogMyButton.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            DialogMyButton.Click           += this.DialogMyButton_Click;
            DurationDialogLayout.AddView(DialogMyButton);
            DurationDialog.Show();
            MyStuff.showSoftKeyboard(this, DurationDialogET);
        }
예제 #13
0
        //This is called after camera took a picture
        private void LoginButton1_Click(object sender, System.EventArgs e)
        {
            ButtonLoginLayout1.RequestFocus();
            string mail = MailLoginET1.Text;

            if (MyStuff.isValidEmail(mail, this))
            {
                if (MyStuff.Emails.Contains(mail))
                {
                    GetAdmin(mail);
                }
                else
                {
                    Toasty.Error(this, "Email Not Found", 5, true);
                    MailLoginET1.Text = "";
                }
            }
        }
예제 #14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            sp = this.GetSharedPreferences("details2", FileCreationMode.Private);
            var editor = sp.Edit();

            base.OnCreate(savedInstanceState);
            database = GetDataBase();
            MyStuff.DefineShared(sp);
            MyStuff.DefineDatabase(database);
            if (sp.GetString("Name", "noname") != "noname")
            {
                Intent intent = new Intent(this, typeof(MainPageActivity));
                StartActivity(intent);
            }
            else
            {
                Intent intent = new Intent(this, typeof(RegisterActivity));
                StartActivity(intent);
            }
        }
예제 #15
0
 //Building Register Screen
 private void LoginButton_Click(object sender, System.EventArgs e)
 {
     if (!MyStuff.Emails.Contains(MailLoginET.Text))
     {
         //validation of input
         if (MyStuff.IsValidName(NameLoginET.Text, NameLoginET, this) && MyStuff.IsValidSport(SportLoginET.Text, this) & MyStuff.isValidEmail(MailLoginET.Text, this) && PhoneNumberLoginET.Text.Length == 10 && PhoneNumberLoginET.Text.ToString().All(c => Char.IsLetterOrDigit(c)))
         {
             string image = "";
             try { image = MyStuff.ConvertBitMapToString(BitProfilePic); }
             catch { };
             Toasty.Config.Instance
             .TintIcon(true)
             .SetToastTypeface(Typeface.CreateFromAsset(Assets, "Katanf.ttf"));
             admin = new Admin1(SportLoginET.Text, NameLoginET.Text, PhoneNumberLoginET.Text, MailLoginET.Text, image);
             HashMap map = new HashMap();
             map.Put("Name", admin.name);
             map.Put("EMail", admin.email);
             map.Put("PhoneNum", admin.phoneNumber);
             map.Put("Sport", admin.sport);
             map.Put("Profile", admin.ProfilePic);
             DocumentReference DocRef = database.Collection("Users").Document(admin.email);
             DocRef.Set(map);
             MyStuff.PutToShared(admin);
             Intent intent1 = new Intent(this, typeof(MainPageActivity));
             Toasty.Success(this, "Edited successfully", 5, true).Show();
             //
             SmsManager sm = SmsManager.Default;
             sm.SendTextMessage(PhoneNumberLoginET.Text /*מספר טלפון*/, null, "Welcome to T-POV, " + NameLoginET.Text + "!" /*תכולה*/, null, null);
             //
             StartActivity(intent1);
         }
     }
     else
     {
         Toasty.Error(this, "Email Already In Database", 5, true).Show();
         MailLoginET.Text = "";
     }
 }
예제 #16
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     sp           = this.GetSharedPreferences("details", FileCreationMode.Private);
     CheckBoxList = new List <CheckBox>();
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.AddGroupLayout);
     database = MyStuff.database;
     admin    = MyStuff.GetAdmin();
     times    = new List <string>();
     for (int i = 1; i <= 7; i++)
     {
         times.Add(i + "");
     }
     days = new List <string>();
     days.Add("Sunday");
     days.Add("Monday");
     days.Add("Tuesday");
     days.Add("Wednsday");
     days.Add("Thursday");
     days.Add("Friday");
     days.Add("Saturday");
     BuildAddGroupScreen();
     // Create your application here
 }
예제 #17
0
        //Retrives the Groups from database
        public void GetDates()
        {
            dates = new List <string>();
            Query query = database.Collection("Users").Document(admin1.email).Collection("Meetings");

            query.Get().AddOnCompleteListener(new QueryListener((task) =>
            {
                if (task.IsSuccessful)
                {
                    var snapshot = (QuerySnapshot)task.Result;
                    if (!snapshot.IsEmpty)
                    {
                        var document = snapshot.Documents;
                        foreach (DocumentSnapshot item in document)
                        {
                            try
                            {
                                string day   = (item.GetString("Date").ToString())[0] + "" + (item.GetString("Date").ToString())[1];
                                string month = (item.GetString("Date").ToString())[3] + "" + (item.GetString("Date").ToString())[4];
                                string year  = (item.GetString("Date").ToString())[6] + "" + (item.GetString("Date").ToString())[7] + "" + (item.GetString("Date").ToString())[8] + "" + (item.GetString("Date").ToString())[9];
                                int inday    = int.Parse(day);
                                int inmonth  = int.Parse(month);
                                int inyear   = int.Parse(year);
                                dates.Add(MyStuff.MakeDateString(inyear, inmonth, inday));
                            }
                            catch
                            {
                                Toasty.Normal(this, "Empty", 5).Show();
                            }
                        }
                    }
                }
                BuildMainPage();
            }
                                                                ));
        }
예제 #18
0
        public void BuildMainPage()
        {
            //Main Page Overall Layout defining
            MainPageOverallLayout             = FindViewById <LinearLayout>(Resource.Id.MainPageLayout1);
            MainPageOverallLayout.Orientation = Orientation.Vertical;
            MainPageOverallLayout.SetGravity(Android.Views.GravityFlags.CenterHorizontal);
            BuildCalendar();
            //Tile layout
            MainPageTitleLayout = new LinearLayout(this);
            MainPageTitleLayout.LayoutParameters = WrapContParams;
            MainPageTitleLayout.Orientation      = Orientation.Vertical;
            MainPageTitleLayout.SetGravity(Android.Views.GravityFlags.Center);
            //Title TV
            MainPageTitleTV = new TextView(this);
            MainPageTitleTV.LayoutParameters = WrapContParams;
            MainPageTitleTV.Text             = $"Welcome, {admin1.name}";
            MainPageTitleTV.TextSize         = 55;
            MainPageTitleTV.Typeface         = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            MainPageTitleTV.SetTextColor(Android.Graphics.Color.DarkRed);
            //Profile Picture Layout
            MainPageProfilePictureLayout = new LinearLayout(this);
            MainPageProfilePictureLayout.LayoutParameters = WrapContParams;
            MainPageProfilePictureLayout.Orientation      = Orientation.Horizontal;
            MainPageProfilePictureLayout.SetGravity(Android.Views.GravityFlags.Center);
            //Profile Pic
            Profile = new ImageView(this);
            Profile.SetImageBitmap(MyStuff.ConvertStringToBitMap(admin1.ProfilePic));
            Profile.SetMaxWidth(250);
            Profile.SetMinimumHeight(400);
            Profile.Click += this.Profile_Click;
            MainPageProfilePictureLayout.AddView(Profile);
            //
            Swi = new Switch(this);
            Swi.SetHeight(15);
            Swi.SetWidth(70);
            Swi.Checked        = false;
            Swi.TextOff        = "Off";
            Swi.TextOn         = "On";
            Swi.CheckedChange += this.Swi_CheckedChange;
            MainPageProfilePictureLayout.AddView(Swi);
            //
            //Title TV 2
            MainPageTitleTV2 = new TextView(this);
            MainPageTitleTV2.LayoutParameters = WrapContParams;
            int year  = int.Parse(DateTime.Today.Year.ToString());
            int month = int.Parse(DateTime.Today.Month.ToString()) + 1;
            int day   = int.Parse(DateTime.Today.Day.ToString());

            MainPageTitleTV2.Text     = $"You have {abc} trainings on the {MyStuff.MakeDateString(year, month, day)}";
            MainPageTitleTV2.TextSize = 25;
            MainPageTitleTV2.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf");
            MainPageTitleTV2.SetTextColor(Color.SaddleBrown);
            //adding to layouts
            MainPageTitleLayout.AddView(MainPageTitleTV);
            MainPageOverallLayout.AddView(MainPageProfilePictureLayout);
            MainPageTitleLayout.AddView(MainPageTitleTV2);
            MainPageOverallLayout.AddView(MainPageTitleLayout);
            //Calendar
            MainPageOverallLayout.AddView(calendar);
            OnSelectedDayChange(calendar, int.Parse(DateTime.Today.Year.ToString()), int.Parse(DateTime.Today.Month.ToString()) - 1, int.Parse(DateTime.Today.Day.ToString()));
            //Button
            MainPageShowGroupsbtn = new Button(this);
            MainPageShowGroupsbtn.LayoutParameters = new LinearLayout.LayoutParams(500, 250);
            MainPageShowGroupsbtn.Text             = "Show Groups";
            MainPageOverallLayout.AddView(MainPageShowGroupsbtn);
            MainPageShowGroupsbtn.Click += this.MainPageShowGroupsbtn_Click;
        }