//********************************************************************** /// <summary> /// 対象カラム出力有無確認 /// </summary> /// <param name="pobjColumn">対象カラム情報</param> /// <returns>true:出力あり false:出力なし</returns> //********************************************************************** public static bool CheckSheetViewColumns(FarPoint.Win.Spread.Column pobjColumn) { try { // 非表示確認 if (!pobjColumn.Visible) { return(false); } // CellType確認 if (pobjColumn.CellType is FarPoint.Win.Spread.CellType.CheckBoxCellType) { return(false); } return(true); } catch { return(false); } }
/// <summary> /// 根据XML初使化Spread /// </summary> private void InitSpreadData() { this.fpSpread1_Sheet1.ColumnCount = DB.Reader.FieldCount; for (int i = 0; i < DB.Reader.FieldCount; i++) { this.fpSpread1_Sheet1.Columns[i].Tag = DB.Reader.GetName(i).ToLower(); } //获得表字段信息 this.fieldInfos = SqlManager.GetFieldInfo(this.TableName); //设置列 XmlNodeList xmlColumns = this.xmlElement.SelectNodes("Columns/Column"); foreach (XmlNode xmlColumn in xmlColumns) { XmlAttribute attribute; string columnID = xmlColumn.Attributes["ID"].Value.ToLower(); FarPoint.Win.Spread.Column column = this.fpSpread1_Sheet1.Columns[columnID]; column.Label = xmlColumn.Attributes["Name"].Value; attribute = this.GetXmlAttribute(xmlColumn, "PrimaryKey"); if (attribute != null) { bool isPrimaryKey = Convert.ToBoolean(attribute.Value); column.Locked = isPrimaryKey; if (isPrimaryKey) { this.primaryKeys.Add(columnID); } } if (!column.Locked) { attribute = this.GetXmlAttribute(xmlColumn, "Locked"); if (attribute != null) { column.Locked = Convert.ToBoolean(attribute.Value); } } attribute = this.GetXmlAttribute(xmlColumn, "Filter"); if (attribute != null) { if (Convert.ToBoolean(attribute.Value)) { this.filterColumn = columnID; } } attribute = this.GetXmlAttribute(xmlColumn, "Visible"); if (attribute != null) { column.Visible = Convert.ToBoolean(attribute.Value); } // 设置列类型 // Robin 2007-04-09 attribute = this.GetXmlAttribute(xmlColumn, "CellType"); if (attribute != null) { if (attribute.Value == "NumberCellType") { column.CellType = this.numberCellType; } } //设置ComboBox XmlNodeList xmlComboItems = xmlColumn.SelectNodes("ComboBoxItem"); if (xmlComboItems.Count > 0) { Dictionary <string, string> comboDict = new Dictionary <string, string>(); Dictionary <string, string> comboDictValue = new Dictionary <string, string>(); //用于保存时反查 string[] combo = new string[xmlComboItems.Count]; for (int i = 0; i < xmlComboItems.Count; i++) { combo[i] = xmlComboItems[i].Attributes["Value"].Value; comboDict.Add(xmlComboItems[i].Attributes["ID"].Value, xmlComboItems[i].Attributes["Value"].Value); comboDictValue.Add(xmlComboItems[i].Attributes["Value"].Value, xmlComboItems[i].Attributes["ID"].Value); } this.dictCombos.Add(columnID, comboDict); this.dictCombos.Add(columnID + ComboValue, comboDictValue); FarPoint.Win.Spread.CellType.ComboBoxCellType comboBoxCellType = new FarPoint.Win.Spread.CellType.ComboBoxCellType(); attribute = this.GetXmlAttribute(xmlColumn, "ComboBoxEditable"); if (attribute != null) { comboBoxCellType.Editable = bool.Parse(attribute.Value); } comboBoxCellType.Items = combo; column.CellType = comboBoxCellType; } // attribute = this.GetXmlAttribute(xmlColumn, "Length"); if (attribute != null) { this.columnLength.Add(columnID, int.Parse(attribute.Value)); } } }
public PUR020_PurchaseOrderEntry(PurchaseOrderHDTO hdtoPurchaseOrder) { InitializeComponent(); #region Set Component shtView.ActiveSkin = Common.ACTIVE_SKIN; this.WindowState = FormWindowState.Maximized; CtrlUtil.MappingDataFieldWithEnum(shtView, typeof(eColumn)); m_BIZPurchaseOrder = new PurchaseOrderBIZ(); LookupDataBIZ BIZLookupData = new LookupDataBIZ(); cboSupplierCode.Format += CommonLib.Common.ComboBox_Format; cboSupplierCode.LoadLookupData(BIZLookupData.LoadLookupLocation(new NZString[] { (NZString)"04", (NZString)"05" })); cboSupplierCode.SelectedIndex = -1; cboDelivery.Format += CommonLib.Common.ComboBox_Format; cboDelivery.LoadLookupData(BIZLookupData.LoadLookupLocation(new NZString[] { (NZString)DataDefine.Convert2ClassCode(DataDefine.eLOCATION_CLS.Customer), (NZString)DataDefine.Convert2ClassCode(DataDefine.eLOCATION_CLS.CustomerVendor) })); cboDelivery.SelectedIndex = -1; cboTermOfPayment.Format += CommonLib.Common.ComboBox_Format; cboTermOfPayment.LoadLookupData(BIZLookupData.LoadLookupClassType(DataDefine.TERM_OF_PAYMENT.ToNZString())); cboTermOfPayment.SelectedIndex = -1; cboCurrency.Format += CommonLib.Common.ComboBox_Format; cboCurrency.LoadLookupData(BIZLookupData.LoadLookupClassType(DataDefine.CURRENCY.ToNZString())); cboCurrency.SelectedIndex = -1; shtView.Columns[(int)eColumn.UNIT].CellType = CtrlUtil.CreateComboBoxCellType(BIZLookupData.LoadLookupClassType(DataDefine.UM_CLS.ToNZString()), true); shtView.Columns[(int)eColumn.INV_UM].CellType = CtrlUtil.CreateComboBoxCellType(BIZLookupData.LoadLookupClassType(DataDefine.UM_CLS.ToNZString()), true); //shtView.Columns[(int)eColumn.STATUS].CellType = CtrlUtil.CreateComboBoxCellType(BIZLookupData.LoadLookupClassType(DataDefine.PO_STATUS.ToNZString()), true); // ซ่อน column บางตัว for (eColumn column = eColumn.PO_LINE; column < eColumn.STATUS; column++) { FarPoint.Win.Spread.Column hiddenColumn = shtView.Columns[(int)column]; hiddenColumn.Visible = false; hiddenColumn.Label = column.ToString(); if (column == eColumn.PO_NO) { column = eColumn.BACK_ORDER_QTY; } } shtView.Columns[(int)eColumn.ModifyState].Visible = false; shtView.Columns[(int)eColumn.KeptStatus].Visible = false; shtView.Columns[(int)eColumn.RATE].Visible = false; for (int iColumn = 0; iColumn < shtView.ColumnCount; iColumn++) { if (iColumn != (int)eColumn.BUTTON) { shtView.Columns[iColumn].AllowAutoFilter = true; shtView.Columns[iColumn].AllowAutoSort = true; } } #endregion this.m_HDTOPurchaseOrder = hdtoPurchaseOrder; }