Ejemplo n.º 1
0
        public void Init()
        {
            WorkstationBll         bll   = new WorkstationBll(AppSettings.CurrentSetting.ParkConnect);
            List <WorkStationInfo> items = bll.GetAllWorkstations().QueryObjects;

            this.Items.Clear();
            this.Items.Add(string.Empty);
            if (items != null && items.Count > 0)
            {
                foreach (WorkStationInfo station in items)
                {
                    this.Items.Add(station.StationName);
                }
            }
            if (!OnlyStation)
            {
                List <APM> apms = (new APMBll(AppSettings.CurrentSetting.ParkConnect)).GetAllItems().QueryObjects;
                if (apms != null && apms.Count > 0)
                {
                    foreach (APM apm in apms)
                    {
                        this.Items.Add(apm.SerialNum);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected override bool DeletingItem(object item)
        {
            WorkStationInfo info   = (WorkStationInfo)item;
            CommandResult   result = bll.Delete(info);

            if (result.Result == ResultCode.Successful && DataBaseConnectionsManager.Current.StandbyConnected)
            {
                WorkstationBll swbll = new WorkstationBll(AppSettings.CurrentSetting.CurrentStandbyConnect);
                swbll.Delete(info);
            }
            return(result.Result == ResultCode.Successful);
        }
Ejemplo n.º 3
0
        protected override CommandResult AddItem(object addingItem)
        {
            WorkStationInfo info   = (WorkStationInfo)addingItem;
            CommandResult   result = bll.Insert((WorkStationInfo)addingItem);

            if (result.Result == ResultCode.Successful && DataBaseConnectionsManager.Current.StandbyConnected)
            {
                WorkstationBll swbll = new WorkstationBll(AppSettings.CurrentSetting.CurrentStandbyConnect);
                swbll.UpdateOrInsert(info);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public void Init()
        {
            WorkstationBll         bll   = new WorkstationBll(Ralid.Park.BusinessModel.Configuration.AppSettings.CurrentSetting.AvailableParkConnect);
            List <WorkStationInfo> items = bll.GetAllWorkstations().QueryObjects;

            this.Items.Clear();
            items.Insert(0, new WorkStationInfo());
            this.DataSource    = items;
            this.DisplayMember = "StationName";
            this.ValueMember   = "StationID";
            this.SelectedIndex = 0;
            this.DropDownStyle = ComboBoxStyle.DropDownList;
        }
Ejemplo n.º 5
0
        private void SetCurrentStation()
        {
            string         workstationID = AppSettings.CurrentSetting.WorkstationID;
            WorkstationBll wbll          = new WorkstationBll(AppSettings.CurrentSetting.MasterParkConnect);

            if (!string.IsNullOrEmpty(workstationID))
            {
                WorkStationInfo.CurrentStation = wbll.GetWorkStationByID(workstationID);
            }
            if (WorkStationInfo.CurrentStation == null)
            {
                mnu_SelStation.PerformClick();
            }
            this.lblStation.Text = string.Format("工作站:{0}", WorkStationInfo.CurrentStation.StationName);
        }
Ejemplo n.º 6
0
        protected override CommandResult UpdateItem(object updatingItem)
        {
            WorkStationInfo info   = updatingItem as WorkStationInfo;
            CommandResult   result = bll.Update(info);

            if (result.Result == ResultCode.Successful && WorkStationInfo.CurrentStation.StationID == info.StationID)
            {
                WorkStationInfo.CurrentStation = info;

                if (DataBaseConnectionsManager.Current.StandbyConnected)
                {
                    WorkstationBll swbll = new WorkstationBll(AppSettings.CurrentSetting.CurrentStandbyConnect);
                    swbll.UpdateOrInsert(info);
                }
            }
            return(result);
        }
Ejemplo n.º 7
0
        private bool SyncWorkStations()
        {
            NotifyMsg(string.Format("{0}{1}......", Resources.Resource1.FrmSyncDataToStandby_Synchronizing, Resources.Resource1.FrmSyncDataToStandby_WorkStation));
            NotifyProgress(100, 0);

            bool          success = true;
            CommandResult result  = null;

            WorkstationBll masterbll  = new WorkstationBll(AppSettings.CurrentSetting.CurrentMasterConnect);
            WorkstationBll standbybll = new WorkstationBll(AppSettings.CurrentSetting.CurrentStandbyConnect);

            QueryResultList <WorkStationInfo> infos = masterbll.GetAllWorkstations();

            success = infos.Result == ResultCode.Successful;
            if (success)
            {
                success = standbybll.DeleteAllWorkStations().Result == ResultCode.Successful;
                if (success)
                {
                    NotifyProgress(infos.QueryObjects.Count, 0);
                    foreach (WorkStationInfo info in infos.QueryObjects)
                    {
                        result  = standbybll.Insert(info);
                        success = result.Result == ResultCode.Successful;
                        NotifyProgress(null, null);
                        if (!success)
                        {
                            break;
                        }
                    }
                }
            }

            if (!success)
            {
                NotifyMsg(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_WorkStation, Resources.Resource1.Form_Fail), Color.Red);
            }
            else
            {
                NotifyMsg(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_WorkStation, Resources.Resource1.Form_Success));
            }

            return(success);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取数据源
        /// </summary>
        /// <returns></returns>
        private List <object> GetDataSource()
        {
            List <object> items = new List <object>();

            WorkstationBll         wsBll    = new WorkstationBll(AppSettings.CurrentSetting.ParkConnect);
            List <WorkStationInfo> stations = wsBll.GetAllWorkstations().QueryObjects;

            if (stations != null)
            {
                items.AddRange(stations);
            }

            APMBll     apmBll = new APMBll(AppSettings.CurrentSetting.ParkConnect);
            List <APM> apms   = apmBll.GetAllItems().QueryObjects;

            if (apms != null)
            {
                items.AddRange(apms);
            }

            return(items);
        }