private int SaveOperation(RdlToCodeData.ParameterDataDataTable dt, bool newRecord, string formName) { int errorId = -1; if (!newRecord) { if (dt.Rows.Count > 1) { dt.Rows.Add(new object[] { "EventID", this.keyId }); string saveXML = TerraScanCommon.GetXmlString(dt); errorId = this.form820003control.WorkItem.RdlToCode_Save(saveXML, formName); this.keyId = errorId; //MessageBox.Show("Record Updated Successfully for " + formName, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { if (dt.Rows.Count > 0) { string saveXML = TerraScanCommon.GetXmlString(dt); errorId = this.form820003control.WorkItem.RdlToCode_Save(saveXML, formName); this.keyId = errorId; //MessageBox.Show("New Record Created Successfully for " + formName, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } return(errorId); }
public void OnD9030_F9030_DeleteSliceInformation(object sender, EventArgs eventArgs) { try { if (this != null && this.IsDisposed != true) { if (this.slicePermissionField.deletePermission) { //this.DeleteButton_Click(); RdlToCodeData.ParameterDataDataTable dt = new RdlToCodeData.ParameterDataDataTable(); dt.Rows.Add(new object[] { "EventID", this.keyId }); string deleteXML = TerraScanCommon.GetXmlString(dt); this.form820003control.WorkItem.RdlToCode_Delete(deleteXML, "r820003"); } } } catch (Exception ex) { ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm); } finally { this.Cursor = Cursors.Default; } }
private void UpdateValuesToControl(RdlToCodeData.ParameterDataDataTable dt, Control.ControlCollection c) { foreach (Control c1 in c) { string nae = c1.Name; if (c1.HasChildren) { UpdateValuesToControl(dt, c1.Controls); } else if (c1.GetType() == typeof(TerraScan.UI.Controls.TerraScanTextBox)) { if (!string.IsNullOrEmpty(c1.Tag.ToString())) { dt.Rows.Add(new object[] { c1.Tag.ToString(), c1.Text }); } } else if (c1.GetType() == typeof(TerraScan.UI.Controls.TerraScanComboBox)) { if (!string.IsNullOrEmpty(c1.Tag.ToString())) { dt.Rows.Add(new object[] { c1.Tag.ToString(), ((TerraScan.UI.Controls.TerraScanComboBox)c1).SelectedValue }); } } else if (c1.GetType() == typeof(TerraScan.UI.Controls.TerraScanCheckBox)) { if (!string.IsNullOrEmpty(c1.Tag.ToString())) { if (((TerraScan.UI.Controls.TerraScanCheckBox)c1).Checked == true) { dt.Rows.Add(new object[] { c1.Tag.ToString(), true }); } else { dt.Rows.Add(new object[] { c1.Tag.ToString(), false }); } } } else if (c1.GetType() == typeof(RadioButton)) { if (!string.IsNullOrEmpty(c1.Tag.ToString())) { if (((RadioButton)c1).Checked == true) { string[] value = c1.AccessibleName.Split('_'); string actualValue = value[value.Length - 1].ToString(); dt.Rows.Add(new object[] { c1.Tag.ToString(), actualValue }); } } } } }
private int SaveForm(bool newRecord) { int result = -1; DataSet da = new DataSet(); RdlToCodeData.ParameterDataDataTable dt = new RdlToCodeData.ParameterDataDataTable(); foreach (Control c in this.Controls) { try { if (c.Name.EndsWith("subreport")) { string[] formName = c.Name.Split(new char[] { '_' }); DataSet subReportDataset = new DataSet(); if (c.HasChildren) { RdlToCodeData.ParameterDataDataTable subReportDatatable = new RdlToCodeData.ParameterDataDataTable(); UpdateValuesToControl(subReportDatatable, c.Controls); result = SaveOperation(subReportDatatable, newRecord, formName[2]); } } else if (c.HasChildren) { UpdateValuesToControl(dt, c.Controls); } else if (c.GetType() == typeof(TerraScan.UI.Controls.TerraScanTextBox)) { if (!string.IsNullOrEmpty(c.Tag.ToString())) { dt.Rows.Add(new object[] { c.Tag.ToString(), c.Text }); } } else if (c.GetType() == typeof(TerraScan.UI.Controls.TerraScanCheckBox)) { if (!string.IsNullOrEmpty(c.Tag.ToString())) { if (((TerraScan.UI.Controls.TerraScanCheckBox)c).Checked == true) { dt.Rows.Add(new object[] { c.Tag.ToString(), true }); } else { dt.Rows.Add(new object[] { c.Tag.ToString(), false }); } } } else if (c.GetType() == typeof(RadioButton)) { if (!string.IsNullOrEmpty(c.Tag.ToString())) { if (((RadioButton)c).Checked == true) { string[] value = c.AccessibleName.Split('_'); string actualValue = value[value.Length - 1].ToString(); dt.Rows.Add(new object[] { c.Tag.ToString(), actualValue }); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } result = SaveOperation(dt, newRecord, "r820003"); return(result); }
private void PopulateFormFields() { //DataSet ds = new DataSet(); RdlToCodeData.ParameterDataDataTable dt = new RdlToCodeData.ParameterDataDataTable(); dt.Rows.Add(new object[] { "EventID", this.keyId }); try { this.formDetailsDataSet = this.form820003control.WorkItem.RdlToCode_Get(TerraScanCommon.GetXmlString(dt), "r820003"); //// ds = TerraScan.Helper.WSHelper.RdlToCode_Get(dt,"r820003"); } catch (Exception ex1) { } if (this.formDetailsDataSet != null) { if (this.formDetailsDataSet.Tables.Count > 0) { if (this.formDetailsDataSet.Tables[0].Rows.Count > 0) { foreach (Control c in this.Controls) { try { if (c.Name.EndsWith("subreport")) { string[] formName = c.Name.Split(new char[] { '_' }); DataSet subReportDataset = new DataSet(); //// subReportDataset = TerraScan.Helper.WSHelper.RdlToCode_Get(dt, formName[2]); if (c.HasChildren) { if (c is Panel) { //(c as Panel).BorderStyle = BorderStyle.None; } AddValuesToControl(subReportDataset, c.Controls); } } else if (c.HasChildren) { AddValuesToControl(this.formDetailsDataSet, c.Controls); } else if (c.GetType() == typeof(TerraScan.UI.Controls.TerraScanTextBox)) { if (!string.IsNullOrEmpty(c.Tag.ToString())) { c.Text = this.formDetailsDataSet.Tables[0].Rows[0][c.Tag.ToString()].ToString(); } } else if (c.GetType() == typeof(TerraScan.UI.Controls.TerraScanCheckBox)) { if (!string.IsNullOrEmpty(c.Tag.ToString())) { string result = this.formDetailsDataSet.Tables[0].Rows[0][c.Tag.ToString()].ToString(); if (result == "True") { ((CheckBox)c).Checked = true; } } } else if (c.GetType() == typeof(RadioButton)) { if (!string.IsNullOrEmpty(c.Tag.ToString())) { string result = this.formDetailsDataSet.Tables[0].Rows[0][c.Tag.ToString()].ToString(); if (c.AccessibleName.ToString().EndsWith(result)) { ((RadioButton)c).Checked = true; } } } } catch (Exception ex) { } } } else { this.LockControls(true); } } } }