public override DataSet Clone() { RegularExpressionData data = (RegularExpressionData)base.Clone(); data.InitVars(); return(data); }
/// <summary> /// Retrieves all regular expression from the database assigned to a user /// </summary> public RegularExpressionData GetEditableRegularExpressionsListOfUser(int userId) { RegularExpressionData dataSet = new RegularExpressionData(); ArrayList commandParameters = new ArrayList(); { commandParameters.Add(new SqlParameter("@UserId", userId).SqlValue); } DbConnection.db.LoadDataSet("vts_spRegularExpressionGetEditableListForUser", dataSet, new string[] { "RegularExpressions" }, commandParameters.ToArray()); return dataSet; }
private void ApplyChangesButton_Click(object sender, System.EventArgs e) { // Create a new regular expression entry in the database RegularExpressionData regularExpressionData = new RegularExpressionData(); RegularExpressionData.RegularExpressionsRow regularExpression = regularExpressionData.RegularExpressions.NewRegularExpressionsRow(); regularExpression.RegularExpressionId = int.Parse(RegExDropDownList.SelectedValue); regularExpression.RegExpression = RegularExpressionTextbox.Text; regularExpression.RegExMessage = ErrorMessageTextbox.Text.Length > 0 ? ErrorMessageTextbox.Text : null; regularExpression.Description = RegExDescriptionTextbox.Text; regularExpressionData.RegularExpressions.AddRegularExpressionsRow(regularExpression); new RegularExpression().UpdateRegularExpression(regularExpressionData); MessageLabel.Visible = true; ((PageBase)Page).ShowNormalMessage(MessageLabel,((PageBase)Page).GetPageResource("RegExUpdatedMessage")); ResetUIState(); }
private void CreateNewRegExButton_Click(object sender, System.EventArgs e) { if (!ValidateFields()) { return; } // Create a new regular expression entry in the database RegularExpressionData regularExpressionData = new RegularExpressionData(); RegularExpressionData.RegularExpressionsRow regularExpression = regularExpressionData.RegularExpressions.NewRegularExpressionsRow(); regularExpression.RegExpression = RegularExpressionTextbox.Text; regularExpression.RegExMessage = ErrorMessageTextbox.Text.Length > 0 ? ErrorMessageTextbox.Text : null; regularExpression.Description = RegExDescriptionTextbox.Text; regularExpressionData.RegularExpressions.AddRegularExpressionsRow(regularExpression); new RegularExpression().AddRegularExpression(regularExpressionData, NSurveyUser.Identity.UserId); MessageLabel.Visible = true; ((PageBase)Page).ShowNormalMessage(MessageLabel,((PageBase)Page).GetPageResource("RegExAddedMessage")); ResetUIState(); }
public RegularExpressionsRowChangeEvent(RegularExpressionData.RegularExpressionsRow row, DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public void RemoveRegularExpressionsRow(RegularExpressionData.RegularExpressionsRow row) { base.Rows.Remove(row); }
public void AddRegularExpressionsRow(RegularExpressionData.RegularExpressionsRow row) { base.Rows.Add(row); }
/// <summary> /// Retrieves regular expression details from the database /// </summary> public RegularExpressionData GetRegularExpressionById(int regularExpressionId) { RegularExpressionData dataSet = new RegularExpressionData(); ArrayList commandParameters = new ArrayList(); { commandParameters.Add(new SqlParameter("@RegularExpressionId", regularExpressionId).SqlValue); } DbConnection.db.LoadDataSet("vts_spRegularExpressionGetDetails", dataSet, new string[] { "RegularExpressions", "SecurityRights" }, commandParameters.ToArray()); return dataSet; }
/// <summary> /// Retrieves all regular expression from the database /// </summary> public RegularExpressionData GetAllRegularExpressionsList() { RegularExpressionData dataSet = new RegularExpressionData(); DbConnection.db.LoadDataSet("vts_spRegularExpressionGetList", dataSet, new string[] { "RegularExpressions" }); return dataSet; }
/// <summary> /// Adds a new regular expression to the database /// </summary> public void AddRegularExpression(RegularExpressionData newRegularExpression, int userId) { SqlConnection sqlConnection = new SqlConnection(DbConnection.NewDbConnectionString); DbConnection.db.UpdateDataSet(newRegularExpression, "RegularExpressions", this.GetInsertRegularExpressionCommand(sqlConnection, null, userId), new SqlCommand(), new SqlCommand(), UpdateBehavior.Transactional); }
/// <summary> /// Updates regular expressions data /// </summary> public void UpdateRegularExpression(RegularExpressionData updatedRegularExpression) { SqlConnection connection = new SqlConnection(DbConnection.NewDbConnectionString); SqlCommand insertCommand = new SqlCommand("vts_spRegularExpressionUpdate", connection); insertCommand.CommandType = CommandType.StoredProcedure; insertCommand.Parameters.Add(new SqlParameter("@RegularExpressionId", SqlDbType.Int, 4, "RegularExpressionId")); insertCommand.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar, 0xff, "Description")); insertCommand.Parameters.Add(new SqlParameter("@RegExpression", SqlDbType.VarChar, 0x7d0, "RegExpression")); insertCommand.Parameters.Add(new SqlParameter("@RegExMessage", SqlDbType.VarChar, 0x7d0, "RegExMessage")); DbConnection.db.UpdateDataSet(updatedRegularExpression, "RegularExpressions", insertCommand, new SqlCommand(), new SqlCommand(), UpdateBehavior.Transactional); }
/// <summary> /// Retrieves all regular expression from the database assigned to a user /// </summary> public RegularExpressionData GetRegularExpressionsOfUser(int userId, int surveyId) { //SqlParameter[] commandParameters = new SqlParameter[] //{ new SqlParameter("@UserId", userId), // new SqlParameter("@SurveyId", surveyId) }; ArrayList commandParameters = new ArrayList(); { commandParameters.Add(new SqlParameter("@UserId", userId).SqlValue); commandParameters.Add(new SqlParameter("@SurveyId", surveyId).SqlValue); } RegularExpressionData dataSet = new RegularExpressionData(); DbConnection.db.LoadDataSet("vts_spRegularExpressionGetListForUser", dataSet, new string[] { "RegularExpressions" }, commandParameters.ToArray()); return dataSet; }
/// <summary> /// Updates regular expressions data /// </summary> public void UpdateRegularExpression(RegularExpressionData updatedRegularExpression) { RegularExpressionFactory.Create().UpdateRegularExpression(updatedRegularExpression); }
/// <summary> /// Adds a new regular expression to the database /// </summary> public void AddRegularExpression(RegularExpressionData newRegularExpression, int userId) { RegularExpressionFactory.Create().AddRegularExpression(newRegularExpression, userId); }