public static void BuildCurrency(Context ctx, IDynamicFormView view, string controlName, bool isContianBWB = true) { if (!string.IsNullOrWhiteSpace(controlName) && (view != null)) { DynamicObjectCollection objects = BMCommonServiceHelper.QueryData(ctx, "BD_Currency", "FCurrencyId,FName", "FDocumentStatus='C' and FForbidStatus='A'"); if ((objects != null) && (objects.Count > 0)) { List <EnumItem> items = new List <EnumItem>(); List <string> list2 = new List <string>(); foreach (DynamicObject obj2 in objects) { items.Add(CreateEnumItem(view, obj2["FCurrencyId"], (obj2["FName"] == null) ? "" : obj2["FName"].ToString())); list2.Add(obj2["FCurrencyId"].ToString()); } if (isContianBWB) { items.Add(CreateEnumItem(view, 0, GetCurrencyName(ctx, 0L))); } object obj3 = view.Model.GetValue(controlName); if ((obj3 != null) && list2.Contains(obj3.ToString())) { obj3 = view.Model.GetValue(controlName); } else { obj3 = objects[0]["FCurrencyId"]; } view.GetControl <ComboFieldEditor>(controlName).SetComboItems(items); view.Model.SetValue(controlName, obj3); } } }
public static string GetCurrencyName(Context ctx, long currencyId) { if (currencyId == 0L) { return(ResManager.LoadKDString("综合本位币", "0032057000017645", SubSystemType.FIN, new object[0])); } DynamicObjectCollection objects = BMCommonServiceHelper.QueryData(ctx, "BD_Currency", "FCurrencyId,FName", string.Format("FDocumentStatus='C' and FForbidStatus='A' And FCURRENCYID={0} ", currencyId)); if (objects.Count <= 0) { return(string.Empty); } if (objects[0]["FName"] != null) { return(objects[0]["FName"].ToString()); } return(""); }