////private void SaveButton_Click(object sender, EventArgs e) ////{ //// //ToDo: Have to Call Some Dialog form //// object[] optionalParameter = new object[]{202,1}; //// Form testForm = new Form(); //// testForm = TerraScanCommon.GetForm("1111", optionalParameter, true); //// if (testForm != null) //// { //// testForm.ShowDialog(); //// } ////} #endregion #region Next Number Records /// <summary> /// Loads the next number config. /// </summary> /// <param name="currentRowIndex">Index of the current row.</param> private void LoadNextNumberConfig(int currentRowIndex) { ////this.SetButtons(this, (int)TerraScanCommon.ButtonActionMode.EditMode); if (currentRowIndex >= 0) { this.nextNumDetailsDateSet = F1016WorkItem.ListNextNumberConfiguration(); this.NextNumRecordsGridView.AutoGenerateColumns = false; DataTable tempDataTable = this.nextNumDetailsDateSet.Tables[0].Clone(); tempDataTable.Columns["NextNumID"].AllowDBNull = true; tempDataTable.Columns["NextNumID"].DataType = typeof(int); tempDataTable.Load(this.nextNumDetailsDateSet.Tables[0].CreateDataReader()); this.NextNumRecordsGridView.DataSource = tempDataTable; this.DisplayNextNumberHeaderDetails(currentRowIndex); this.NextNumRecordsGridView.CurrentRow.Selected = true; ////this.LoadTestResult(Convert.ToInt32(this.RollYearTextBox.Text), Convert.ToInt32(this.NextNumberTextBox.Text), this.FormulaTextBox.Text); this.NextNumRecordsGridView.Rows[this.NextNumRecordsGridView.CurrentCell.RowIndex].Selected = false; ////TerraScanCommon.SetDataGridViewPosition(this.NextNumRecordsGridView, currentRowIndex); this.NextNumRecordsGridView.CurrentCell = this.NextNumRecordsGridView[0, Convert.ToInt32(currentRowIndex)]; } this.pageMode = TerraScanCommon.PageModeTypes.View; ////if (this.EditPermissionButton.ActualPermission == true) ////{ //// this.NextNumberTextBox.LockKeyPress = false; //// this.FormulaTextBox.LockKeyPress = false; ////} ////else ////{ //// this.NextNumberTextBox.LockKeyPress = true; //// this.FormulaTextBox.LockKeyPress = true; ////} }
/// <summary> /// Gets the test result. /// </summary> /// <param name="year">The year.</param> /// <param name="nextNum">The next number.</param> /// <param name="formula">The formula.</param> /// <returns>testresult</returns> private string GetTestResult(int year, int nextNum, string formula) { string testresult = string.Empty; this.tempDataSet = F1016WorkItem.CheckNextNumber(year, nextNum, formula); if (this.tempDataSet != null) { if (this.tempDataSet.Tables.Count > 0 && this.tempDataSet.Tables[0].Rows.Count > 0 && !String.IsNullOrEmpty(this.tempDataSet.Tables[0].Rows[0]["ErrorMsg"].ToString())) { testresult = this.tempDataSet.Tables[0].Rows[0]["Result"].ToString(); } } return(testresult); }
/// <summary> /// Saves the record. /// </summary> /// <returns>SaveRecord</returns> private bool SaveRecord() { try { if (this.CheckErrors()) { if (!this.GetTestResult(Convert.ToInt32(this.RollYearTextBox.Text), Convert.ToInt32(this.NextNumberTextBox.Text.Trim()), this.FormulaTextBox.Text.Trim()).Equals("INVALID")) { F1016WorkItem.UpdateNextNumberConfigDetails(Convert.ToInt32(this.NextNumberIDTextBox.Text), Convert.ToInt32(this.NextNumberTextBox.Text.Trim()), this.FormulaTextBox.Text.Trim(), TerraScanCommon.UserId); ////this.SetButtons(this, new DataEventArgs<Enum>(TerraScanCommon.ButtonActionMode.SaveMode)); this.SetButtons(TerraScanCommon.ButtonActionMode.SaveMode); this.LoadNextNumberConfig(this.NextNumRecordsGridView.CurrentCell.RowIndex); this.pageMode = TerraScanCommon.PageModeTypes.View; this.NextNumRecordsGridView.Focus(); this.NextNumRecordsGridView.Columns[3].SortMode = DataGridViewColumnSortMode.Programmatic; this.NextNumRecordsGridView.CurrentRow.Selected = true; this.NextNumRecordsGridView.TabStop = true; return(true); } else { MessageBox.Show(SharedFunctions.GetResourceString("InvalidFormula"), ConfigurationWrapper.ApplicationSave, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } else { return(false); } } catch (Exception ex) { ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm); return(false); } }