Esempio n. 1
0
        public static bool PPCClose(SysMonitoring monitorInfo)
        {
            try
            {
                List<SysMonitoring> lists = SysMonitoringBL.GetInstance().GetRecords(monitorInfo);
                if (lists != null && lists.Count > 0)
                {
                    monitorInfo.sym_dMarkTime = System.DateTime.Now;
                    monitorInfo.sym_dUpdateTime = System.DateTime.Now;
                    monitorInfo.sym_cSystemIP = NetUtil.GetIPAddress();
                    monitorInfo.sym_MACAddress = NetUtil.GetMACAddress();
                    monitorInfo.sym_iStatus = (int)CustEnum.SysState.關閉;
                    return SysMonitoringBL.GetInstance().Update(monitorInfo).boolValue;
                }
                else
                {

                    SysMonitoringBL.GetInstance().RegisterPPC(monitorInfo);
                    return true;
                }

            }
            catch (Exception ex)
            {
                Common.General.BLLoger.Info("PPCStatusManage.UpdatePPCStatus", ex);
            }

            return false;
        }
Esempio n. 2
0
        public ReturnValueInfo Delete(SysMonitoring objInfo)
        {
            ReturnValueInfo returnInfo = new ReturnValueInfo(false);
            try
            {
                using (MainDBDataContext db = new MainDBDataContext())
                {
                    var delTab = db.SystemMonitoring_sym.Where(t => t.sym_MACAddress == objInfo.sym_MACAddress);
                    if (delTab != null)
                    {
                        foreach (var item in delTab)
                        {
                            db.SystemMonitoring_sym.DeleteOnSubmit(item);
                        }

                        db.SubmitChanges();
                        returnInfo.boolValue = true;
                    }
                }
            }
            catch (Exception Ex)
            {
                returnInfo.messageText = Ex.Message;
            }
            return returnInfo;
        }
Esempio n. 3
0
        public ReturnValueInfo Update(SysMonitoring objInfo)
        {
            Common.General.DALoger.Debug("call SysMonitoringDA.Update");
            MainDBDataContext db = null;
            ReturnValueInfo returnValue = new ReturnValueInfo();
            if (objInfo != null)
            {
                try
                {
                    using (db = new MainDBDataContext())
                    {
                        SystemMonitoring_sym query = db.SystemMonitoring_sym.SingleOrDefault(t => t.sym_iSystemID == objInfo.sym_iSystemID);
                        if (query != null)
                        {
                            query.sym_cProcessName = objInfo.sym_cProcessName;
                            query.sym_cSystemName = objInfo.sym_cSystemName;
                            query.sym_cSystemType = objInfo.sym_cSystemType;
                            query.sym_cVersion = objInfo.sym_cVersion;
                            query.sym_dLastTime = objInfo.sym_dLastTime;
                            query.sym_dMarkTime = objInfo.sym_dMarkTime;
                            query.sym_dStartTime = objInfo.sym_dStartTime;
                            query.sym_dUpdateTime = objInfo.sym_dUpdateTime;
                            query.sym_iStatus = objInfo.sym_iStatus;
                            query.sym_lIsPLCConnection = objInfo.sym_lIsPLCConnection;
                            query.sym_cSoftwareNo = objInfo.sym_cSoftwareNo;
                            query.sym_cSystemIP = objInfo.sym_cSystemIP;
                            query.sym_MACAddress = objInfo.sym_MACAddress;
                            query.sym_cMachineID = objInfo.sym_cMachineID;
                            db.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);
                        }

                        returnValue.boolValue = true;
                        returnValue.isError = false;
                        returnValue.ValueObject = query;
                        returnValue.messageText = "保存成功";
                    }
                }
                catch (System.Data.Linq.ChangeConflictException ex)
                {
                    Common.General.DALoger.Error(ex);
                }

            }
            return returnValue;
        }
Esempio n. 4
0
 public List<SysMonitoring> GetRecords(SysMonitoring objInfo)
 {
     try
     {
         if (objInfo == null)
         {
             return null;
         }
         using (MainDBDataContext db = new MainDBDataContext())
         {
             db.Log = Console.Out;
             var qur = from Sysm in db.SystemMonitoring_sym
                       where (objInfo.sym_iStatus == 0 || objInfo.sym_iStatus == Sysm.sym_iStatus) &&
                           (objInfo.sym_MACAddress.Length == 0 || objInfo.sym_MACAddress == Sysm.sym_MACAddress) &&
                           (objInfo.sym_cSystemIP.Length == 0 || objInfo.sym_cSystemIP == Sysm.sym_cSystemIP) &&
                           (objInfo.sym_iSystemID == 0 || objInfo.sym_iSystemID == Sysm.sym_iSystemID)
                       select new SysMonitoring
                       {
                           sym_MACAddress = Sysm.sym_MACAddress,
                           sym_iSystemID = Sysm.sym_iSystemID,
                           sym_cSystemType = Sysm.sym_cSystemType,
                           sym_cSystemName = Sysm.sym_cSystemName,
                           sym_cSystemIP = Sysm.sym_cSystemIP,
                           sym_dStartTime = Sysm.sym_dStartTime,
                           sym_iStatus = Sysm.sym_iStatus,
                           sym_dUpdateTime = Sysm.sym_dUpdateTime,
                           sym_cVersion = Sysm.sym_cVersion,
                           sym_cProcessName = Sysm.sym_cProcessName,
                           sym_lIsPLCConnection = Sysm.sym_lIsPLCConnection,
                           sym_dMarkTime = Sysm.sym_dMarkTime,
                           sym_dAddTime = Sysm.sym_dAddTime,
                           sym_dLastTime = Sysm.sym_dLastTime,
                           sym_cMachineID = Sysm.sym_cMachineID,
                           sym_cSoftwareNo = Sysm.sym_cSoftwareNo
                       };
             return qur.ToList();
         }
     }
     catch (Exception ex)
     {
         Common.General.DALoger.Error(ex);
         throw ex;
     }
 }
Esempio n. 5
0
        public ReturnValueInfo Insert(SysMonitoring objInfo)
        {
            ReturnValueInfo returnValue = new ReturnValueInfo();

            if (objInfo != null)
            {
                try
                {
                    using (MainDBDataContext db = new MainDBDataContext())
                    {
                        //objInfo.not_RecordID = Guid.NewGuid();

                        LinqToSQLModel.SystemMonitoring_sym newTab = Common.General.CopyObjectValue<Model.HBPMS.BusinessModel.SysMonitoring, LinqToSQLModel.SystemMonitoring_sym>(objInfo);

                        newTab.sym_dAddTime = DateTime.Now;
                        newTab.sym_dLastTime = DateTime.Now;
                        newTab.sym_dMarkTime = DateTime.Now;
                        newTab.sym_dUpdateTime = DateTime.Now;
                        newTab.sym_dStartTime = DateTime.Now;

                        db.SystemMonitoring_sym.InsertOnSubmit(newTab);
                        db.SubmitChanges();

                        objInfo.sym_iSystemID = newTab.sym_iSystemID;
                    }
                }
                catch (Exception ex)
                {
                    Common.General.DALoger.Debug("保存系統監控狀態記錄失败", ex);
                }
            }

            return null;
        }
Esempio n. 6
0
        public ReturnValueInfo RegisterPPC(SysMonitoring objInfo)
        {
            throw new NotImplementedException();
            //ReturnValueInfo returnValueInfo = null;
            //try
            //{
            //    objInfo.sym_cSystemIP = NetUtil.GetIPAddress();
            //    objInfo.sym_MACAddress = NetUtil.GetMACAddress();
            //    objInfo.sym_dUpdateTime = DateTime.Now;
            //    objInfo.sym_dLastTime = DateTime.Now;
            //    objInfo.sym_dMarkTime = DateTime.Now;
            //    objInfo.sym_dStartTime = DateTime.Now;
            //    objInfo.sym_cSoftwareNo = string.Empty;

            //    ReturnValueInfo result = this._ISysMonitoringDA.Insert(objInfo);
            //    if (result.boolValue)
            //    {
            //        ICRUD crud = new CRUD();
            //        LocalInfomation_lcif_Info info = new LocalInfomation_lcif_Info();
            //        info.lcif_cKey = CustEnum.LocalInfoCacheKey.SystemID.ToString();
            //        info.lcif_cValue = objInfo.sym_iSystemID.ToString();
            //        return crud.Update(info);
            //    }

            //}
            //catch (Exception ex)
            //{
            //    returnValueInfo = new ReturnValueInfo();
            //    returnValueInfo.boolValue = false;
            //    returnValueInfo.messageText = ex.Message;
            //}

            //return returnValueInfo;
        }
Esempio n. 7
0
 public ReturnValueInfo Insert(SysMonitoring objInfo)
 {
     return this._ISysMonitoringDA.Insert(objInfo);
 }
Esempio n. 8
0
 public List<SysMonitoring> GetRecords(SysMonitoring objInfo)
 {
     return this._ISysMonitoringDA.GetRecords(objInfo);
 }
Esempio n. 9
0
 public ReturnValueInfo Delete(SysMonitoring objInfo)
 {
     return this._ISysMonitoringDA.Delete(objInfo);
 }
Esempio n. 10
0
 public ReturnValueInfo Update(SysMonitoring objInfo)
 {
     Common.General.BLLoger.Debug("call SysMonitoringBL.Update");
     return this._ISysMonitoringDA.Update(objInfo);
 }