public Processing(CruiseDesignMain Main, string dalPathRecon, bool recExists, bool prodFile)
        {
            this.Main = Main;
             Main.errFlag = 0;
             InitializeComponent();
             // check if file is processed
             if(prodFile)
             {
            if (!checkProcessedFile(Main.cdDAL))
            {
               // if not, set error code, return
               Main.errFlag = 1;
               MessageBox.Show("Cruise Not Processed. Please Process Cruise Before Continuing.", "Warning");
               return;
            }
             }

             df.cdDAL = Main.cdDAL;
             df.rFile = dalPathRecon;
             df.reconExists = recExists;
             df.prodFile = prodFile;

             this.backgroundWorker1.RunWorkerAsync(df);
             // background worker
        }
        public Working(CruiseDesignMain Main, string dalPathRecon, bool reconExists, int err)
        {
            InitializeComponent();

             if(!reconExists)
             {
            Finish(true);
             }
             else if (reconExists)
             {
            // create or open DAL
            if (!Main.openDesignFile())
            {
               MessageBox.Show("Unable to create the design file", "Information");
               err = 1;
            }
            else
            {

               df.cdDAL = Main.cdDAL;
               df.rFile = dalPathRecon;

               this.backgroundWorker1.RunWorkerAsync(df);
               err = 0;
               // background worker
            }
             }
        }
        public Processing(CruiseDesignMain Main, string dalPathRecon, bool recExists)
        {
            this.Main = Main;

             InitializeComponent();

             df.cdDAL = Main.cdDAL;
             df.rFile = dalPathRecon;
             df.reconExists = recExists;

             this.backgroundWorker1.RunWorkerAsync(df);
             // background worker
        }
        public ProductionDesignMain(CruiseDesignMain Main)
        {
            InitializeComponent();

             cdDAL = Main.cdDAL;
             InitializeDatabaseTables();
             InitializeDataBindings();
             double saleError = getSaleError();

             textBoxError.Text = (Math.Round(saleError, 2)).ToString();
             double totVolume = cdStratumStats.Sum(P => P.TotalVolume);
             textBoxVolume.Text = (Math.Round(totVolume, 0)).ToString();
        }
        public DesignMain(CruiseDesignMain Main, string dalPathRecon)
        {
            InitializeComponent();
             /*    if (dalPathRecon.Length > 0)
             {
            reconExists = true;
            try
            {
               this.rDAL = new DAL(dalPathRecon);
            }
            catch (System.IO.IOException e)
            {
               Logger.Log.E(e);
            }
            catch (System.Exception e)
            {
               Logger.Log.E(e);
            }
             }
             else
            this.reconExists = false;
             try
             {
            this.cdDAL = new DAL(dalPathDesign);
             }
             catch (System.IO.IOException e)
             {
            Logger.Log.E(e);
            //TODO display error message to user
             }
             catch (System.Exception e)
             {
            Logger.Log.E(e);
             }
             */
             cdDAL = Main.cdDAL;
             InitializeDatabaseTables();
             InitializeDataBindings();
             getCostData();

             double saleError = getSaleError();

             textBoxError.Text = (Math.Round(saleError, 2)).ToString();
             double totVolume = cdStratumStats.Sum(P => P.TotalVolume);
             textBoxVolume.Text = (Math.Round(totVolume, 0)).ToString();
             textBoxCost.Text = (Math.Round(saleCost, 0)).ToString();
             //textBoxCost.Text = "0";
             dalPathR = dalPathRecon;
        }
        public Working(CruiseDesignMain Main, string dalPathRecon, bool reconExists)
        {
            InitializeComponent();

             if(!reconExists)
             {
            Finish(true);
             }
             else if (reconExists)
             {
            df.cdDAL = Main.cdDAL;
            df.rFile = dalPathRecon;

            this.backgroundWorker1.RunWorkerAsync(df);
            // background worker
             }
        }
        public DesignMain(CruiseDesignMain Main, string dalPathRecon)
        {
            InitializeComponent();

             cdDAL = Main.cdDAL;
             InitializeDatabaseTables();
             InitializeDataBindings();
             getCostData();

             double saleError = getSaleError();

             textBoxError.Text = (Math.Round(saleError, 2)).ToString();
             double totVolume = cdStratumStats.Sum(P => P.TotalVolume);
             textBoxVolume.Text = (Math.Round(totVolume, 0)).ToString();
             textBoxCost.Text = (Math.Round(saleCost, 0)).ToString();
             //textBoxCost.Text = "0";
             dalPathR = dalPathRecon;
        }
 public SaleSetupPage(CruiseDesignMain Main)
 {
     InitializeComponent();
      df.cdDAL = Main.cdDAL;
 }