public static void ReadDadaLinkInfor(FrameworkElement fe, FieldInfo f, AbstractLFCDataObject ao) { Type ft = fe.GetType(); if (ft.Name == "TextBox") { TextBox tb = fe as TextBox; object v = f.GetValue(ao); if (v != null) { tb.Text = v.ToString(); } else { tb.Text = ""; } } if (ft.Name == "TextBlock") { TextBlock tb = fe as TextBlock; object v = f.GetValue(ao); if (v != null) { tb.Text = v.ToString(); } else { tb.Text = ""; } } if (ft.Name == "DatePicker") { LynxDateTimeSelect tb = fe as LynxDateTimeSelect; object v = f.GetValue(ao); if (v != null) { tb.Text = v.ToString(); tb.SelectedDate = Convert.ToDateTime(tb.Text); } else { tb.Text = ""; } } if (ft.Name == "LynxUpDown") { LynxUpDown t = fe as LynxUpDown; object v = f.GetValue(ao); if (v != null) { t.DoubleValue = Convert.ToDouble(v); } else { t.DoubleValue = 0; } } }
public void ClearKeyWords(AbstractLFCDataObject o) { PropertyInfo pi = o.GetType().GetRuntimeProperty("KeyWords");//必须属性名为KeyWords if (pi != null) { pi.SetValue(o, "", null); } }
public List <string> getKeyWordsList(AbstractLFCDataObject o) { PropertyInfo pi = o.GetType().GetRuntimeProperty("KeyWords");//必须属性名为KeyWords if (pi != null) { string kws = pi.GetValue(o, null).ToString(); List <string> ls = Environment.getStringListFromCommaString(kws, KeyWordsManager.KeyWordSeperateChar); return(ls); } return(null); }
public static void ReadDadaLinkInfor(Panel dp, AbstractLFCDataObject ao) { foreach (FrameworkElement fe in dp.Children) { if (IsDataLinkArea(fe)) { string tn = getFieldNameWithoutPrefix(fe.Name); LFCDataService ls = new LFCDataService(); FieldInfo fo = ls.getFieldByName(ao, tn); if (fo != null) { ReadDadaLinkInfor(fe, fo, ao); } } } }
public void RemoveKeyWords(AbstractLFCDataObject o, string word) { PropertyInfo pi = o.GetType().GetRuntimeProperty("KeyWords");//必须属性名为KeyWords if (pi != null) { string kws = pi.GetValue(o, null).ToString(); List <string> ls = Environment.getStringListFromCommaString(kws, KeyWordsManager.KeyWordSeperateChar); if (ls.Contains(word)) { ls.Remove(word); } kws = Environment.getCommaString(ls, KeyWordsManager.KeyWordSeperateChar); pi.SetValue(o, kws, null); } }
public static void WriteDadaLinkInfor(FrameworkElement fe, FieldInfo f, AbstractLFCDataObject ao) { Type ft = fe.GetType(); if ((f.FieldType.Name == "string") || (f.FieldType.Name == "String")) { if (ft.Name == "TextBox") { TextBox tb = fe as TextBox; if (f.GetValue(ao).ToString().Equals(tb.Text)) { } else { f.SetValue(ao, tb.Text); ao.DataFlag = DataOperation.Update; } } } if (f.FieldType.Name == "Int32") { if (ft.Name == "TextBox") { TextBox tb = fe as TextBox; if (f.GetValue(ao).ToString().Equals(tb.Text)) { } else { f.SetValue(ao, Convert.ToInt32(tb.Text)); ao.DataFlag = DataOperation.Update; } } if (ft.Name == "LynxUpDown") { LynxUpDown t = fe as LynxUpDown; if (t.IntValue == Convert.ToInt32(f.GetValue(ao))) { } else { f.SetValue(ao, t.IntValue); ao.DataFlag = DataOperation.Update; } } } if (f.FieldType.Name == "Int64") { if (ft.Name == "TextBox") { TextBox tb = fe as TextBox; if (f.GetValue(ao).ToString().Equals(tb.Text)) { } else { f.SetValue(ao, Convert.ToInt64(tb.Text)); ao.DataFlag = DataOperation.Update; } } if (ft.Name == "LynxUpDown") { LynxUpDown t = fe as LynxUpDown; if (t.IntValue == Convert.ToInt32(f.GetValue(ao))) { } else { f.SetValue(ao, t.IntValue); ao.DataFlag = DataOperation.Update; } } } if (f.FieldType.Name == "DateTime") { if (ft.Name == "TextBox") { TextBox tb = fe as TextBox; if (f.GetValue(ao).ToString().Equals(tb.Text)) { } else { f.SetValue(ao, Convert.ToDateTime(tb.Text)); ao.DataFlag = DataOperation.Update; } } if (ft.Name == "DatePicker") { LynxDateTimeSelect tb = fe as LynxDateTimeSelect; if (f.GetValue(ao).ToString().Equals(tb.SelectedDate.ToString())) { } else { f.SetValue(ao, Convert.ToDateTime(tb.SelectedDate)); ao.DataFlag = DataOperation.Update; } } } }