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 cbnDocumentID_SelectedIndexChanged(object sender, EventArgs e) { DropDownList cb = (DropDownList)sender; DocumentDetails docObj = null; ELibraryDocumentBL docBLObj = new ELibraryDocumentBL(); try { if (cb.SelectedIndex == -1) { throw new ELibraryException("Please select Document ID"); } docObj = docBLObj.GetDocumentByID(Convert.ToInt32(cb.SelectedValue)); if (docObj == null) { throw new ELibraryException("Document doesnt exist"); } txtDocumentName.Text = docObj.DocumentName; txtDescription.Text = docObj.DocumentDescription; txtTitle.Text = docObj.Title; txtAuthor.Text = docObj.Author; cboDocumentType.SelectedValue = docBLObj.GetDocumentTypeBL(docObj.DocumentTypeID).ToString(); cboDiscipline.SelectedValue = docBLObj.GetDisciplineNameBL(docObj.DisciplineID); txtPrice.Text = docObj.Price.ToString(); } catch (ELibraryException ex) { ErrorLogging erLog = new ErrorLogging(); erLog.LogError(ex.Message); ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
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); } }