Example #1
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            LoginValidation lv = new LoginValidation();

            //object res= lv.Validate_Login(Mobile_Email.Text, Password.Password);
            object res = lv.Validate_Login("7567731118", "xyz");

            //object res = lv.Validate_Login("*****@*****.**", "xyz");
            //object res = lv.Validate_Login("*****@*****.**", "xyz");
            //var localsettings = ApplicationData.Current.LocalSettings;

            //ApplicationDataCompositeValue composite = new ApplicationDataCompositeValue();
            //composite["intVal"] = 1;
            //composite["strVal"] = "string";
            if (res == null)
            {
                tblError.Text = "Incorrect Email/Mobile or Password";
            }
            else
            {
                Custom result = (Custom)res;
                //Custom result = lv.Validate_Login("7567731118", "xyz");
                //Custom result = lv.Validate_Login("8827916189", "As1234_kjk");
                //Custom result = lv.Validate_Login("4567877898", "xyz");

                if (result.type == "volunteer")
                {
                    Volunteer volunteer = JsonConvert.DeserializeObject <Volunteer>(result.obj.ToString());
                    App.volunteer = volunteer;
                    //composite["Volunteer_Id"] = volunteer.Volunteer_Id;
                    //composite["Password"] = volunteer.Password;
                    //composite["NGO_Id"] = volunteer.NGO_Id;
                    //composite["Mobile_Number"] = volunteer.Mobile_Number;
                    //composite["Mobile_Alternate"] = volunteer.Mobile_Alternate;
                    //composite["F_Name"] = volunteer.F_Name;
                    //composite["L_Name"] = volunteer.L_Name;
                    //composite["Email"] = volunteer.Email;
                    //composite["Close"] = volunteer.Close;
                    //composite["Area_Id"] = volunteer.Area_Id;
                    //composite["Address_Line_2"] = volunteer.Address_Line_2;
                    //composite["Address_Line_1"] = volunteer.Address_Line_1;
                    //composite["Account_Status"] = volunteer.Account_Status;

                    //localsettings.Values["Volunteer_Session"] = composite;

                    this.Frame.Navigate(typeof(VolunteerHome));
                }
                else if (result.type == "user")
                {
                    User user = JsonConvert.DeserializeObject <User>(result.obj.ToString());
                    App.user = user;
                    //composite["User_Id"] = user.User_Id;
                    //composite["Password"] = user.Password;
                    //composite["Mobile_Number"] = user.Mobile_Number;
                    //composite["Mobile_Alternate"] = user.Mobile_Alternate;
                    //composite["F_Name"] = user.F_Name;
                    //composite["L_Name"] = user.L_Name;
                    //composite["Email"] = user.Email;
                    //composite["Close"] = user.Close;
                    //composite["Area_Id"] = user.Area_Id;
                    //composite["Address_Line_2"] = user.Address_Line_2;
                    //composite["Address_Line_1"] = user.Address_Line_1;
                    //composite["Account_Status"] = user.Account_Status;

                    //localsettings.Values["User_Session"] = composite;

                    this.Frame.Navigate(typeof(UserHome));
                }
                else if (result.type == "driver")
                {
                    Driver driver = JsonConvert.DeserializeObject <Driver>(result.obj.ToString());
                    App.driver = driver;
                    //composite["Driver_Id"] = driver.Driver_Id;
                    //composite["Password"] = driver.Password;
                    //composite["Mobile_Number"] = driver.Mobile_Number;
                    //composite["Mobile_Alternate"] = driver.Mobile_Alternate;
                    //composite["F_Name"] = driver.F_Name;
                    //composite["L_Name"] = driver.L_Name;
                    //composite["Email"] = driver.Email;
                    //composite["Close"] = driver.Close;
                    //composite["Area_Id"] = driver.Area_Id;
                    //composite["Address_Line_2"] = driver.Address_Line_2;
                    //composite["Address_Line_1"] = driver.Address_Line_1;
                    //composite["Account_Status"] = driver.Account_Status;

                    //localsettings.Values["Driver_Session"] = composite;

                    this.Frame.Navigate(typeof(DriverHome));
                }
            }
        }