private bool completeRegistration(string id)
        {
            try
            {
                mEncryption tEncrypt = new mEncryption();
                byte[]      arID     = Convert.FromBase64String(id);
                string      memberID = tEncrypt.tdesDecrypt(arID);

                if (activatetNewUserID(Convert.ToInt32(memberID)))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                lbInfo.Text = ex.Message;
                return(false);
            }
        }
Esempio n. 2
0
        public bool insertConsultationInfo()
        {
            bool success = false;

            // initialize ADO objects
            SqlConnection  dataConn = null;
            SqlDataReader  dbReader = null;
            SqlCommand     dataCmd  = null;
            SqlTransaction trans    = null;

            try
            {
                mEncryption tEncrypt = new mEncryption();


                // set connection attributes and open data connection
                dataConn = new SqlConnection(mMain.sDataPath);
                dataConn.Open();
                trans = dataConn.BeginTransaction();

                // set command object attributes
                dataCmd             = new SqlCommand("usp_InsertchaConsultationInfo", dataConn, trans);
                dataCmd.CommandType = CommandType.StoredProcedure;

                // declare and instantiate parameters collection
                dataCmd.Parameters.AddWithValue("@FullName", txtUserName.Text.Trim());
                dataCmd.Parameters.AddWithValue("@Email", txtEmail.Text.Trim());
                dataCmd.Parameters.AddWithValue("@PhoneNumber", txtPhoneNumber.Text.Trim());
                dataCmd.Parameters.AddWithValue("@City", txtCity.Text.Trim());
                dataCmd.Parameters.AddWithValue("@State", cboState.SelectedItem.Text.Trim());

                dataCmd.Parameters.AddWithValue("@HelpMessage", txtArea.Text.Trim());
                dataCmd.Parameters.AddWithValue("@SubscribeNewsletter", chbxSubscribe.Checked ? 1 : 0);

                dataCmd.Parameters.Add("@confirmation", SqlDbType.Int).Direction = ParameterDirection.Output;


                // execute command
                var result = dataCmd.ExecuteNonQuery();

                // test return value and transfer control as necessary
                if (result == 1)
                {
                    success = true;
                    trans.Commit();
                }
                else
                {
                    trans.Rollback();
                    throw new Exception("Error Submitting Credit Card Information");
                } // end if
            }     //end try
            catch (SqlException sqle)
            {
                trans.Rollback();
                throw new Exception("SqlException: " + sqle.Message);
            }   //end catch
            catch (Exception z)
            {
                trans.Rollback();
                throw new Exception("Generic Exception: " + z.Message);
            }   //end catch
            finally
            {
                // clean up
                if (dbReader != null)
                {
                    dbReader.Close();
                }       // end if

                dataConn.Close();
                dataConn.Dispose();
                dataCmd.Dispose();
            }   // end finally

            return(success);
        }