Boolean RegisterMemberWindigi(string p_strName, string p_strSurname, string p_strAddress,string p_strNationalID,string p_strCareerPosition,string p_strTelNo,int p_intAge, string p_strEmail,int p_intMarital,string p_strGender, string p_strUserName, string p_strPassword,int p_intLifeStyleTechnology,int p_intLifeStyleSport,int p_intLifeStyleMusic,int p_intLifeStyleMovie,int p_intLifeStyleDining,int p_intLifeStyleBook,int p_intLuxuryWatch,int p_intLuxuryJewelry,int p_intLuxuryCar,int p_intFashionStylish,int p_intFashionGlamour,int p_intFashionCasual,string p_strIncomeLevel,string p_strEducationLevel,string p_strChildren,string p_strCareerTitle)
{
connString.Open();
connStringBranID.Open();
SqlTransaction transactionWin;
transactionWin = connString.BeginTransaction();
SqlTransaction transactionSi ;
transactionSi = connStringBranID.BeginTransaction();
try
{
objCmd.Connection = connString;
objCmd.Transaction =transactionWin; //*** Command & Transaction ***//
//FrmRegTxtNationalID
string sqlRegisMember = "INSERT INTO tbl_user("
+ "userPassword,userName,userSurname,userAge"
+ " ,userGender,userEmail,userTelno,userAddress"
+ " ,userIncomeID"
+ " ,userEducationID,userMaritalStatus,userKids,userNationalID"
+ " ,userCareerPosition,userPrefFashionCasual,userPrefFashionGlamour,userPrefFashionStylish"
+ " ,userPrefLuxCar,userPrefLuxJewelry,userPrefLuxWatch,userCareerTitleID"
+ " ,userPrefLifeBook,userPrefLifeDining,userPrefLifeMovie,userPrefLifeMusic,userPrefLifeSport,userPrefLifeTechnology)"
+ " VALUES ('" + p_strPassword + "','" + p_strUserName + "','" + p_strSurname + "','N/A'," +
"'N/A','" + p_strEmail + "','" + p_strTelNo + "','N/A'," +
"'N/A'" + "," +
"'N/A'" + ",'N/A','N/A','N/A'," +
"'N/A'" + ",'N/A','N/A','N/A'," +
"'N/A'" + ",'N/A','N/A','N/A'," +
"'N/A'" + ",'N/A','N/A','N/A','N/A','N/A')";
objCmd = new SqlCommand();
objCmd.Connection = connString;
objCmd.CommandText = sqlRegisMember;
objCmd.CommandType = CommandType.Text;
objCmd.ExecuteNonQuery();
//Siam
objCmdBrand.Connection = connStringBranID;
objCmdBrand.Transaction = transactionSi;//*** Command & Transaction ***//
string sqlRegisMemberSi = "INSERT INTO tbl_user("
+ "userPassword,userName,userSurname,userAge"
+ " ,userGender,userEmail,userTelno,userAddress"
+ " ,userIncomeID"
+ " ,userEducationID,userMaritalStatus,userKids,userNationalID"
+ " ,userCareerPosition,userPrefFashionCasual,userPrefFashionGlamour,userPrefFashionStylish"
+ " ,userPrefLuxCar,userPrefLuxJewelry,userPrefLuxWatch,userCareerTitleID"
+ " ,userPrefLifeBook,userPrefLifeDining,userPrefLifeMovie,userPrefLifeMusic,userPrefLifeSport,userPrefLifeTechnology)"
+ " VALUES ('" + p_strPassword + "','" + p_strUserName + "','" + p_strSurname + "'," + p_intAge + "," +
"'" + p_strGender + "','" + p_strEmail + "','" + p_strTelNo + "','" + p_strAddress + "'," +
"'" + p_strIncomeLevel + "'," +
"'" + p_strEducationLevel + "'" + ",'" + p_intMarital + "','" + p_strChildren + "','" + p_strNationalID + "'," +
"'" + p_strCareerPosition + "'" + ",'" + p_intFashionCasual + "','" + p_intFashionGlamour + "','" + p_intFashionStylish + "'," +
"'" + p_intLuxuryCar + "','" + p_intLuxuryJewelry + "','" + p_intLuxuryWatch + "','" + p_strCareerTitle + "'," +
"'" + p_intLifeStyleBook + "'" + ",'" + p_intLifeStyleDining + "','" + p_intLifeStyleMovie + "','" + p_intLifeStyleMusic + "','" + p_intLifeStyleSport + "','" + p_intLifeStyleTechnology + "')";
objCmdBrand = new SqlCommand();
objCmdBrand.Connection = connStringBranID;
objCmdBrand.CommandText = sqlRegisMemberSi;
objCmdBrand.CommandType = CommandType.Text;
objCmdBrand.ExecuteNonQuery();
transactionWin.Commit();
transactionSi.Commit();
return true;
}
catch (Exception ex)
{
transactionWin.Rollback();
transactionSi.Rollback();
Response.Write("<b><font color='red'>Created member failed (" + ex.Message + ")</font></b>");
return false;
}
finally
{
connString.Close();
connStringBranID.Close();
}
}