コード例 #1
0
ファイル: Install.cs プロジェクト: BruceNielsen/_V4.7-Proxy
        //private string path_to_settings = string.Empty;

        /// <summary>
        /// Constructor
        /// </summary>
        public Install()
        {
            InitializeComponent();

            logger.Log(LogLevel.Info, LogCode("Install.cs: Form Loading."));

            #region Load CustomSettings
            #region Get "My Documents" folder
            string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            path = Path.Combine(path, "FruPak_Settings");

            // Create folder if it doesn't already exist
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);
            #endregion

            // Initialize settings
            Settings = new PhantomCustomSettings();
            Settings.SettingsPath = Path.Combine(path, "FruPak.Phantom.config"); 
            Settings.EncryptionKey = "phantomKey";

            if (!File.Exists(Settings.SettingsPath))
            {
                Settings.Save();
                logger.Log(LogLevel.Info, LogCode("Install.cs: Default settings file created"));
            }
            // Load settings - Normally in Form_Load
            Settings.Load();
            local_path = Settings.Path_Local_Path;
            remote_path = Settings.Path_Remote_Path;
            AcroWrap_path = Settings.Path_AcroWrap_Path; // Don't actually need this here'
            copyAtStartup = Settings.CopyAtStartup;
            CopyDelayInMinutes = Settings.CopyDelayInMinutes;

            // These are accessible from the Logon form, so I don't need to reopen the settings file there
            // Was getting screwed up as the Main_Menu form is actually opened before the logon form,
            // but stays hidden.
            
            //FruPak.PF.Global.Global.Phantom_Dev_Mode = Settings.Phantom_Dev_Mode;
            
            //FruPak.PF.Global.Global.Phantom_Dev_Test = Settings.Phantom_Dev_Test_Mode;
            //FruPak.PF.Global.Global.Phantom_Dev_EnableResize = Settings.Phantom_Dev_EnableResize;

            logger.Log(LogLevel.Info, LogCode("Install.cs: Settings file opened."));

            //path_to_settings = Settings.Path_To_Settings;
            
            // Save settings - Normally in Form_Closing
            //Settings.Save();

            #endregion

        }
コード例 #2
0
ファイル: SendEmail.cs プロジェクト: BruceNielsen/_V4.7-Proxy
        public static string send_mail()
        {
            string str_return = "";
            try
            {
                MailMessage oMsg = new MailMessage();


                foreach (string recipient in Recipient)
                {
                    oMsg.To.Add(recipient);
                }

                if (BCC_Email_Address.Count > 0)
                {
                    foreach (string bcc in BCC_Email_Address)
                    {
                        oMsg.Bcc.Add(bcc);
                    }
                }

                oMsg.From = new MailAddress(From_Email_Address);
                oMsg.Subject = Subject;
                oMsg.Body = message;
                oMsg.IsBodyHtml = IsBodyHtml;

                if (attachment.Count > 0 )
                {
                    foreach (string str_attachment in attachment)
                    {
                        try
                        {
                            Attachment mailAttachment = new Attachment(str_attachment);
                            oMsg.Attachments.Add(mailAttachment);
                        }
                        catch (Exception ex)
                        {
                            logger.Log(LogLevel.Debug, ex.Message);
                        }
                    }
                    attachment.Clear();
                }
                SmtpClient smtp = new SmtpClient();
                
                // Am pretty sure I'm not really needing to do al the load thingy, but until I refactor it all...

                #region Load CustomSettings
                #region Get "Application.StartupPath" folder
                string path = Application.StartupPath;
                #endregion

                // Initialize settings
                Settings = new PhantomCustomSettings();
                Settings.SettingsPath = Path.Combine(path, "FruPak.Phantom.config");
                Settings.EncryptionKey = "phantomKey";

                if (!File.Exists(Settings.SettingsPath))
                {
                    Settings.Save();
                    logger.Log(LogLevel.Info, LogCodeStatic("Default Phantom Settings file created (Sendmail)"));
                }
                // Load settings - Normally in Form_Load
                Settings.Load();

                logger.Log(LogLevel.Info, LogCodeStatic("Settings file opened."));

                #endregion


                //smtp.Host = "FRUPAK-SBS.frupak.local";
                smtp.Host = Settings.Path_SMTP_Host;
                smtp.Credentials = new System.Net.NetworkCredential(Network_UserId, Network_Password);

                smtp.Send(oMsg);
            }
            catch (Exception ex)
            {
                logger.Log(LogLevel.Trace, ex.Message);
                logger.Log(LogLevel.Trace, ex.InnerException);

                MessageBox.Show("Exception: " + 
                    ex.Message.ToString() + 
                    "\r\nInner Exception: " + 
                    ex.InnerException.ToString(), "Email Problem");

                str_return = ex.Message.ToString();
            }                    

            return str_return;
        }
コード例 #3
0
        public BLWO_Labels(int int_wo_Id, int int_C_User_id, bool bol_w_a)
        {
            InitializeComponent();
            logger.Log(LogLevel.Info, LogCode("BLWO_Labels - InitializeComponent"));

            // All this needs to be refactored into a single static class. Will do, but for now...

            #region Load CustomSettings
            #region Get "My Documents" folder
            string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            path = Path.Combine(path, "FruPak_Settings");

            // Create folder if it doesn't already exist
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);
            #endregion

            // Initialize settings
            Settings = new PhantomCustomSettings();
            Settings.SettingsPath = Path.Combine(path, "FruPak.Phantom.config");
            Settings.EncryptionKey = "phantomKey";

            if (!File.Exists(Settings.SettingsPath))
            {
                Settings.Save();
                // This should NEVER happen
                logger.Log(LogLevel.Info, LogCode("BLWO_Labels.cs: Default settings file created"));
            }
            // Load settings - Normally in Form_Load
            Settings.Load();

            logger.Log(LogLevel.Info, LogCode("BLWO_Labels.cs: Settings file opened."));

            #endregion

            int_Current_User_Id = int_C_User_id;
            int_Work_Order_Id = int_wo_Id;

            //populate Work Order Display
            woDisplay1.Work_Order_Id = int_wo_Id;
            woDisplay1.populate();
            DataSet ds_Get_Info;
            DataRow dr_Get_Info;

            ds_Get_Info = FruPak.PF.Data.AccessLayer.CM_Fruit_Variety.Get_Info_std(Convert.ToInt32(woDisplay1.Variety_Id.ToString()));
            for (int i = 0; i < Convert.ToInt32(ds_Get_Info.Tables[0].Rows.Count.ToString()); i++)
            {
                dr_Get_Info = ds_Get_Info.Tables[0].Rows[i];
                str_Variety_desc = dr_Get_Info["Description"].ToString();
            }
            ds_Get_Info.Dispose();

            //restrict access
            bol_write_access = bol_w_a;
            btn_Add.Enabled = bol_w_a;


            //if (FruPak.PF.Global.Global.bol_Testing == true)
            //{
            //    this.Text = "FruPak Process Factory - " + this.Text + " - Test Environment";
            //}
            //else
            //{
            //    this.Text = "FruPak Process Factory";
            //}

            populate_Combobox();

            AddColumnsProgrammatically();
            populate_datagridview();

            #region Log any interesting events from the UI to the CSV log file
            foreach (Control c in this.Controls)
            {
                if (c.GetType() == typeof(Button))
                {
                    c.Click += new EventHandler(this.Control_Click);
                }
                else if (c.GetType() == typeof(TextBox))
                {
                    c.Validated += new EventHandler(this.Control_Validated);
                }
                else if (c.GetType() == typeof(ComboBox))
                {
                    ComboBox cb = (ComboBox)c;
                    cb.SelectedValueChanged += new EventHandler(this.Control_SelectedValueChanged);
                }
                else if (c.GetType() == typeof(DateTimePicker))
                {
                    DateTimePicker dtp = (DateTimePicker)c;
                    dtp.ValueChanged += new EventHandler(this.Control_ValueChanged);
                }
                else if (c.GetType() == typeof(NumericUpDown))
                {
                    NumericUpDown nud = (NumericUpDown)c;
                    nud.ValueChanged += new EventHandler(this.Control_NudValueChanged);
                }
                else if (c.GetType() == typeof(CheckBox))
                {
                    CheckBox cb = (CheckBox)c;
                    cb.CheckedChanged += new EventHandler(this.Control_CheckedChanged);
                }

                else if (c.GetType() == typeof(FruPak.PF.Utils.UserControls.Customer))
                {
                    FruPak.PF.Utils.UserControls.Customer cust = (FruPak.PF.Utils.UserControls.Customer)c;
                    cust.CustomerChanged += new EventHandler(this.CustomerControl_CustomerChanged);
                }
            }
            #endregion

        }
コード例 #4
0
ファイル: WO_Labels.cs プロジェクト: BruceNielsen/_V4.7-Proxy
        /// <summary>
        /// Parameterless constructor to avoid designer error - Phantom 12/12/2014
        /// refers to Tablet_WO_Labels, which inherits from this class
        /// </summary>
        public WO_Labels()
        {
            #region Load CustomSettings
            #region Get "My Documents" folder
            string path = Application.StartupPath;
            // string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            //path = Path.Combine(path, "FruPak_Settings"); // Creates a subfolder

            // Create folder if it doesn't already exist
            //if (!Directory.Exists(path))
            //    Directory.CreateDirectory(path);
            #endregion

            // Initialize settings
            Settings = new PhantomCustomSettings();
            Settings.SettingsPath = Path.Combine(path, "FruPak.Phantom.config");
            Settings.EncryptionKey = "phantomKey";

            if (!File.Exists(Settings.SettingsPath))
            {
                Settings.Save();
                logger.Log(LogLevel.Info, LogCode("Default Phantom Settings file created"));
            }
            // Load settings - Normally in Form_Load
            Settings.Load();

            logger.Log(LogLevel.Info, LogCode("Settings file opened."));

            //local_path = Settings.Path_Local_Path;
            //remote_path = Settings.Path_Remote_Path;
            //path_to_settings = Settings.Path_To_Settings;

            // Save settings - Normally in Form_Closing
            //Settings.Save();

            #endregion

            #region Log any interesting events from the UI to the CSV log file
            foreach (Control c in this.Controls)
            {
                if (c.GetType() == typeof(Button))
                {
                    c.Click += new EventHandler(this.Control_Click);
                }
                else if (c.GetType() == typeof(TextBox))
                {
                    c.Validated += new EventHandler(this.Control_Validated);
                }
                else if (c.GetType() == typeof(ComboBox))
                {
                    ComboBox cb = (ComboBox)c;
                    cb.SelectedValueChanged += new EventHandler(this.Control_SelectedValueChanged);
                }
                else if (c.GetType() == typeof(DateTimePicker))
                {
                    DateTimePicker dtp = (DateTimePicker)c;
                    dtp.ValueChanged += new EventHandler(this.Control_ValueChanged);
                }
                else if (c.GetType() == typeof(NumericUpDown))
                {
                    NumericUpDown nud = (NumericUpDown)c;
                    nud.ValueChanged += new EventHandler(this.Control_NudValueChanged);
                }
                else if (c.GetType() == typeof(CheckBox))
                {
                    CheckBox cb = (CheckBox)c;
                    cb.CheckedChanged += new EventHandler(this.Control_CheckedChanged);
                }

                else if (c.GetType() == typeof(FruPak.PF.Utils.UserControls.Customer))
                {
                    FruPak.PF.Utils.UserControls.Customer cust = (FruPak.PF.Utils.UserControls.Customer)c;
                    cust.CustomerChanged += new EventHandler(this.CustomerControl_CustomerChanged);
                }
            }
            #endregion

        }
コード例 #5
0
ファイル: DConfig.cs プロジェクト: BruceNielsen/_V4.7-Proxy
		private DConfig()
		{
			#region Load CustomSettings
			#region Get "My Documents" folder
			string path = Application.StartupPath;
			// string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
			//path = Path.Combine(path, "FruPak_Settings"); // Creates a subfolder

			// Create folder if it doesn't already exist
			//if (!Directory.Exists(path))
			//    Directory.CreateDirectory(path);
			#endregion

			// Initialize settings
			Settings = new PhantomCustomSettings();
			Settings.SettingsPath = Path.Combine(path, "FruPak.Phantom.config");
			Settings.EncryptionKey = "phantomKey";

			if (!File.Exists(Settings.SettingsPath))
			{
				Settings.Save();
				logger.Log(LogLevel.Info, LogCode("Default Phantom Settings file created"));
			}
			// Load settings - Normally in Form_Load
			Settings.Load();

			//logger.Log(LogLevel.Info, LogCode("Settings file opened.");

			//local_path = Settings.Path_Local_Path;
			//remote_path = Settings.Path_Remote_Path;
			//path_to_settings = Settings.Path_To_Settings;

			// Save settings - Normally in Form_Closing
			//Settings.Save();

			#endregion

			if (FruPak.PF.Global.Global.bol_Testing == true)
			{
				if (Settings.Phantom_Dev_Use_FruPak_SQL == true)
				{
					#region FRUPAK-SQL Test mode
					SQLAccessLayer.ConnectionString = @"Provider=sqloledb;" +
												"Server=" + Settings.TestMode_Server + ";" +
												"Database=" + Settings.TestMode_Database + ";" +
												"User Id=" + Settings.TestMode_User_Id + ";" +
												"Password="******";";

					logger.Log(LogLevel.Info, LogCode("Dev mode connection string = " + SQLAccessLayer.ConnectionString));

					#region Original hardcoded string
					//                SQLAccessLayer.ConnectionString = @"Provider=sqloledb;
					//				                                                Server=FRUPAK-SQL;
					//				                                                Database=Process_Factory_Test;
					//				                                                User Id=jobs;
					//				                                                Password=jobs;";
					
					#endregion
					#endregion

				}
				else
				{
					#region Bruce-Laptop Test mode
					SQLAccessLayer.ConnectionString = @"Provider=sqloledb;" +
												"Server=" + Settings.Phantom_Dev_TestMode_Server + ";" +
												"Database=" + Settings.Phantom_Dev_TestMode_Database + ";" +
												"User Id=" + Settings.Phantom_Dev_TestMode_User_Id + ";" +
												"Password="******";";

					logger.Log(LogLevel.Info, LogCode("Dev mode connection string = " + SQLAccessLayer.ConnectionString));

					#region Original hardcoded string
					//                SQLAccessLayer.ConnectionString = @"Provider=sqloledb;
					//												Server=Bruce-Laptop;
					//												Database=Process_Factory_Test;
					//												User Id=jobs;
					//												Password=jobs;"; 
					#endregion


					#endregion                
				}

			}
			else
			{
				if (Settings.Phantom_Dev_Use_FruPak_SQL == true)
				{
				   #region FRUPAK-SQL Production Mode
					SQLAccessLayer.ConnectionString = @"Provider=sqloledb;" +
												"Server=" + Settings.ProductionMode_Server + ";" +
												"Database=" + Settings.ProductionMode_Database + ";" +
												"User Id=" + Settings.ProductionMode_User_Id + ";" +
												"Password="******";";

					//logger.Log(LogLevel.Info, LogCode("Production mode connection string = " + SQLAccessLayer.ConnectionString);

					#region Original hardcoded string
					//                SQLAccessLayer.ConnectionString = @"Provider=sqloledb;
					//				                                                Server=FRUPAK-SQL;
					//				                                                Database=Process_Factory;
					//				                                                User Id=jobs;
					//				                                                Password=jobs;";

					#endregion
					#endregion
				}
				else
				{
 
					#region Bruce-Laptop Production Mode
					SQLAccessLayer.ConnectionString = @"Provider=sqloledb;" +
												"Server=" + Settings.Phantom_Dev_ProductionMode_Server + ";" +
												"Database=" + Settings.Phantom_Dev_ProductionMode_Database + ";" +
												"User Id=" + Settings.Phantom_Dev_ProductionMode_User_Id + ";" +
												"Password="******";";

					//logger.Log(LogLevel.Info, LogCode("Production mode connection string = " + SQLAccessLayer.ConnectionString);

					#region Original hardcoded string
					//                SQLAccessLayer.ConnectionString = @"Provider=sqloledb;
					//												Server=Bruce-Laptop;
					//												Database=Process_Factory;
					//												User Id=jobs;
					//												Password=jobs;"; 
					#endregion

					#endregion                
				}
			}
		}