public int InitializeConsoleSPRutility(string projectName, string fileToOpen, string lstComponents) { try { syncUtility = new SPRSynchronizationUtility(logFile, projectName, "SPRUtil"); syncUtility.UpdateMdbFile(fileToOpen); List <string> lstitems; if (lstComponents.Contains(',')) { string[] arr = lstComponents.Split(','); lstitems = new List <string>(arr); } else { lstitems = new List <string>(); lstitems.Add(lstComponents); } syncUtility.MDBSynchronization(lstitems); SaveLoggingFile(); return(0); } catch (Exception ex) { logFile.WriteLine("Please check the parameters : " + ex.Message); return(1); } }
public int InitializeConsoleSPRutility(string projectName, string fileToOpen, string lstComponents) { try { syncUtility = new SPRSynchronizationUtility(logFile, projectName, "SPRUtil"); syncUtility.UpdateMdbFile(fileToOpen); List<string> lstitems; if (lstComponents.Contains(',')) { string[] arr = lstComponents.Split(','); lstitems = new List<string>(arr); } else { lstitems = new List<string>(); lstitems.Add(lstComponents); } syncUtility.MDBSynchronization(lstitems); SaveLoggingFile(); return 0; } catch (Exception ex) { logFile.WriteLine("Please check the parameters : " + ex.Message); return 1; } }
private void btnGo_Click(object sender, EventArgs e) { try { btnGo.Enabled = false; Application.DoEvents(); if (clistboxScopes.CheckedItems.Count == 0) { MessageBox.Show("Please select the scope."); return; } if (string.IsNullOrEmpty(txtMdbName.Text)) { MessageBox.Show("Please select the Mdb File."); return; } var lstitems = (from string item in clistboxCommodities.CheckedItems select item).ToList <string>(); // string selectedObject = ((org.iringtools.library.DataObject)(cboxCommodities.Items[cboxCommodities.SelectedIndex])).objectName.ToString(); // if (!string.IsNullOrEmpty(selectedObject)) if (clistboxCommodities.CheckedItems.Count > 0) { lblStatus.Text = "Processing.... please wait"; Application.DoEvents(); syncUtility.MDBSynchronization(lstitems); //Task task = new Task(new Action(() => ProcessSync(lstitems))); //task.Start(); //task.Wait(); lblStatus.Text = "Completed"; Application.DoEvents(); } else { MessageBox.Show("Please select the component."); return; } DialogResult dialogResult = MessageBox.Show("Mdb file updated for the selected components. Do you want to continue?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dialogResult == DialogResult.No) { this.Close(); SaveLoggingFile(); } } catch (Exception ex) { lblStatus.Text = "Exception Raised"; Application.DoEvents(); logFile.WriteLine(ex.Message + ex.StackTrace); SaveLoggingFile(); MessageBox.Show("Exception occured please check logFile: " + ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { btnGo.Enabled = true; Application.DoEvents(); } }