Exemple #1
0
        public FormServer()
        {
            InitializeComponent();
            Utility   = new Utilities();
            RLD       = new RossLiveRespository();
            RossCfg   = RLD.GetRossCfg();
            SysConfig = Utility.GetSysCfg();
            ERP       = new ERPRepository(SysConfig.ERPConn);
            PLM       = new PLMRespository(SysConfig.PLMConn, RossCfg.Units);

            BscData = new BasicDatas(SysConfig.ERPConn, SysConfig.PLMConn);

            StartTime      = DateTime.Now;
            startTime.Text = "启动时间:" + StartTime.ToString();
            notifyMenuItem_start.Enabled = false;
            notifyMenuItem_stop.Enabled  = true;

            UpdateLogs UptLog = new UpdateLogs();

            UptLog.CompleteLog = "Start System Background Service";
            UptLog.LogTitle    = "Start System Service";
            UptLog.Status      = "OK";
            RLD.InsertUptLog(UptLog);

            this.Text = Application.ProductName + " v" + Application.ProductVersion;
        }
Exemple #2
0
        public int InsertUptLog(UpdateLogs input)
        {
            int result = 0;

            try
            {
                RLDB.UpdateLogs.Add(input);
                result = RLDB.SaveChanges();
            }
            catch { }
            return(result);
        }
Exemple #3
0
        public void InvokeUpdateEvent(string message, MessageTypeEnum type)
        {
            Log log = new Log {
                Type = Enum.GetName(typeof(MessageTypeEnum), type), Message = message
            };

            string[] args = new string[2];

            // args[0] = EntryType, args[1] = Message
            args[0] = log.Type;
            args[1] = log.Message;
            CommandRecievedEventArgs crea = new CommandRecievedEventArgs((int)CommandEnum.AddLog, args, null);

            if (UpdateLogs != null)
            {
                UpdateLogs?.Invoke(crea);
            }
        }
Exemple #4
0
        private void processSync_Exited(object sender, EventArgs e)
        {
            processSync.Close();
            processSync = null;
            ProcessDelegate ProDeleg = delegate()
            {
                string ErrorTxt    = SaveFolderPath + "\\PART_UPDATE.xls.Errors.txt";
                string CompleteTxt = SaveFolderPath + "\\PART_UPDATE.xls.CompleteLog.txt";
                tProgBar.Value         = 100;
                toolBtnRefresh.Enabled = true;
                timerMain.Enabled      = false;
                var parts = UptParts.Select(o => o.PartNum).ToList();

                UpdateLogs UptLog = new UpdateLogs();
                UptLog.LogTitle = "Part Auto Update Task";
                UptLog.PartNums = JsonConvert.SerializeObject(parts);
                if (File.Exists(ErrorTxt))
                {
                    rtboxUpdateDtl.Text = Utility.TxtRead(ErrorTxt);
                    UptLog.ErrorLog     = Utility.TxtRead(ErrorTxt);
                    UptLog.Status       = "Error";
                }
                if (File.Exists(CompleteTxt))
                {
                    rtboxUpdateDtl.Text = Utility.TxtRead(CompleteTxt);
                    UptLog.CompleteLog  = Utility.TxtRead(CompleteTxt);
                    UptLog.Status       = "OK";
                }
                RLD.InsertUptLog(UptLog);
                LastUptTime = DateTime.Now;
            };

            if (this.InvokeRequired)
            {
                this.Invoke(ProDeleg);
            }
        }