public frmManager() { InitializeComponent(); pm = PackageManager.GetInstance(); bm = BoxsManager.GetInstance(); serverService = ServicesFactory.GetInstance().GetServerService(); enu = bm.BoxsDictionary.GetEnumerator(); dataGridView1.AllowUserToAddRows = false; DataGridViewDisableButtonColumn openCol = new DataGridViewDisableButtonColumn(); openCol.Name = openColName; DataGridViewDisableButtonColumn deletePackageCol = new DataGridViewDisableButtonColumn(); deletePackageCol.Name = deletePackageColName; DataGridViewDisableButtonColumn boxStateCol = new DataGridViewDisableButtonColumn(); boxStateCol.Name = boxStateColName; dataGridView1.Columns.Add(openCol); dataGridView1.Columns.Add(deletePackageCol); dataGridView1.Columns.Add(boxStateCol); Initialize(); UpdateData(); }
//bool bstate = true; public frmManager() { InitializeComponent(); SystemController sc = new SystemController(); pm = PackageManager.GetInstance(); bm = BoxsManager.GetInstance(); enu = bm.BoxsDictionary.GetEnumerator(); dataGridView1.AllowUserToAddRows = false; DataGridViewDisableButtonColumn openCol = new DataGridViewDisableButtonColumn(); openCol.Name = "open"; DataGridViewDisableButtonColumn deletePackageCol = new DataGridViewDisableButtonColumn(); deletePackageCol.Name = "deletePackage"; DataGridViewDisableButtonColumn boxStateCol = new DataGridViewDisableButtonColumn(); boxStateCol.Name = "boxState"; dataGridView1.Columns.Add(openCol); dataGridView1.Columns.Add(deletePackageCol); dataGridView1.Columns.Add(boxStateCol); Initialize(); UpdateData(); }
public FrmMain() { CLog4net.LogInfo("System starting!"); InitializeComponent(); this.systemController = new SystemController(); FrmLoading frmLoading = new FrmLoading(this.systemController); frmLoading.ShowDialog(); if (frmLoading.DialogResult == DialogResult.OK) { frmLoading.Hide(); frmLoading.Close(); } this.boxsManager = BoxsManager.GetInstance(); this.packageManager = PackageManager.GetInstance(); this.voiceService = ServicesFactory.GetInstance().GetVoicService(); this.serverService = ServicesFactory.GetInstance().GetServerService(); this.cameraService = ServicesFactory.GetInstance().GetCameraService(); this.about = AboutConfig.GetInstance().GetAbout(); this.infoCenterLister = InfoCenterLister.GetInsatnce(); this.adManager = ADManager.GetInstance(); this.AddUCScene(Roster.Home, new Home(this, 0)); this.AddUCScene(Roster.P_ControlPanel, new PostmanControlPanel(this, 5)); this.AddUCScene(Roster.P_D_Verify, new PostmanVerify(this, 60)); this.AddUCScene(Roster.P_D_ChooseBox, new PostmanChooseBox(this, 60)); this.AddUCScene(Roster.P_D_DeliverPG, new PostmanDeliverPG(this, 120)); this.AddUCScene(Roster.P_D_EntryPGInfo, new PostmanEntryPGInfo(this, 60)); this.AddUCScene(Roster.P_D_PGVerify, new PostmanPGVerify(this, 60)); this.AddUCScene(Roster.P_D_FinishWork, new PostmanFinishWork(this, 10)); this.AddUCScene(Roster.P_D_Cancel, new PostmanCancelTask(this, 60)); this.AddUCScene(Roster.P_D_CancelTask, new PostmanCancelTask(this, 60)); this.AddUCScene(Roster.P_T_EntryPGInfo, new PostmanTBEntryPGInfo(this, 60)); this.AddUCScene(Roster.P_T_FinishWork, new PostmanTBFinishWork(this, 60)); this.AddUCScene(Roster.P_S_PGDelivered, new PostmanSPGDelivered(this, 60)); this.AddUCScene(Roster.P_R_PGRegister, new PostmanRegister(this, 180)); this.AddUCScene(Roster.C_ControlPanel, new CustomerControlPanel(this, 5)); this.AddUCScene(Roster.C_T_Verify, new CustomerTBVerify(this, 60)); this.AddUCScene(Roster.C_T_FinishWork, new CustomerTBFinishWork(this, 60)); this.AddUCScene(Roster.C_S_EntryPGInfo, new CustomerSEntryPGInfo(this, 60)); this.AddUCScene(Roster.C_S_PGSearched, new CustomerPGSearched(this, 60)); this.AddUCScene(Roster.A_Verify, new AdminVerify(this, 60)); this.AddUCScene(Roster.A_P_EntryBoxCode, new AdminProxyEntryBoxCode(this, 60)); this.AddUCScene(Roster.A_P_FinishWork, new AdminProxyFinishWork(this, 60)); this.AddUCScene(Roster.A_ControlPanel, new AdministratorControlPanel(this, 360)); this.SceneTransit(Roster.Home); this.timerSceneInfo.Enabled = true; this.timerMain.Enabled = true; CLog4net.LogInfo("启动完成"); }
public FrmMain() { CLog4net.LogInfo("System starting!"); InitializeComponent(); //读取配置文件和Logo图片 try { CLog4net.LogInfo("读取配置文件和Logo图片"); string imagepath = Environment.CurrentDirectory + "\\configInfo\\logo.png"; Image image = Image.FromFile(imagepath); Size size = new Size(logoPic.Width, logoPic.Height); Bitmap b = new Bitmap(image, size); this.logoPic.BackgroundImage = b; IniConfigManager iniConfig = new IniConfigManager(); tel.Text = iniConfig.GetAboutTel(); url.Text = iniConfig.GetAboutUrl(); } catch (Exception e) { CLog4net.LogError(e.ToString()); } this.systemController = new SystemController(); FrmLoading frmLoading = new FrmLoading(this.systemController); frmLoading.ShowDialog(); if (frmLoading.DialogResult == DialogResult.OK) { frmLoading.Hide(); frmLoading.Close(); } this.boxsManager = BoxsManager.GetInstance(); this.packageManager = PackageManager.GetInstance(); this.voiceService = ServicesFactory.GetInstance().GetVoicService(); this.serverService = ServicesFactory.GetInstance().GetServerService(); this.cameraService = ServicesFactory.GetInstance().GetCameraService(); this.about = AboutConfig.GetInstance().GetAbout(); this.infoCenterLister = InfoCenterLister.GetInsatnce(); timerNav.Interval = 1000; timerNav.Stop(); this.timerMain.Enabled = true; this.timerMain.Start(); currentPanel = panelName.mainPanel; mainPanel1.BringToFront(); CLog4net.LogInfo("启动完成"); }
public int Load(BackgroundWorker bw) { #region 获取初始化基本信息 bw.ReportProgress(stepNum += 1, "starting......"); this.databaseService = ServicesFactory.GetInstance().GetDatabaseService(); this.aboutConfig = AboutConfig.GetInstance(); this.elocksManager = ELocksManager.GetInstance(); this.boxManager = BoxsManager.GetInstance(); this.packageManager = PackageManager.GetInstance(); this.adManager = ADManager.GetInstance(); this.remoteOpenLogic = RemoteOpenLogic.GetInstance(); this.SystemTimer = new Timer(new TimerCallback(this.SystemTimer_Elapsed), null, Timeout.Infinite, Timeout.Infinite); #endregion System.Threading.Thread.Sleep(delay); bw.ReportProgress(stepNum += 1, "aboutConfig loading......"); this.aboutConfig.Load(); System.Threading.Thread.Sleep(delay); bw.ReportProgress(stepNum += 1, "boxManager loading......"); this.boxManager.Load(); System.Threading.Thread.Sleep(delay); bw.ReportProgress(stepNum += 1, "elocksManager loading......"); this.elocksManager.Load(); System.Threading.Thread.Sleep(delay); bw.ReportProgress(stepNum += 1, "packageManager loading......"); this.packageManager.Load(); System.Threading.Thread.Sleep(delay); bw.ReportProgress(stepNum += 1, "remoteOpenLogic loading......"); this.remoteOpenLogic.Load(); System.Threading.Thread.Sleep(delay); bw.ReportProgress(stepNum += 1, "adManager loading......"); this.adManager.Load(); System.Threading.Thread.Sleep(delay); bw.ReportProgress(stepNum += 1, "packageEvent loading......"); this.packageManager.PackageCreatedEvent += new PackageManager.PackageCreatedDelegate(packageManager_PackageCreatedEvent); this.packageManager.PackageTakedEvent += new PackageManager.PackageTakedDelegate(packageManager_PackageTakedEvent); this.SystemTimer.Change(0, 600 * 1000); System.Threading.Thread.Sleep(delay); bw.ReportProgress(stepNum += 1, "over"); return(stepNum); }
/// <summary> /// 获取包裹列表 /// </summary> /// <returns></returns> public List <Package> GetPackages() { DataTable table = null; LoggingData data = new LoggingData(ip, username, password, database); table = data.GetPackage(); if (table == null) { CLog4net.LogError("快递表初始化错误"); return(null); } List <Package> packages = new List <Package>(); foreach (System.Data.DataRow d in table.Rows) { Package p = new Package(); /** * 从数据库中读取未被取走的快递 * */ p.Courier = new Courier(Convert.ToString(d[TbPackage.courierCode])); p.CreatedTime = Convert.ToDateTime(d[TbPackage.createdTime]); if (d[TbPackage.deletedTime].ToString() != "") { p.DeletedTime = Convert.ToDateTime(d[TbPackage.deletedTime]); } p.Place = BoxsManager.GetInstance().Find(Convert.ToInt32(d[TbPackage.boxCode])); if (d[TbPackage.receiverIdentity].ToString() != "") { p.ReceiverIdentity = Convert.ToByte(d[TbPackage.receiverIdentity]); } p.ReceiverTelNum = Convert.ToString(d[TbPackage.receiverTelNum]); p.RemarkInfo = Convert.ToString(d[TbPackage.remark]); p.SN = Convert.ToString(d[TbPackage.packageCode]); p.Taken = Convert.ToBoolean(d[TbPackage.taken]); packages.Add(p); } return(packages); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { int code = (int)dataGridView1.Rows[e.RowIndex].Cells["code"].Value; //openbox if (e.ColumnIndex == 5) { bool issuccess = bm.Find(code).Open(); UpdateData(); CLog4net.LogInfo("管理员开箱:" + code); } //删包裹 if (e.ColumnIndex == 6) { DataGridViewDisableButtonCell btnCell = (DataGridViewDisableButtonCell)dataGridView1.Rows[e.RowIndex].Cells[deletePackageColName]; if (btnCell.Enabled) { DialogResult dr = MessageBox.Show("确认操作", "Information", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); if (dr == DialogResult.Cancel) { return; } BoxsManager.GetInstance().ClearBox(code); //MessageBox.Show(issuccess.ToString()); UpdateData(); bool issuccess = pm.TakePackage(code, 2); CLog4net.LogInfo("管理员删除包裹:" + code + " success:" + issuccess); ServerCallback3 sc = serverService.ManagerDeletePackage(code.ToString(), AboutConfig.GetInstance().GetAbout()); if (!sc.Success) { CLog4net.LogInfo("管理员删除包裹失败:" + code + " 服务器信息:" + sc.Message); //return; //如果是因为服务器找不到需要删除的包裹,删包裹失败返回,那么客户端箱子将永远不能清空; } } } //disable box if (e.ColumnIndex == 7) { DialogResult dr = MessageBox.Show("确认操作", "Information", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); if (dr == DialogResult.Cancel) { return; } //DataGridViewDisableButtonCell btnCell = (DataGridViewDisableButtonCell)dataGridView1.Rows[e.RowIndex].Cells["open"]; if (bm.Find(code).CurrentState == Box.State.Fault) { bm.EnableBox(code); //btnCell.Enabled = true; UpdateData(); CLog4net.LogInfo("管理员启用箱子:" + code); } else { bm.DisableBox(code); UpdateData(); CLog4net.LogInfo("管理员停用箱子:" + code); } } } catch (Exception ex) { CLog4net.LogError("管理员操作异常:" + ex.ToString()); } }
public chooseBox() { InitializeComponent(); this.DoubleBuffered = true; this.boxsManager = BoxsManager.GetInstance(); }