private void EncryptAndStoreKey(byte[] key, byte[] iv) { byte[] enckey = myRSA.Encrypt(key, true); byte[] enciv = myRSA.Encrypt(iv, true); ElectronicAppSecurityDBDataContext secdb = new ElectronicAppSecurityDBDataContext(); secdb.uspInsertAttachmentData(Guid.NewGuid(), SubmissionID, enckey, iv); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { ElectronicAppDBDataContext ElectronicAppDB = new ElectronicAppDBDataContext(); ElectronicAppSecurityDBDataContext ElectronicAppSecurityDB = new ElectronicAppSecurityDBDataContext(); List<uspLoginWebuserResult> Loginresult = null; Loginresult = ElectronicAppSecurityDB.uspLoginWebuser(txtUserName.Text, txtPassword.Text).ToList<uspLoginWebuserResult>(); if (Loginresult.Count <= 0) { List<uspLoginBrokeruserResult> brokerresult = null; brokerresult = ElectronicAppSecurityDB.uspLoginBrokeruser(txtUserName.Text, txtPassword.Text).ToList<uspLoginBrokeruserResult>(); if (brokerresult.Count > 0) { Guid brokerID = brokerresult[0].associatedWith; Session.Add("BrokerID", brokerID); FormsAuthentication.RedirectFromLoginPage("txtUserName.Text", false); } else { Response.Redirect("~/Default.aspx?InvalidLogin=1", true); } } else { try { Guid myClientID = Loginresult[0].AssociatedWith; uspGetClientByIDResult myClient = ElectronicAppDB.uspGetClientByID(myClientID).Single<uspGetClientByIDResult>(); uspGetClientCoverageOptionsResult myCoverageOptions = ElectronicAppDB.uspGetClientCoverageOptions(myClientID).Single<uspGetClientCoverageOptionsResult>(); List<uspGetClientPlanOptionsResult> myPlanOptions = ElectronicAppDB.uspGetClientPlanOptions(myClientID).ToList<uspGetClientPlanOptionsResult>(); string[] myPlans = new string[myPlanOptions.Count]; int i = 0; foreach (uspGetClientPlanOptionsResult po in myPlanOptions) { myPlans[i] = po.PlanName; i = i+1; } coverageOffered myCoverageOffered = new coverageOffered(myPlans, myCoverageOptions.Medical, myCoverageOptions.Dental, myCoverageOptions.Vision, myCoverageOptions.Life, myCoverageOptions.Disability); Session.Add("CoverageOffered", myCoverageOffered); Session.Add("UserID", Guid.NewGuid()); Session.Add("ClientID", myClientID); //Response.Redirect("~/Welcome.aspx", false); FormsAuthentication.RedirectFromLoginPage("txtUserName.Text", false); } catch( Exception ex ) { Console.WriteLine(ex.Message); Console.WriteLine(ex.InnerException); Response.Redirect("~/Default.aspx?Exception=1", true); } } }
private void EncryptAndStoreKey(byte[] key, byte[] iv) { byte[] enckey = myRSA.Encrypt(key, true); byte[] enciv = myRSA.Encrypt(iv, true); ElectronicAppSecurityDBDataContext secdb = new ElectronicAppSecurityDBDataContext(); secdb.uspInsertAttachmentData(Guid.NewGuid(), SubmissionID, enckey, iv); }
protected void btnAdd_Click(object sender, EventArgs e) { ElectronicAppDBDataContext eappdb = new ElectronicAppDBDataContext(); ElectronicAppSecurityDBDataContext eappsec = new ElectronicAppSecurityDBDataContext(); int countErrors = 0; //Check password length and equality. if (!txtPassword.Text.Equals(txtPassword2.Text) || txtPassword.Text.Length < 4 || txtLogin.Text.Equals("")) { lblErrorCredentials.Visible = true; lblErrorCredentials.Text = "Username or password is invalid, or passwords do not match."; countErrors++; } else { lblErrorCredentials.Visible = false; } if (eappsec.uspCheckUsername(txtLogin.Text).ToList <uspCheckUsernameResult>().Count > 0) { lblErrorTaken.Visible = true; lblErrorTaken.Text = "Please choose a different username, the one you provided is in use."; countErrors++; } else { lblErrorTaken.Visible = false; } //Check calendar range. if (!(calBeginPeriod.SelectedDate.CompareTo(calEndPeriod.SelectedDate) < 0)) { lblErrorCals.Visible = true; lblErrorCals.Text = "The enrollment period must be a vaild date range."; countErrors++; } else { lblErrorCals.Visible = false; } //Check carrier list for null. if (lstSel.Items.Count <= 0) { lblErrorCarriers.Visible = true; lblErrorCarriers.Text = "Please select at least one, and as many as six carriers."; countErrors++; } else { lblErrorCarriers.Visible = false; } //Check coverage requirements. if (!chkDental.Checked && !chkDisability.Checked && !chkLife.Checked && !chkMedical.Checked && !chkVision.Checked) { lblErrorCoverages.Visible = true; lblErrorCoverages.Text = "Please select at least one type of coverage."; countErrors++; } else { lblErrorCoverages.Visible = false; } //Check Contact Details if (txtAddress.Text.Equals("") || txtCity.Equals("") || txtFax.Equals("") || txtGroupName.Equals("") || txtPhone.Equals("") || txtState.Equals("") || txtZip.Equals("")) { lblErrorContactInfo.Visible = true; lblErrorContactInfo.Text = "Please fill in the contact information."; countErrors++; } else { lblErrorContactInfo.Visible = false; } //Finally, submit if no fatal errors occured. if (countErrors == 0) { //Submit form, process. Guid myNewClient = System.Guid.NewGuid(); //Insert client record and contact. eappdb.uspInsertClient(myNewClient, (Guid)(Session["BrokerID"]), txtGroupName.Text, txtTaxID.Text); eappdb.uspInsertClientInfo(System.Guid.NewGuid(), myNewClient, txtPhone.Text, txtFax.Text, txtAddress.Text, txtCity.Text, txtState.Text, txtZip.Text); //Insert client coverage options eappdb.uspInsertClientOptions(System.Guid.NewGuid(), myNewClient, chkMedical.Checked, chkDental.Checked, chkLife.Checked, chkVision.Checked, chkDisability.Checked); //Insert client carriers foreach (ListItem li in lstSel.Items) { eappdb.uspInsertClientCarrier(System.Guid.NewGuid(), myNewClient, li.Text.ToUpper()); } //Add the web user eappsec.uspInsertWebUser(System.Guid.NewGuid(), myNewClient, txtLogin.Text, txtPassword.Text); //Redirect the user to the home page with query string. Response.Redirect("~/BrokerAdmin/Welcome.aspx", true); } }
protected void btnAdd_Click(object sender, EventArgs e) { ElectronicAppDBDataContext eappdb = new ElectronicAppDBDataContext(); ElectronicAppSecurityDBDataContext eappsec = new ElectronicAppSecurityDBDataContext(); int countErrors = 0; //Check password length and equality. if (!txtPassword.Text.Equals(txtPassword2.Text) || txtPassword.Text.Length < 4 || txtLogin.Text.Equals("")) { lblErrorCredentials.Visible = true; lblErrorCredentials.Text = "Username or password is invalid, or passwords do not match."; countErrors++; } else { lblErrorCredentials.Visible = false; } if (eappsec.uspCheckUsername(txtLogin.Text).ToList<uspCheckUsernameResult>().Count > 0) { lblErrorTaken.Visible = true; lblErrorTaken.Text = "Please choose a different username, the one you provided is in use."; countErrors++; } else { lblErrorTaken.Visible = false; } //Check calendar range. if (!(calBeginPeriod.SelectedDate.CompareTo(calEndPeriod.SelectedDate) < 0)) { lblErrorCals.Visible = true; lblErrorCals.Text = "The enrollment period must be a vaild date range."; countErrors++; } else { lblErrorCals.Visible = false; } //Check carrier list for null. if (lstSel.Items.Count <= 0) { lblErrorCarriers.Visible = true; lblErrorCarriers.Text = "Please select at least one, and as many as six carriers."; countErrors++; } else { lblErrorCarriers.Visible = false; } //Check coverage requirements. if (!chkDental.Checked && !chkDisability.Checked && !chkLife.Checked && !chkMedical.Checked && !chkVision.Checked) { lblErrorCoverages.Visible = true; lblErrorCoverages.Text = "Please select at least one type of coverage."; countErrors++; } else { lblErrorCoverages.Visible = false; } //Check Contact Details if ( txtAddress.Text.Equals("") || txtCity.Equals("") || txtFax.Equals("") || txtGroupName.Equals("") || txtPhone.Equals("") || txtState.Equals("") || txtZip.Equals("") ) { lblErrorContactInfo.Visible = true; lblErrorContactInfo.Text = "Please fill in the contact information."; countErrors++; } else { lblErrorContactInfo.Visible = false; } //Finally, submit if no fatal errors occured. if (countErrors == 0) { //Submit form, process. Guid myNewClient = System.Guid.NewGuid(); //Insert client record and contact. eappdb.uspInsertClient( myNewClient, (Guid)(Session["BrokerID"]), txtGroupName.Text, txtTaxID.Text); eappdb.uspInsertClientInfo(System.Guid.NewGuid(), myNewClient, txtPhone.Text, txtFax.Text, txtAddress.Text, txtCity.Text, txtState.Text, txtZip.Text); //Insert client coverage options eappdb.uspInsertClientOptions( System.Guid.NewGuid(), myNewClient, chkMedical.Checked, chkDental.Checked, chkLife.Checked, chkVision.Checked,chkDisability.Checked); //Insert client carriers foreach ( ListItem li in lstSel.Items ) { eappdb.uspInsertClientCarrier( System.Guid.NewGuid(), myNewClient, li.Text.ToUpper() ); } //Add the web user eappsec.uspInsertWebUser(System.Guid.NewGuid(), myNewClient, txtLogin.Text, txtPassword.Text); //Redirect the user to the home page with query string. Response.Redirect("~/BrokerAdmin/Welcome.aspx", true); } }