/// <summary> /// Handles the Click event of the SaveNewCommentTemplatebutton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void SaveNewCommentTemplatebutton_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.TemplateNameTextBox.Text.Trim())) { int returnValue = 0; int isoverWrite = 0; int primaryKey = 0; this.SaveNewTemplate(); string commentItemsXml = this.GetCommentItemXmlString(); returnValue = this.form9076Control.WorkItem.F9076SaveNewCommentTemplate(this.templateid, commentItemsXml, isoverWrite); if (this.templateid <= 0 && !WSHelper.IsOnLineMode) { TerraScanCommon.AddFieldUseValues(returnValue, this.keyField, this.formNo, null, TerraScanCommon.UserId); } if ((returnValue != 0)) { this.DialogResult = DialogResult.OK; //Form.ActiveForm.Close(); this.Close(); } else if (returnValue == 0) { DialogResult dialogResult = MessageBox.Show(SharedFunctions.GetResourceString("UpdateExistTemplate"), SharedFunctions.GetResourceString("HeaderCommentTemplate"), MessageBoxButtons.YesNo, MessageBoxIcon.Question); // ConfigurationWrapper.ApplicationName if (DialogResult.Yes == dialogResult) { isoverWrite = 1; primaryKey = this.form9076Control.WorkItem.F9076SaveNewCommentTemplate(this.templateid, commentItemsXml, isoverWrite); if (this.templateid <= 0 && !WSHelper.IsOnLineMode) { TerraScanCommon.AddFieldUseValues(returnValue, this.keyField, this.formNo, null, TerraScanCommon.UserId); } this.DialogResult = DialogResult.OK; //Form.ActiveForm.Close(); this.Close(); } this.TemplateNameTextBox.Focus(); } } else { MessageBox.Show(SharedFunctions.GetResourceString("TempalteName"), ConfigurationWrapper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); this.TemplateNameTextBox.Focus(); } }
public void D35000_F35002_SubFormSave(object sender, DataEventArgs <F35002SubFormSaveEventArgs> eventArgs) { if (this.keyId == eventArgs.Data.valueSliceId) { int returnValue = -1; F35001ValueSliceHeaderData.GetValueSliceHeaderDataTable tempValueSliceHeaderTable = new F35001ValueSliceHeaderData.GetValueSliceHeaderDataTable(); DataRow updateValueSliceHeaderRow = tempValueSliceHeaderTable.NewGetValueSliceHeaderRow(); updateValueSliceHeaderRow[this.valueSliceHeaderDataSet.GetValueSliceHeader.DescriptionColumn.ColumnName] = this.DescriptionTextBox.Text.Trim(); decimal newconstruction; ////Commented by Biju on 11/Feb/2010 to fix #5877 ////decimal.TryParse(this.NewConstValueTextBox.Text, out newconstruction); ////Added by Biju on 11/Feb/2010 to fix #5877 newconstruction = this.NewConstValueTextBox.DecimalTextBoxValue; updateValueSliceHeaderRow[this.valueSliceHeaderDataSet.GetValueSliceHeader.NewConstructionColumn.ColumnName] = newconstruction; updateValueSliceHeaderRow[this.valueSliceHeaderDataSet.GetValueSliceHeader.IsValueColumn.ColumnName] = Convert.ToInt16(this.WillValueCombo.SelectedValue); updateValueSliceHeaderRow[this.valueSliceHeaderDataSet.GetValueSliceHeader.IsRollColumn.ColumnName] = Convert.ToInt16(this.WillRollCombo.SelectedValue); updateValueSliceHeaderRow[this.valueSliceHeaderDataSet.GetValueSliceHeader.TypeColumn.ColumnName] = eventArgs.Data.type; updateValueSliceHeaderRow[this.valueSliceHeaderDataSet.GetValueSliceHeader.ValueColumn.ColumnName] = eventArgs.Data.value; updateValueSliceHeaderRow[this.valueSliceHeaderDataSet.GetValueSliceHeader.AmountColumn.ColumnName] = eventArgs.Data.amount; //// Added new column to valid the New Construction field by sending default value for 'UpdateNewConstColumn' as '1'. updateValueSliceHeaderRow[this.valueSliceHeaderDataSet.GetValueSliceHeader.UpdateNewConstColumn.ColumnName] = 1; tempValueSliceHeaderTable.Rows.Add(updateValueSliceHeaderRow); string valueSliceHeaderItems = TerraScanCommon.GetXmlString(tempValueSliceHeaderTable); //// returns -2 as to show the message box screen returnValue = this.form35001Controll.WorkItem.F35000_InsertOrUpdateValueSlice(this.keyId, valueSliceHeaderItems, TerraScan.Common.TerraScanCommon.UserId); //// this condition is to show/notshow the message box screen if (returnValue.Equals(-2)) { if (MessageBox.Show(SharedFunctions.GetResourceString("NewConstruction"), SharedFunctions.GetResourceString("NewConstructionTitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { //// Added for updating the New Construction field by sending default value for 'UpdateNewConstColumn' as '2'. updateValueSliceHeaderRow[this.valueSliceHeaderDataSet.GetValueSliceHeader.UpdateNewConstColumn.ColumnName] = 2; } else { //// Added for not updating the New Construction field by sending default value for 'UpdateNewConstColumn' as '3'. updateValueSliceHeaderRow[this.valueSliceHeaderDataSet.GetValueSliceHeader.UpdateNewConstColumn.ColumnName] = 3; } valueSliceHeaderItems = TerraScanCommon.GetXmlString(tempValueSliceHeaderTable); //// returns the primary keyID with / without updation of the New Construction value returnValue = this.form35001Controll.WorkItem.F35000_InsertOrUpdateValueSlice(this.keyId, valueSliceHeaderItems, TerraScan.Common.TerraScanCommon.UserId); } if (returnValue != -1) { this.keyId = returnValue; } if (!WSHelper.IsOnLineMode) { TerraScanCommon.AddFieldUseValues(this.keyId, this.keyField, this.formNo, null, TerraScanCommon.UserId); } SliceReloadActiveRecord currentSliceInfo; currentSliceInfo.MasterFormNo = this.masterFormNo; currentSliceInfo.SelectedKeyId = returnValue; ////to refresh the master form with the return keyid this.OnD9030_F9030_ReloadAfterSave(new TerraScan.Infrastructure.Interface.EventArgs <SliceReloadActiveRecord>(currentSliceInfo)); this.PopulateValueSliceHeaderDetails(); if (this.valueSliceHeaderDataSet.GetValueSliceHeader.Rows.Count > 0) { int[] tempArgs = new int[2]; int parcelId = Convert.ToInt32(this.valueSliceHeaderDataSet.GetValueSliceHeader.Rows[0][this.valueSliceHeaderDataSet.GetValueSliceHeader.ParcelIDColumn.ColumnName]); tempArgs[0] = parcelId; tempArgs[1] = 0; this.D35000_F35000_ParcelChangedValue(this, new DataEventArgs <int[]>(tempArgs)); } this.DescriptionTextBox.Focus(); } }