FolderWidget/frmMain.cs
/// <summary>
/// Deploying algorithm:
/// copies from QA to PROD
/// </summary>
Deploying algorithm:
copies from QA to PROD
Deploying algorithm : copies from QA to PROD
private void btnDeployToProd_Click(object sender, EventArgs e)
        {
            List<string> files = Directory.EnumerateFiles(ConfigurationManager.AppSettings["deployToQAPath"], "*.*", SearchOption.AllDirectories)
                                .Where(n => Path.GetExtension(n) == ".zip").ToList();
            if (files.Count() == 0)
            {
                this.Visible = false;
                MessageBox.Show("nothing to deploy");
                this.Visible = true;
                Process.Start(ConfigurationManager.AppSettings["deployToQAPath"]);
                Process.Start(ConfigurationManager.AppSettings["deployToProdPath"]);
                return;
            }
            string filesString = Environment.NewLine;
            foreach (var fileToDeploy in files)
            {
                filesString = filesString + "• " + Path.GetFileName(fileToDeploy.ToString()) + Environment.NewLine;
            }
            this.Visible = false;
            if (MessageBox.Show("Are you sure you want to deploy these files:" + filesString, "FolderWidget", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                try
                {
                    foreach (var fileToDeploy in files)
                    {
                        string deployedPath = fileToDeploy.Replace(ConfigurationManager.AppSettings["deployToQAPath"], ConfigurationManager.AppSettings["deployToProdPath"]);
                        File.Copy(fileToDeploy, deployedPath, true);
                    }
                    MessageBox.Show("Files Deployed successfully");
                    clsFileManager.WriteError("new Deployment", filesString);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("an error occured");
                    clsFileManager.WriteError(ex.Message, ex.StackTrace);
                    Process.Start(ConfigurationManager.AppSettings["deployToQAPath"]);
                    Process.Start(ConfigurationManager.AppSettings["deployToProdPath"]);
                }
            }
            this.Visible = true;
        }
private void btnDeployToProd_Click ( object sender , EventArgs e ) { List < string > files = Directory . EnumerateFiles ( ConfigurationManager . AppSettings [ " " ] , " " , SearchOption . AllDirectories ) . Where ( n => Path . GetExtension ( n ) == " " ) . ToList ( ) ; if ( files . Count ( ) == 0 ) { this . Visible = false ; MessageBox . Show ( " " ) ; this . Visible = true ; Process . Start ( ConfigurationManager . AppSettings [ " " ] ) ; Process . Start ( ConfigurationManager . AppSettings [ " " ] ) ; return ; } string filesString = Environment . NewLine ; foreach ( var fileToDeploy in files ) { filesString = filesString + " + P th.G e tFileName(f i leToDeploy.T o String() ) + E vironment.N e wLine; } this . Visible = false ; if ( MessageBox . Show ( " " + filesString , " " , MessageBoxButtons . YesNo ) == DialogResult . Yes ) { try { foreach ( var fileToDeploy in files ) { string deployedPath = fileToDeploy . Replace ( ConfigurationManager . AppSettings [ " " ] , ConfigurationManager . AppSettings [ " " ] ) ; File . Copy ( fileToDeploy , deployedPath , true ) ; } MessageBox . Show ( " " ) ; clsFileManager . WriteError ( " " , filesString ) ; } catch ( Exception ex ) { MessageBox . Show ( " " ) ; clsFileManager . WriteError ( ex . Message , ex . StackTrace ) ; Process . Start ( ConfigurationManager . AppSettings [ " " ] ) ; Process . Start ( ConfigurationManager . AppSettings [ " " ] ) ; } } this . Visible = true ; }
Deploying algorithm:
copies from QA to PROD
Deploying algorithm : copies from QA to PROD
sender
object
e
EventArgs