private void EditProfile_Loaded(object sender, RoutedEventArgs e) { try { if (Application.Current.Properties["User_ID"] != null) { userObj.UserId = Application.Current.Properties["User_ID"].ToString(); var editObj = new User_detailsBLL(); var DetailsObj = editObj.FindbyID(userObj.UserId); txtFirstName.Text = DetailsObj.FirstName; txtLastName.Text = DetailsObj.LastName; dtpDateOfBirth.SelectedDate = DetailsObj.DateOfBirth; txtAddress.Text = DetailsObj.Address; txtLandlineNumber.Text = DetailsObj.LandLineNumber; txtMobileNumber.Text = DetailsObj.MobileNumber; var a = DetailsObj.AreaOfInterest; if (a.Contains("Engineering")) { chkEngineering.IsChecked = true; } if (a.Contains("Medical")) { chkMedical.IsChecked = true; } if (a.Contains("Law")) { chkLaw.IsChecked = true; } if (DetailsObj.Gender == "M") { rbtnMale.IsChecked = true; } else { rbtnFemale.IsChecked = true; } if (DetailsObj.UserType == "Subscriber") { rbtnSubscriber.IsChecked = true; } else { rbtnNonSubscriber.IsChecked = true; } } else { this.NavigationService.Navigate(new Uri("HomePage.xaml", UriKind.Relative)); } } catch (ELibException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnupdate_Click_1(object sender, RoutedEventArgs e) { User_details userObj = new User_details(); userObj.UserId = Application.Current.Properties["User_ID"].ToString(); userObj.FirstName = txtFirstName.Text; userObj.LastName = txtLastName.Text; userObj.DateOfBirth = Convert.ToDateTime(dtpDateOfBirth.Text); userObj.Address = txtAddress.Text; userObj.LandLineNumber = txtLandlineNumber.Text; userObj.MobileNumber = txtMobileNumber.Text; string strCheckValue = ""; if (chkEngineering.IsChecked == true) { strCheckValue = strCheckValue + "," + chkEngineering.Content; } if (chkMedical.IsChecked == true) { strCheckValue = strCheckValue + "," + chkMedical.Content; } if (chkLaw.IsChecked == true) { strCheckValue = strCheckValue + "," + chkLaw.Content; } userObj.AreaOfInterest = strCheckValue; if (rbtnMale.IsChecked == true) { userObj.Gender = "M"; } else if (rbtnFemale.IsChecked == true) { userObj.Gender = "F"; } if (rbtnSubscriber.IsChecked == true) { userObj.UserType = "Subscriber"; } else if (rbtnNonSubscriber.IsChecked == true) { userObj.UserType = "Non_subscriber"; } var userBLL = new User_detailsBLL(); var IsAddedUser = userBLL.UpdateUserDetails(userObj); if (IsAddedUser) { Application.Current.Properties["User_Name"] = userObj.FirstName + " " + userObj.LastName; MessageBox.Show("Updated!!!! "); } else { MessageBox.Show("Sorry!!!..Updation Failed.Try Again Later"); } }
private void btnSubmit_Click_1(object sender, RoutedEventArgs e) { var IsAdded = false; try { var subscriberBll = new User_detailsBLL(); if (ValidateCard()) { IsAdded = subscriberBll.Register(Obj); if (IsAdded) { MessageBox.Show("Thankyou Subscribing!You are a Subsciber"); } else { MessageBox.Show("Sorry,Subscription Failed"); } } else { Obj.UserType = "Non_subscriber"; IsAdded = subscriberBll.Register(Obj); if (IsAdded) { MessageBox.Show("You are a Non Subsciber"); this.Close(); } else { MessageBox.Show("Sorry,Subscription Failed"); } } } catch (ELibException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Event that Fires on Button Login Click and Directs to HomePage /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnLogin_Click(object sender, EventArgs e) { try { User_details userObj = new User_details(); userObj.UserId = txtUserID.Text; userObj.Password = txtPassword.Text; var userBLL = new User_detailsBLL(); var Obj = userBLL.LogIn(userObj); if (Obj.UserType == "Administrator") { Session["User_Type"] = Obj.UserType; Session["User_ID"] = userObj.UserId; Session["User_Name"] = Obj.FirstName + " " + Obj.LastName; Response.Redirect("DocumentUploadUpdate.aspx"); lblLoginMessage.Text = Obj.FirstName + " " + Obj.LastName + " is " + Obj.UserType; } else if (Obj.UserType == "Subscriber" || Obj.UserType == "Non_Subscriber") { Session["User_Type"] = Obj.UserType; Session["User_ID"] = userObj.UserId; Session["User_Name"] = Obj.FirstName + " " + Obj.LastName; Response.Redirect("HomePage.aspx"); lblLoginMessage.Text = Obj.FirstName + " " + Obj.LastName + " is " + Obj.UserType; } else { Response.Write("<script>alert('Please Enter Proper Credentials')</script>"); } } catch (FormatException ex) { Response.Write("<script>alert('" + ex.Message + "')</script>"); } catch (ELibException ex) { Response.Write("<script>alert('" + ex.Message + "')</script>"); } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "')</script>"); } }
private void btnLogin_Click(object sender, RoutedEventArgs e) { try { User_details userObj = new User_details(); userObj.UserId = txtuserid.Text; userObj.Password = txtpassword.Password; var userBLL = new User_detailsBLL(); var Obj = userBLL.LogIn(userObj); if (Obj.UserType == "Administrator") { Application.Current.Properties["User_Type"] = Obj.UserType; Application.Current.Properties["User_ID"] = userObj.UserId; Application.Current.Properties["User_Name"] = Obj.FirstName + " " + Obj.LastName; this.NavigationService.Navigate(new Uri("AdminPage.xaml", UriKind.Relative)); } else if (Obj.UserType == "Subscriber" || Obj.UserType == "Non_subscriber") { Application.Current.Properties["User_Type"] = Obj.UserType; Application.Current.Properties["User_ID"] = userObj.UserId; Application.Current.Properties["User_Name"] = Obj.FirstName + " " + Obj.LastName; this.NavigationService.Navigate(new Uri("HomePage.xaml", UriKind.Relative)); } else { MessageBox.Show("Enter Proper Credentials"); } } catch (FormatException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK); } catch (ELibException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK); } }
static string type; //Global Variable /// <summary> /// Event that Fires on Button Edit Details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEditDetails_Click(object sender, EventArgs e) { try { if (Session["User_ID"] != null) { User_details NewObj = new User_details(); NewObj.UserId = Session["User_ID"].ToString(); var editObj = new User_detailsBLL(); var DetailsObj = editObj.FindbyID(NewObj.UserId); txtFirstName.Text = DetailsObj.FirstName; txtLastName.Text = DetailsObj.LastName; txtDateOfBirth.Text = DetailsObj.DateOfBirth.ToString("yyyy-MM-dd"); txtAddress.Text = DetailsObj.Address; txtLandlineNumber.Text = DetailsObj.LandLineNumber; txtMobileNumber.Text = DetailsObj.MobileNumber; var a = DetailsObj.AreaOfInterest; chkAreaOfInterestList.DataBind(); //var b=chkAreaOfInterestList.Items; if (a.Contains("Engineering")) { chkAreaOfInterestList.Items[0].Selected = true; } if (a.Contains("Medical")) { chkAreaOfInterestList.Items[1].Selected = true; } if (a.Contains("Law")) { chkAreaOfInterestList.Items[2].Selected = true; } if (DetailsObj.Gender == "M") { rdoGenderGroup.Items[0].Selected = true; } else { rdoGenderGroup.Items[1].Selected = true; } if (DetailsObj.UserType == "Subscriber") { rdoUserTypeGroup.Items[0].Selected = true; type = "Subscriber"; } else { rdoUserTypeGroup.Items[1].Selected = true; type = "Non_Subscriber"; } } else { Response.Redirect("HomePage.aspx"); } } catch (ELibException ex) { Response.Write("<script>alert('" + ex.Message + "')</script>"); } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "')</script>"); } }
/// <summary> /// Event That Fires On Update Button Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdate_Click(object sender, EventArgs e) { try { User_details UpdteObj = new User_details(); UpdteObj.UserId = Session["User_ID"].ToString(); UpdteObj.FirstName = txtFirstName.Text; UpdteObj.LastName = txtLastName.Text; UpdteObj.DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text); UpdteObj.Address = txtAddress.Text; UpdteObj.LandLineNumber = txtLandlineNumber.Text; UpdteObj.MobileNumber = txtMobileNumber.Text; string strCheckValue = ""; for (int i = 0; i < chkAreaOfInterestList.Items.Count; i++) { if (chkAreaOfInterestList.Items[i].Selected) { strCheckValue += chkAreaOfInterestList.Items[i].Value + ","; } } strCheckValue = strCheckValue.TrimEnd(','); UpdteObj.AreaOfInterest = strCheckValue; UpdteObj.Gender = rdoGenderGroup.SelectedItem.Value.ToString(); UpdteObj.UserType = rdoUserTypeGroup.SelectedItem.Value.ToString(); if (UpdteObj.UserType == "Subscriber" && type == "Non_Subscriber") { Session["UpdteObj"] = UpdteObj; Response.Redirect("EditProfilePayment.aspx"); } //if(UpdteObj.UserType == "Non_Subscriber" && type == "Subscriber") else { var userBLL = new User_detailsBLL(); var IsAddedUser = userBLL.UpdateUserDetails(UpdteObj); if (IsAddedUser) { Session["User_Name"] = UpdteObj.FirstName + " " + UpdteObj.LastName; Response.Write("<script>alert('Details Updated')</script>"); // Response.Write("<script>alert('Updated!!!! ')</script>"); } else { // lblUpdateMessage.Text = "Sorry!!!..Updation Failed.Try Again Later"; Response.Write("<script>alert('Sorry!!!..Updation Failed.Try Again Later')</script>"); } //Session["userObj"] = UpdteObj; //Response.Redirect("SubscriberRegistrationPage.aspx"); } } catch (ELibException) { Response.Write("<script>alert('Please enter valid details.')</script>"); } catch (Exception) { Response.Write("<script>alert('Sorry! Try again later.')</script>"); } }
/// <summary> /// Event That Fires on Button Register Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnRegister_Click(object sender, EventArgs e) { try { User_details userObj = new User_details(); userObj.UserId = txtUserId.Text; userObj.FirstName = txtFirstName.Text; userObj.LastName = txtLastName.Text; userObj.DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text); userObj.Address = txtAddress.Text; userObj.LandLineNumber = txtLandlineNumber.Text; userObj.MobileNumber = txtMobileNumber.Text; string strCheckValue = ""; for (int i = 0; i < chkAreaOfInterestList.Items.Count; i++) { if (chkAreaOfInterestList.Items[i].Selected) { strCheckValue += chkAreaOfInterestList.Items[i].Value + ","; } } strCheckValue = strCheckValue.TrimEnd(','); userObj.AreaOfInterest = strCheckValue; userObj.Gender = rdoGenderGroup.SelectedItem.Value.ToString(); userObj.UserType = rdoUserTypeGroup.SelectedItem.Value.ToString(); userObj.DateOfRegistration = Convert.ToDateTime(txtDateOfRegistration.Text); userObj.Password = txtPassword.Text; if (userObj.UserType == "Subscriber") { Session["userObj"] = userObj; Response.Redirect("SubscriberRegistrationPage.aspx"); } else { var userBLL = new User_detailsBLL(); var IsAddedUser = userBLL.Register(userObj); if (IsAddedUser) { //lblRegistrationMessage.Text = "Registration Successful as " + userObj.UserType + "!!..Access Granted To documents!"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Registration Successful as" + userObj.UserType + "!!..Access Granted To documents!" + "');window.location='HomePage.aspx';", true); } else { Response.Write("<script>alert('Sorry!!!..Registration Failed.Try Again Later')</script>"); } } } catch (ELibException ex) { Response.Write("<script>alert('" + ex.Message + "')</script>"); } catch (Exception) { Response.Write("<script>alert('Please Check The Details')</script>"); } }
/// <summary> /// Event That Fires on Submit Button Click Which Registers as Subscriber or Else NoN_Subscriber /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { User_details Obj = (User_details)Session["userObj"]; var IsAdded = false; try { var subscriberBll = new User_detailsBLL(); if (ValidateCard()) { IsAdded = subscriberBll.Register(Obj); if (IsAdded) { // lblPaymentMessage.Text = "Thank you for Subscribing!You are a Subsciber"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Registration Successful as " + Obj.UserType + "!!..Access Granted To documents!" + "');window.location='HomePage.aspx';", true); //Response.Write("<script>alert('Thank you for Subscribing!You are a Subscriber')</script>"); //MessageBox.Show("Thankyou Subscribing!You are a Subsciber"); } else { // lblPaymentMessage.Text = "Sorry,Subscription Failed"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Sorry!! Subscription Failed ');window.location='HomePage.aspx';", true); // Response.Redirect("HomePage.aspx"); // Response.Write("<script>alert('Sorry,Subscription Failed')</script>"); // MessageBox.Show("Sorry,Subscription Failed"); } } else { Obj.UserType = "Non_Subscriber"; IsAdded = subscriberBll.Register(Obj); if (IsAdded) { // lblPaymentMessage.Text = "You are a Non Subsciber"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('You are a Non-Subscriber');window.location='HomePage.aspx';", true); //Response.Redirect("HomePage.aspx"); // Response.Write("<script>alert('You are a Non Subsciber')</script>"); //MessageBox.Show("You are a Non Subsciber"); } else { // lblPaymentMessage.Text = "Sorry,Subscription Failed"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Sorry!! Subscription Failed ');window.location='HomePage.aspx';", true); // Response.Redirect("HomePage.aspx"); // Response.Write("<script>alert('Sorry,Subscription Failed')</script>"); //MessageBox.Show("Sorry,Subscription Failed"); } } // Response.Redirect("HomePage.aspx"); } catch (ELibException) { Response.Write("<script>alert('Please check the details')</script>"); //MessageBox.Show(ex.Message); } catch (Exception) { Response.Write("<script>alert('Sorry!Try again later')</script>"); //MessageBox.Show(ex.Message); } }
private void btnRegister_Click(object sender, RoutedEventArgs e) { try { User_details userObj = new User_details(); userObj.UserId = txtUserId.Text; userObj.FirstName = txtFirstName.Text; userObj.LastName = txtLastName.Text; userObj.DateOfBirth = Convert.ToDateTime(dtpDateOfBirth.Text); userObj.Address = txtAddress.Text; userObj.LandLineNumber = txtLandlineNumber.Text; userObj.MobileNumber = txtMobileNumber.Text; string strCheckValue = ""; if (chkEngineering.IsChecked == true) { strCheckValue = strCheckValue + "," + chkEngineering.Content; } if (chkMedical.IsChecked == true) { strCheckValue = strCheckValue + "," + chkMedical.Content; } if (chkLaw.IsChecked == true) { strCheckValue = strCheckValue + "," + chkLaw.Content; } userObj.AreaOfInterest = strCheckValue; if (rbtnMale.IsChecked == true) { userObj.Gender = "M"; } else if (rbtnFemale.IsChecked == true) { userObj.Gender = "F"; } if (rbtnSubscriber.IsChecked == true) { userObj.UserType = "Subscriber"; } else if (rbtnNonSubscriber.IsChecked == true) { userObj.UserType = "Non_subscriber"; } userObj.DateOfRegistration = Convert.ToDateTime(dtpDateOfRegistration.Text); userObj.Password = txtPassword.Password; //if Subscriber redirect to payment Window if (userObj.UserType == "Subscriber") { var PaymentObj = new PaymentWindow(userObj); PaymentObj.Show(); // PaymentObj.Close(); // if(PaymentObj.DialogResult.Value==) this.NavigationService.Navigate(new Uri("HomePage.xaml", UriKind.Relative)); } else { var userBLL = new User_detailsBLL(); var IsAddedUser = userBLL.Register(userObj); if (IsAddedUser) { MessageBox.Show("Registration Successful as " + userObj.UserType + "!!..Access Granted To documents!"); } else { MessageBox.Show("Sorry!!!..Registration Failed.Try Again Later"); } } } catch (ELibException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK); } }