private void InitializeCombo() { ELibraryDocumentBL docBL = new ELibraryDocumentBL(); ELibraryPurchasedBL purchaseBL = new ELibraryPurchasedBL(); ELibraryUserBL userBL = new ELibraryUserBL(); //lblRegUsers.Content = userBL.GetRegisteredUserCountBL().ToString() + " Registered Users!!"; //lblSubUsers.Content = userBL.GetSubscribedUserCountBL().ToString() + " Subscribed Users!!"; // lblSoldDocs.Content = purchaseBL.GetPurchasedCountBL().ToString() + " Documents Sold!!"; cboDiscipline.Items.Clear(); cboDocumentType.Items.Clear(); //cbDocTypeUpd.Items.Clear(); cbnDocumentID.Items.Clear(); foreach (Disciplines disc in docBL.GetAllDisciplinesBL()) { cboDiscipline.Items.Add(disc.DisciplineName.ToString()); } foreach (DocumentTypeDetails docType in docBL.GetAllDocumentTypesBL()) { cboDocumentType.Items.Add(docType.DocumentTypeName.ToString()); } if (docBL.GetAllDocumentIDBL() != null) { foreach (int i in docBL.GetAllDocumentIDBL()) { cbnDocumentID.Items.Add(Convert.ToString(i)); } } }
protected void btnLogin_Click(object sender, EventArgs e) { string userId = txtUserID.Text; string password = txtPassword.Text; try { UserDetails userObj; ELibraryUserBL userBL = new ELibraryUserBL(); userObj = userBL.UserLoginBL(userId, password); if (userObj != null) { Session["UserObj"] = userObj; if (userObj.UserType == "Admin") { Response.Redirect("AdminHomePage.aspx"); } else { Response.Redirect("UserMain.aspx"); } } else { lblStatus.Text = "Incorrect UserId/Password"; throw new ELibraryException("Invalid login"); } } catch (ELibraryException ex) { lblStatus.Text = ex.Message; ErrorLogging erLog = new ErrorLogging(); erLog.LogError(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserObj"] == null) { Response.Redirect("Home.aspx"); } if (!IsPostBack) { try { UserDetails user = (UserDetails)Session["UserObj"]; lblWelcome.Text = "Welcome " + user.FirstName + " " + user.LastName; ELibraryDocumentBL docBL = new ELibraryDocumentBL(); ELibraryPurchasedBL purchaseBL = new ELibraryPurchasedBL(); ELibraryUserBL userBL = new ELibraryUserBL(); lblReg.Text = userBL.GetRegisteredUserCountBL().ToString() + " Registered Users!!"; lblSub.Text = userBL.GetSubscribedUserCountBL().ToString() + " Subscribed Users!!"; lblSold.Text = purchaseBL.GetPurchasedCountBL().ToString() + " Documents Sold!!"; } catch (Exception ex) { ErrorLogging erLog = new ErrorLogging(); erLog.LogError(ex.Message); } } }
public void Button1_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); ELibraryUserBL bllobj = new ELibraryUserBL(); UserDetails userUpdateObj = new UserDetails(); ELibraryDocumentBL docBl = new ELibraryDocumentBL(); UserDetails userobj = (UserDetails)Session["UserObj"]; userUpdateObj.UserID = userobj.UserID; userUpdateObj.Pasword = txtpwd.Text; userUpdateObj.FirstName = txtfirstname.Text; userUpdateObj.LastName = txtlastname.Text; userUpdateObj.LandLineNumber = txtlandnum.Text; userUpdateObj.MobileNumber = txtmblnum.Text; userUpdateObj.UserAddress = txtadress.Text; for (int i = 0; i < chklAreasofInterest.Items.Count; i++) { if (chklAreasofInterest.Items[i].Selected) { int j = 0; j = i + 1; var name = docBl.GetDisciplineNameBL(j); sb.Append(name + ","); } userUpdateObj.AreaOfInterest = sb.ToString(); //userUpdateObj.AreaOfInterest = chklAreasofInterest.SelectedValue.ToString(); bool isUpdated = bllobj.UpdateDetailsUserBL(userUpdateObj); if (isUpdated) { lblupdatestatus.Text = "Successfully Updated"; Session["UserObj"] = userUpdateObj; } else { lblupdatestatus.Text = "Not Updated Properly"; } } }
protected void btnRegister_Click(object sender, EventArgs e) { ELibraryDocumentBL docBL = new ELibraryDocumentBL(); UserDetails userObj = new UserDetails(); StringBuilder sb = new StringBuilder(); try { userObj.UserID = txtUserId.Text; Session["UserId"] = userObj.UserID; userObj.FirstName = txtFirstName.Text; userObj.LastName = txtLastName.Text; DateTime dob; bool isValidDate = DateTime.TryParse(txtDateOfBirth.Text, out dob); if (isValidDate) { userObj.DateOfBirth = dob; } else { throw new ELibraryException("Please enter date of birth"); } if (rblGender.SelectedValue == "Male") { userObj.Gender = "M"; } else { userObj.Gender = "F"; } userObj.UserAddress = txtAddress.Text; userObj.LandLineNumber = txtLandlineNumber.Text; userObj.MobileNumber = txtboxMobileNumber.Text; userObj.Pasword = txtPassword.Text; for (int i = 0; i < chklAreasofInterest.Items.Count; i++) { if (chklAreasofInterest.Items[i].Selected) { int j = 0; j = i + 1; var name = docBL.GetDisciplineNameBL(j); sb.Append(name + ","); } } int itemsSelected = 0; foreach (ListItem li in chklAreasofInterest.Items) { if (li.Selected) { itemsSelected = itemsSelected + 1; } } if (itemsSelected == 0) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please select atleast one checkbox')", true); //Response.Write("<script>alert('Please select atleast one checkbox')</script>"); } userObj.AreaOfInterest = sb.ToString(); userObj.DateOfRegistration = DateTime.Now; userObj.UserType = "Non Scubscriber"; ELibraryUserBL userBL = new ELibraryUserBL(); bool isAdded = userBL.RegisterBL(userObj); if (isAdded) { lblException.Text = "Registered"; } if (chksubscribe.Checked == true) { Session["Amount"] = 1000; Session["Subscribe"] = true; PaymentForm payForm = new PaymentForm(); Response.Redirect("PaymentForm.aspx"); } } catch (ELibraryException ex) { ErrorLogging erLog = new ErrorLogging(); erLog.LogError(ex.Message); ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
protected void btnpay_Click(object sender, EventArgs e) { PaymentDetails paymentObj = new PaymentDetails(); UserDetails userObj = new UserDetails(); userObj.UserID = Session["UserId"].ToString(); try { paymentObj.CreditCardNumber = txtcreditcard.Text; paymentObj.CreditCardName = txtname.Text; paymentObj.CVV = txtcvv.Text; if (ddlexpmonth.SelectedValue == null) { throw new ELibraryException("enter valid month"); } paymentObj.ExpiryMonth = Convert.ToInt32(ddlexpmonth.SelectedValue); int year; bool isYear = int.TryParse(txtexpyear.Text, out year); if (!isYear) { throw new ELibraryException("Enter Valid Year"); } paymentObj.ExpiryYear = year; ELibraryUserBL userBL = new ELibraryUserBL(); ELibraryPaymentBL payBLObj = new ELibraryPaymentBL(); ELibraryDocumentBL docBLObj = new ELibraryDocumentBL(); if (payBLObj.VerifyPaymentBL(paymentObj)) { if ((bool)Session["Subscribe"]) { userBL.UpdateUserSubscriptionBL(userObj, paymentObj); userObj.UserType = "Subscriber"; if (Session["UserObj"] != null) { UserDetails user = (UserDetails)Session["UserObj"]; user.UserType = "Subscriber"; Session["UserObj"] = user; } } ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Payment successful\nPurchased documents will be in downloads.\nHappy Reading!!')", true); } List <int> docIDList = null; if (Session["DocList"] != null) { docIDList = (List <int>)Session["DocList"]; } if (docIDList != null) { ELibraryPurchasedBL purchaseBL = new ELibraryPurchasedBL(); foreach (int doc in docIDList) { PurchasedDetails purchase = new PurchasedDetails(); purchase.DocumentID = doc; purchase.UserID = userObj.UserID; purchase.PurchasedDate = DateTime.Today; purchaseBL.PurchaseDocumentBL(purchase); } Response.Redirect("Download.aspx"); } else { Response.Redirect("Home.aspx"); } } catch (ELibraryException ex) { ErrorLogging erLog = new ErrorLogging(); erLog.LogError(ex.Message); ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + ex.Message + "')", true); } }