예제 #1
0
        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;
                }
            }
        }
예제 #2
0
        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;
                    }
                }
            }
        }