Ejemplo n.º 1
0
        private bool SetEnvironment()
        {
            bool          blnEmployeeMandatory = false;
            string        strUser = "******";//Environment.UserName; //"scanstation08"; //
            clEnvironment MESE    = new clEnvironment();

            this.env             = MESE.SetEnvironment(strUser);
            blnEmployeeMandatory = AuthorizationEnabled();
            return(blnEmployeeMandatory);
        }
Ejemplo n.º 2
0
        public BelMES()
        {
            try
            {
                //String userName = "******";
                //this.Env = this.Env.SetEnvironment(userName);
                this.Env = this.Env.SetEnvironment();
                if (this.Env != null)
                {
                    if ((this.Env.strComputer == "") || (this.Env.strComputer == null))
                    {
                        this.LogFileName = String.Concat(Environment.MachineName, "_", String.Format("{0:yyyMMdd}", DateTime.Now), ".txt");
                    }
                    else
                    {
                        this.LogFileName = String.Concat(this.Env.strComputer, "_", String.Format("{0:yyyyMMdd}", DateTime.Now), ".txt");
                    }
                    if (this.Env.blnAuthorizationPaused != false)
                    {
                        this.Env.blnAuthorizationPaused = false;
                    }
                    this.Activated    = true;
                    this.Env.Employee = this.Emp;
                    this.WriteLogData("");
                }
                else
                {
                    this.LogFileName = String.Concat(Environment.MachineName, "_", String.Format("{0:yyyyMMdd}", DateTime.Now), ".txt");
                }

                if (!File.Exists(String.Concat(this.LogFilePath, this.LogFileName)))
                {
                    File.Create(String.Concat(this.LogFilePath, this.LogFileName));
                }
            }
            catch
            {
                this.WriteLogData("");
                this.Activated = false;
            }
        }
Ejemplo n.º 3
0
        public BelMES(String StationName, String ConfigDirectory, String ActualProgramVersion)
        {
            if (StationName == "")
            {
                return;
            }
            try
            {
                this.ActualProgramVersion = ActualProgramVersion;
                this.Env = new clEnvironment();
                this.Env = this.Env.SetEnvironment();
                //this.Env = this.Env.SetEnvironment("finalinspectionhev01");
                if (this.Env != null)
                {
                    if ((this.Env.strComputer == "") || (this.Env.strComputer == null))
                    {
                        this.LogFileName = String.Concat(StationName, "_", String.Format("{0:yyyMMdd}", DateTime.Now), ".txt");
                    }
                    else
                    {
                        this.LogFileName = String.Concat(this.Env.strComputer, "_", String.Format("{0:yyyyMMdd}", DateTime.Now), ".txt");
                    }
                    if (this.Env.blnAuthorizationPaused != false)
                    {
                        this.Env.blnAuthorizationPaused = false;
                    }
                    this.Activated    = true;
                    this.Env.Employee = new clEmployee();
                }
                else
                {
                    this.LogFileName = String.Concat(StationName, "_", String.Format("{0:yyyyMMdd}", DateTime.Now), ".txt");
                }

                if (!File.Exists(String.Concat(this.LogFilePath, this.LogFileName)))
                {
                    File.Create(String.Concat(this.LogFilePath, this.LogFileName)).Close();

                    try
                    {
                        String newLine = String.Concat("SWVERSION;DATETIME;TRACEPOINT;PCNAME;EMPLOYEENUMBER;SERIALNUMBER;strWO_SerialNumber;strItem;blnAuthorized;blnMustTraced;blnTraceItemStart;strTestKind;strStatus;strResult;intReturnCode;strSQLDatabase;strSQLServer;blnAuthorizationPaused;Activated;ExtendedInfo");

                        StreamWriter sr = new StreamWriter(String.Concat(this.LogFilePath, this.LogFileName), true);
                        sr.WriteLine(newLine);
                        sr.Close();
                        sr.Dispose();
                    }
                    catch (Exception ex)
                    {
                        if (ex.ToString().IndexOf("is no longer available") > -1)
                        {
                            MessageBox.Show(String.Concat("Nie je dostupna siet.", "\n", ex.Data.ToString()), "CHYBA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            MessageBox.Show(String.Concat(ex.Message, "\n", ex.Data.ToString()));
                        }
                    }
                }

                this.ConfigDirectory = ConfigDirectory;

                this.WriteLogData("");
            }
            catch
            {
                this.WriteLogData("");
                this.Activated = false;
            }
        }