private void FrmMain_Load(object sender, EventArgs e) { foreach (Control ctl in this.Controls) { try { // Attempt to cast the control to type MdiClient. MdiClient ctlMDI = (MdiClient)ctl; // Set the BackColor of the MdiClient control. ctlMDI.BackColor = this.BackColor; } catch (InvalidCastException exc) { // Catch and ignore the error if casting failed. } } lblUserName.Text = _userInfo.NAME; lblDepartmentName.Text = _userInfo.DEPARTMENT_NAME; lblCompanyName.Text = _userInfo.COMPANY_NAME; try { CCacheData.SetRolesFunction(_userInfo.ROLES_CODE); } catch { } //我的桌面的重新整理 try { bCommon.ReSetMyDesk(_userInfo.COMPANY_CODE, _userInfo.CODE, _userInfo.ROLES_CODE); } catch (Exception ex) { Logger.Error("我的桌面的重新整理异常!", ex); } menuManage_Click(this.menuDesk, null); #region 通知 BProductionPlanSearch bProductionPlanSearch = new BProductionPlanSearch(); BProductionDrawing bProductionDrawing = new BProductionDrawing(); try { int a = bProductionPlanSearch.GetProductionPlan(" DEPARTMENT_CODE = '" + _userInfo.DEPARTMENT_CODE + "'" + " AND PSPP_STATUS_FLAG <> 2" + " AND STATUS_FLAG <> 5").Tables[0].Rows.Count; int b = bProductionPlanSearch.GetProductionTechnology(" DEPARTMENT_CODE = '" + _userInfo.DEPARTMENT_CODE + "'" + " AND PST_STATUS_FLAG <> 1" + " AND STATUS_FLAG <> 5").Tables[0].Rows.Count; if (CConvert.ToInt32(a + b) > 0) { menuProduceManage.Image = Resources.warning; menuProduceManage.BackgroundImage = null; menuProduceManage.Top = menuProduceManage.Top - 1; menuProduceManage.Left = menuProduceManage.Left - 1; } else if (_userInfo.DEPARTMENT_CODE.Equals("D05")) { int c = bProductionDrawing.GetProductionDrawing("PSDL_STATUS_FLAG <> 1" + " AND PS_STATUS_FLAG <> 5").Tables[0].Rows.Count; if (c > 0) { menuProduceManage.Image = Resources.warning; menuProduceManage.BackgroundImage = null; menuProduceManage.Top = menuProduceManage.Top - 1; menuProduceManage.Left = menuProduceManage.Left - 1; } } else { menuProduceManage.Image = null; menuProduceManage.BackgroundImage = Resources.buttonup; } } catch (Exception ex) { } ////入库预定 //int receivingCount = 0; //try //{ // receivingCount = (new BReceipt()).GetRecordCount(" STATUS_FLAG =" + CConstant.INIT + " and DUE_DATE<= '" + DateTime.Now.ToString("yyyy-MM-dd") + "' "); //} //catch { } //if (receivingCount > 0) //{ // notifyMessage += "您有未处理的入库预定!\r\n"; //} ////安全库存 //int stockCount = 0; //try //{ // stockCount = (new BStock()).GetStockNotifyRecordCount(" STATUS_FLAG <> " + CConstant.DELETE + "and QUANTITY < SAFETY_STOCK "); //} //catch { } //if (stockCount > 0) //{ // notifyMessage += "商品库存不足,请尽快采购!\r\n"; //} ////通知提示 //if (notifyMessage != "") //{ // Thread notifyThread = new Thread(new ThreadStart(ShowNotify)); // notifyThread.Start(); //} #endregion this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmMain_FormClosed); }
private void FrmMain_Load(object sender, EventArgs e) { lblUserName.Text = _userInfo.NAME; lblDepartmentName.Text = _userInfo.DEPARTMENT_NAME; lblCompanyName.Text = _userInfo.COMPANY_NAME; initCompany(); try { CCacheData.SetRolesFunction(_userInfo.ROLES_CODE); } catch { } //我的桌面的重新整理 try { bCommon.ReSetMyDesk(_userInfo.COMPANY_CODE, _userInfo.CODE, _userInfo.ROLES_CODE); } catch (Exception ex) { Logger.Error("我的桌面的重新整理异常!", ex); } menuManage_Click(this.menuDesk, null); #region 通知 //入库预定 int receivingCount = 0; try { receivingCount = (new BReceipt()).GetRecordCount(" STATUS_FLAG =" + CConstant.INIT_STATUS + " and DUE_DATE<= '" + DateTime.Now.ToString("yyyy-MM-dd") + "' "); } catch { } if (receivingCount > 0) { notifyMessage += "您有未处理的入库预定!\r\n"; } //安全库存 int stockCount = 0; try { stockCount = (new BStock()).GetStockNotifyRecordCount(" STATUS_FLAG <> " + CConstant.DELETE_STATUS + " and QUANTITY < SAFETY_STOCK "); } catch { } if (stockCount > 0) { notifyMessage += "商品库存不足,请尽快采购!\r\n"; } //通知提示 int depositCount = 0; try { string strWhere = "STATUS_FLAG <> " + CConstant.DELETE_STATUS + " AND COMPANY_CODE = '" + _userInfo.COMPANY_CODE + "' AND CUSTOMER_CLAIM_DATE <= '" + DateTime.Now.AddDays(7).ToString("yyyy-MM-dd") + "'"; depositCount = (new BSales()).GetUnReceiptRecordCount(strWhere); } catch { } if (depositCount > 0) { notifyMessage += "快到收款预定日期,请尽快收款!\r\n"; } if (notifyMessage != "") { Thread notifyThread = new Thread(new ThreadStart(ShowNotify)); notifyThread.Start(); } #endregion this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmMain_FormClosed); }