private void ProcessSqlObjectAddCustomClientBegin() { if (treeView1.SelectedNode.Tag == null || !(treeView1.SelectedNode.Tag is ObjectWithClientSpecific objectAdd) || cbVersions.SelectedItem == null || !(cbVersions.SelectedItem is VersionObjectCounter versionObjectCounter)) { return; } using var frm = new FCustomClient(); Program.Settings.PositionLoad(frm); frm.Refill(ClientCode.List().Except(objectAdd.ClientCodeList()).ToList()); if (frm.ShowDialog(this) == DialogResult.OK) { currentObjectEdited = new ObjectToImport() { VersionId = versionObjectCounter.VersionId, TypeObjectId = objectAdd.TypeObjectId, ObjectSchema = objectAdd.ObjectSchema, ObjectName = objectAdd.ObjectName, ObjectColumn = objectAdd.ObjectColumn, ObjectDeleted = false, ObjectEmpty = false, ClientCodeId = frm.ClientCode.ClientCodeId, ObjectSql = objectAdd.ObjectSql }; BeginAddSqlObjectUpdateDisplay(EAction.SqlObjectAddCustomClientEnd, $"Ajout d'une implémentation pour {frm.ClientCode.ClientCodeName} de {objectAdd}"); } Program.Settings.PositionSave(frm); }
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); }
private void ProcessSqlObjectEditBegin() { if (treeView1.SelectedNode.Tag == null || !(treeView1.SelectedNode.Tag is Object objectEdited) || cbVersions.SelectedItem == null || !(cbVersions.SelectedItem is VersionObjectCounter)) { return; } currentObjectEdited = new ObjectToImport(objectEdited); BeginAddSqlObjectUpdateDisplay(EAction.SqlObjectEditEnd, $"Modification de {objectEdited}"); }
private void ProcessSqlObjectAddBegin() { if (treeView1.SelectedNode.Tag == null || !(treeView1.SelectedNode.Tag is TypeObjectCounter objectAdd) || cbVersions.SelectedItem == null || !(cbVersions.SelectedItem is VersionObjectCounter versionObjectCounter)) { return; } currentObjectEdited = new ObjectToImport() { VersionId = versionObjectCounter.VersionId, TypeObjectId = objectAdd.TypeObjectId, ObjectSql = string.Empty, }; BeginAddSqlObjectUpdateDisplay(EAction.SqlObjectAddEnd, $"Ajout d'un élément de type {objectAdd.TypeObjectName} à la version {versionObjectCounter}"); }
public void SetObjectToImport(ObjectToImport import, string cc) { clientCode = cc; if (import == null) { sqlTextBoxClient.Visible = false; lblNoneClient.Visible = true; lblNoneClient.BringToFront(); cbMode.Items.Clear(); } else { lblNoneClient.Visible = false; sqlTextBoxClient.Visible = true; lblNoneClient.BringToFront(); sqlTextBoxClient.Text = import.ObjectSql; SetReferential(import.ReferencedObject); cbMode.Items.Clear(); cbMode.Items.Add(new ChoixClass(EImportType.Nop)); if (import.OriginalStatus != EImportType.Equal) { if (import.OriginalStatus == EImportType.New) { cbMode.Items.Add(new ChoixClass(EImportType.New)); } else if (import.OriginalStatus == EImportType.Different) { cbMode.Items.Add(new ChoixClass(EImportType.DifferentImportAsReferential)); } cbMode.Items.Add(new ChoixClass(EImportType.DifferentImportASCustomClient)); } else { cbMode.Items.Add(new ChoixClass(EImportType.Equal)); } cbMode.SelectedItem = new ChoixClass(import.Status); } EnableButton(); }
public int Add(ObjectToImport objectInserted) { objectInserted.ObjectDeleted = false; objectInserted.ObjectEmpty = false; int id = cnn.ExecuteScalar(Object.SQLInsert, objectInserted); if (objectInserted.GetTypeObject().TypeObjectNeedColumnDefinition) { // synchronisation des colonnes Here foreach (var column in objectInserted.Columns) { column.ObjectId = id; cnn.Execute(ColumnDefinition.SQLInsert, column); } } AddScriptToObjectAction(objectInserted, SqlAction.Create); return(id); }