/// <summary> /// Call to the bussiness logic layer to save signup details from a new user /// </summary> /// <param name="user">New user details</param> /// <returns>Saved user</returns> public PMUServiceResult InsertUserSignUpDetails(User user) { PMUServiceResult PMUServiceResultObject = new PMUServiceResult(); User newUser = null; try { newUser = new User(); //call to the bussiness logic layer to check data and insert date to the db newUser = PMULoginManager.InsertUserSignUpDetails(user); //Assign the return value to the common return type PMUServiceResultObject.Data = user; return PMUServiceResultObject; } catch (Exception ex) { PMUServiceResultObject.ErrorDetails = ex.ToString(); PMUServiceResultObject.ErrorMessage = "Some error, unable to insert user data"; PMUServiceResultObject.Data = newUser; throw new FaultException<PMUServiceResult>(PMUServiceResultObject, ex.ToString()); } }
/// <summary> /// Save the signup details from a new user /// </summary> /// <param name="user">New user details</param> /// <returns>Saved User</returns> public static User InsertUserSignUpDetails(User user) { Database db = null; int UserId; try { db = DatabaseFactory.CreateDatabase(); using (DbCommand objCommand = db.GetStoredProcCommand(DalConstants.StoredProcedures.User.insertUserDetails)) { db.AddInParameter(objCommand, DalConstants.StoredProcedures.User.UserDetailsParameters.userName, DbType.String, user.UserName); db.AddInParameter(objCommand, DalConstants.StoredProcedures.User.UserDetailsParameters.fullName, DbType.String, user.FullName); db.AddInParameter(objCommand, DalConstants.StoredProcedures.User.UserDetailsParameters.gender, DbType.Boolean, user.Gender); db.AddInParameter(objCommand, DalConstants.StoredProcedures.User.UserDetailsParameters.email, DbType.String, user.Email); db.AddInParameter(objCommand, DalConstants.StoredProcedures.User.UserDetailsParameters.passWord, DbType.String, user.Password); db.AddInParameter(objCommand, DalConstants.StoredProcedures.User.UserDetailsParameters.isFbUser, DbType.Boolean, user.IsFbUser); db.AddInParameter(objCommand, DalConstants.StoredProcedures.User.UserDetailsParameters.isGmailUser, DbType.Boolean, user.IsGmailUser); db.AddInParameter(objCommand, DalConstants.StoredProcedures.User.UserDetailsParameters.fbUniqueId, DbType.String, user.FbUniqueId); db.AddInParameter(objCommand, DalConstants.StoredProcedures.User.UserDetailsParameters.gmailUniqueId, DbType.String, user.GmailUniqueId); //Excute the SP anc get the last Inserted value int.TryParse(db.ExecuteScalar(objCommand).ToString(), out UserId); //Assign the last inserted row id as the User Id user.UserId = UserId; } return user; } catch (Exception ex) { throw ex; } }
/// <summary> /// Call to the Data access layer to save signup details from a new user /// </summary> /// <param name="user">New user details</param> /// <returns>Saved user</returns> public static User InsertUserSignUpDetails(User user) { User insertedUser = null; try { insertedUser = new User(); //Call to the data access layer to insert the value to Db insertedUser = PMULoginDal.InsertUserSignUpDetails(user); return user; } catch (Exception ex) { throw ex; } }