/// <summary> /// 新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { FrmUnitInfo fUnit = new FrmUnitInfo(); fUnit.Tag = new FInfoModel() { ActType = 1, UName = uName, FId = 0 }; fUnit.ReLoadHandler += LoadUnitList; fUnit.ShowDialog(); }
/// <summary> /// 选择类别 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnChoose_Click(object sender, EventArgs e) { TreeNode selNode = tvUTypes.SelectedNode; if (selNode != null) { if (cModel.TypeCode == "Units") { UnitTypeInfoModel selType = new UnitTypeInfoModel() { UTypeId = selNode.Name.GetInt(), UTypeName = selNode.Text.Trim() }; FrmUnitInfo fUnitInfo = cModel.FGet as FrmUnitInfo; fUnitInfo.uType = selType; } else if (cModel.TypeCode.Contains("Goods")) { GoodsTypeInfoModel selType = new GoodsTypeInfoModel() { GTypeId = selNode.Name.GetInt(), GTypeName = selNode.Text.Trim() }; if (selType.GTypeId == 0) { selType.GTypeName = null; } switch (cModel.TypeCode) { case "Goods": FrmGoodsInfo fGoodsInfo = cModel.FGet as FrmGoodsInfo; fGoodsInfo.gTypeInfo = selType; break; case "Goods-PerQueryBySupplier": FrmPerchaseQueryBySupplier fPerQueryBySupplier = cModel.FGet as FrmPerchaseQueryBySupplier; fPerQueryBySupplier.gtInfo = selType; break; case "Goods-SaleQueryByCustomer": FrmSaleQueryByCustomer fSaleQueryByCustomer = cModel.FGet as FrmSaleQueryByCustomer; fSaleQueryByCustomer.gtInfo = selType; break; } } this.SetType?.Invoke(); } this.Close(); }
/// <summary> /// 显示单位信息页面(新增、修改、详情) /// </summary> /// <param name="actType">1 add 2 edit 4 info</param> /// <param name="unitId"></param> private void ShowUnitInfoPage(int actType, int unitId) { //acttype id uname (reload刷新列表数据) //另一种刷新:利用事件 为信息页面定义一个事件 FrmUnitInfo fUnitInfo = new FrmUnitInfo(); fUnitInfo.Tag = new FInfoModel() { ActType = actType, FId = unitId, UName = uName }; if (actType != 4) { fUnitInfo.ReLoadHandler += LoadUnitList;//订阅 并不是每种都需要刷新 } fUnitInfo.ShowDialog(); }