private void ProcessSqlObjectAddEnd() { if (treeView1.SelectedNode.Tag == null || !(treeView1.SelectedNode.Tag is TypeObjectCounter typeObjetAddEnd) || cbVersions.SelectedItem == null || !(cbVersions.SelectedItem is VersionObjectCounter versionObjectCounterAddEnd)) { return; } TreeNode node = null; if (currentObjectEdited != null && sqlTextBox1.Text != currentObjectEdited.ObjectSql) { currentObjectEdited.ObjectSql = sqlTextBox1.Text; AnalyseEntete(); if (string.IsNullOrWhiteSpace(currentObjectEdited.ObjectName)) { MessageBox.Show(this, $"L'analyse du script a échoué.\nImpossible de déterminer le nom de {currentObjectEdited.GetTypeObject().TypeObjectName}", "Insertion imposible", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } using var crudProcess = new CRUDObjectProcess(); int id = crudProcess.Add(currentObjectEdited); FillReferentialTypeObject(treeView1.SelectedNode, versionObjectCounterAddEnd, typeObjetAddEnd, true); node = SelectNodeObject(treeView1.SelectedNode, id); } CancelEdition(node); }
private void ProcessSqlObjectAddCustomClientEnd() { if (treeView1.SelectedNode.Tag == null || !(treeView1.SelectedNode.Tag is ObjectWithClientSpecific ObjetAddEnd) || currentObjectEdited == null) { return; } if (sqlTextBox1.Text == currentObjectEdited.ObjectSql) { MessageBox.Show(this, $"Aucun changement entre l'implémentation et la version de départ", "Insertion imposible", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } currentObjectEdited.ObjectSql = sqlTextBox1.Text; AnalyseEntete(); if (string.IsNullOrWhiteSpace(currentObjectEdited.ObjectName)) { MessageBox.Show(this, $"L'analyse du script a échoué.\nImpossible de déterminer le nom de {currentObjectEdited.GetTypeObject().TypeObjectName}", "Insertion imposible", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } using var crudProcess = new CRUDObjectProcess(); int id = crudProcess.Add(currentObjectEdited); FillCustomClientList(treeView1.SelectedNode, ObjetAddEnd, true); var node = SelectNodeObject(treeView1.SelectedNode, id); CancelEdition(node); }
private bool DoImport(CRUDObjectProcess processor, ObjectToImport import) { import.ClientCodeId = (import.Status == EImportType.DifferentImportASCustomClient) ? (int?)baseClient.ClientCodeId : null; int id = processor.Add(import); return(id > 0); }