private void BtnBrowser_Click(object sender, EventArgs e) { txtBrowser.Text = this.J_OpenFileDialog("Application File | *.exe", "Application File | *.exe", "Choose the exe file to update"); if (txtBrowser.Text == "") { BtnBrowser.Select(); } else { BtnUpdate.Select(); } }
private void BtnBrowser_Click(object sender, EventArgs e) { txtBrowser.Text = cmnService.J_OpenFileDialog("Microsoft Access | *.mdb", "Microsoft Access | *.mdb", "Choose the database to connect"); if (txtBrowser.Text == "") { BtnBrowser.Select(); } else { BtnSubmit.Select(); } }
private bool ValidateFields() { try { if (txtBrowser.Text == "") { cmnService.J_UserMessage("Please choose the database"); BtnBrowser.Select(); return(false); } if (cmnService.J_IsFileExist(txtBrowser.Text) == false) { cmnService.J_UserMessage("Database doesn't exist in selected path"); BtnBrowser.Select(); return(false); } if (cmnService.J_GetFileName(txtBrowser.Text).ToUpper() != J_Var.J_pMsAccessDatabaseName.ToUpper()) { cmnService.J_UserMessage("Invalid Database."); BtnBrowser.Select(); return(false); } if (dmlService.J_ValidateConnection(txtBrowser.Text, J_Var.J_pMsAccessDatabasePassword) == false) { cmnService.J_UserMessage("Connection Failed...."); BtnBrowser.Focus(); return(false); } return(true); } catch { cmnService.J_UserMessage("Verify the Config Information and Try again.... !!"); BtnBrowser.Focus(); return(false); } }
private void BtnUpdate_Click(object sender, EventArgs e) { //+++++++++++++++++++++++++++++++++++++++++++++++++ // R&D to get exe file version //FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(Application.StartupPath + "/" + J_Var.J_pExeFileName + ".exe"); //MessageBox.Show(versionInfo.FileVersion); //+++++++++++++++++++++++++++++++++++++++++++++++++ if (this.J_IsProcessOpen(J_Var.J_pExeFileName) == true) { MessageBox.Show("Application is running.\nPlease close the application.", J_Var.J_pProjectName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } string strSourceFilePath = txtBrowser.Text; if (strSourceFilePath == "" || strSourceFilePath == null) { return; } string strDestinationFolderPath = Application.StartupPath; if (File.Exists(strSourceFilePath) == false) { MessageBox.Show("Selected file does not exist.", J_Var.J_pProjectName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); BtnBrowser.Select(); return; } FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(strSourceFilePath); if (J_Var.J_pExeFileName + ".exe" != Convert.ToString(fileVersionInfo.InternalName)) { MessageBox.Show("Invalid application file.\nPlease select valid application file.", J_Var.J_pProjectName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (this.J_GetDirectoryName(strSourceFilePath).Trim().ToUpper() == strDestinationFolderPath.Trim().ToUpper()) { MessageBox.Show("Selected file is destination path.\nPlease select another source path.", J_Var.J_pProjectName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); BtnBrowser.Select(); return; } if (File.Exists(strDestinationFolderPath + "/" + J_Var.J_pExeFileName + ".exe") == true) { File.Copy(strDestinationFolderPath + "/" + J_Var.J_pExeFileName + ".exe", strDestinationFolderPath + "/" + string.Format("{0:yyyyMMdd}", System.DateTime.Now.Date) + string.Format("{0:HHmmss}", System.DateTime.Now) + "-" + J_Var.J_pExeFileName + ".exe", true); File.Delete(strDestinationFolderPath + "/" + J_Var.J_pExeFileName + ".exe"); } File.Copy(strSourceFilePath, strDestinationFolderPath + "/" + J_Var.J_pExeFileName + ".exe"); if (MessageBox.Show("Want to proceed....", J_Var.J_pProjectName, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { return; } MessageBox.Show("Application successfully updated", J_Var.J_pProjectName, MessageBoxButtons.OK, MessageBoxIcon.Information); if (File.Exists(strDestinationFolderPath + "/" + J_Var.J_pExeFileName + ".exe") == true) { this.Close(); this.Dispose(); Process.Start(strDestinationFolderPath + "/" + J_Var.J_pExeFileName + ".exe"); } }
private void MstUpdateApplication_Load(object sender, EventArgs e) { this.Text = J_Var.J_pProjectName; txtBrowser.Text = ""; BtnBrowser.Select(); }
private void BtnSubmit_Click(object sender, EventArgs e) { try { // all validations if (ValidateFields() == false) { return; } string strDatabasePath = cmnService.J_GetDirectoryName(txtBrowser.Text); // create the connection xml file Hashtable nameValue = new Hashtable(); nameValue.Add("SERVERNAME", ""); nameValue.Add("DATABASENAME", strDatabasePath); nameValue.Add("USERNAME", J_Var.J_pMsAccessDatabaseName); nameValue.Add("PASSWORD", J_Var.J_pMsAccessDatabasePassword); XMLService objxml = new XMLService(); objxml.J_CreateXMLFile(nameValue, Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName); if (dmlService.J_IsDatabaseObjectExist("MST_FAYEAR") == true) { // Close & Dispose the MstLogin Class this.Close(); this.Dispose(); // Close & Dispose the main Class if (J_Var.J_pLoginStatus == 1) { J_Var.frmMain.Close(); J_Var.frmMain.Dispose(); } if (dmlService.J_IsRecordExist("MST_FAYEAR") == true) { dmlService.Dispose(); if (J_Var.J_pLoginScreen == J_LoginScreen.YES) { CmnLogin frm = new CmnLogin(); frm.ShowDialog(); frm.Dispose(); } else if (J_Var.J_pLoginScreen == J_LoginScreen.NO) { J_Var.frmMain = new mdiBillingSystem(); J_Var.frmMain.ShowDialog(); } } else { dmlService.Dispose(); CmnCreate1stFAYear frm = new CmnCreate1stFAYear(); frm.ShowDialog(); frm.Dispose(); } return; } else { dmlService.Dispose(); cmnService.J_UserMessage("Invalid database structure.\nPlease check the database"); BtnBrowser.Focus(); return; } } catch (Exception err_handler) { dmlService.Dispose(); cmnService.J_UserMessage(err_handler.Message); } }
private void SysServerInfoLocalBrowser_Load(object sender, EventArgs e) { txtBrowser.Text = ""; BtnBrowser.Select(); }