private void InitUdefFlag() { var lst = DataFactory.Instance.GetTemplateExecuter().GetUdefTemplate("_VoucherEntryUdef"); if (lst == null) { return; } var accountFlagList = AuxiliaryList.Get(Controls.Commons.AuxiliaryType.AccountFlag); foreach (var item in lst) { var flagLabel = item.tagLabel; if (!string.IsNullOrEmpty(flagLabel)) { var s = flagLabel.Split('|'); if (s.Length > 1) { var f = s[1]; var bF = false; foreach (var F in accountFlagList) { var mask = 0; if (!int.TryParse(F.name, out mask)) { continue; } if (f == F.no && (mAccountSubjectObj.flag & mask) == 0) { bF = true; break; } } if (bF) { continue; } } } object val = item.defaultVal; if (DataSource != null) { if (DataSource.ContainsKey(item.name)) { val = DataSource[item.name]; } } mUserDefineInputItems.Add(new UserDefineInputItem { Label = item.label, DataType = CommonUtils.ConvertDataTypeFromStr(item.dataType), Name = item.name, DataValue = val, TabIndex = item.tabIndex, TagLabel = string.IsNullOrEmpty(item.tagLabel) ? "" : item.tagLabel, Width = item.width }); } mUserDefineInputItems = mUserDefineInputItems.OrderBy(item => item.TabIndex).ToList(); }
void LoadUdefPanel(string UniqueKey) { if (!mUserDefineDataSource.ContainsKey(UniqueKey)) { userDefinePanel.DataSource = new List <UserDefineInputItem>(); return; } var udefDataDictionary = mUserDefineDataSource[UniqueKey]; var lst = DataFactory.Instance.GetTemplateExecuter().GetUdefTemplate("_VoucherEntryUdef"); if (lst == null) { return; } var voucherGridDataSource = voucherGrid.DataSource; var accountSubjectId = voucherGridDataSource.FirstOrDefault(d => d.UniqueKey == UniqueKey).AccountSubjectId; var accountSubjectObj = AccountSubjectList.Find(accountSubjectId); var accountFlagList = AuxiliaryList.Get(Controls.Commons.AuxiliaryType.AccountFlag); List <UserDefineInputItem> mUserDefineInputItems = new List <UserDefineInputItem>(); foreach (var item in lst) { var flagLabel = item.tagLabel; if (!string.IsNullOrEmpty(flagLabel)) { var s = flagLabel.Split('|'); if (s.Length > 1) { var f = s[1]; var bF = false; foreach (var F in accountFlagList) { var mask = 0; if (!int.TryParse(F.name, out mask)) { continue; } if (f == F.no && (accountSubjectObj.flag & mask) == 0) { bF = true; break; } } if (bF) { continue; } } } object val = item.defaultVal; if (udefDataDictionary != null) { if (udefDataDictionary.ContainsKey(item.name)) { val = udefDataDictionary[item.name]; } } mUserDefineInputItems.Add(new UserDefineInputItem { Label = item.label, DataType = CommonUtils.ConvertDataTypeFromStr(item.dataType), Name = item.name, DataValue = val, TabIndex = item.tabIndex, TagLabel = string.IsNullOrEmpty(item.tagLabel) ? "" : item.tagLabel, Width = item.width }); } mUserDefineInputItems = mUserDefineInputItems.OrderBy(item => item.TabIndex).ToList(); userDefinePanel.DataSource = mUserDefineInputItems; }