Exemplo n.º 1
0
        public override void toControl(Hashtable values)
        {
            object o = values[name];

            if (o != null)
            {
                string v;
                if (field.property.PropertyType == typeof(bool))
                {
                    bool b = o.Equals("True");
                    v = DBUtils.getResourceManager().GetString(b ? "value.true" : "value.false");
                    if (v == null)
                    {
                        v = b.ToString();
                    }
                }
                else
                {
                    if (format != null)
                    {
                        if (field.property.PropertyType == typeof(Int32))
                        {
                            if (o.Equals(""))
                            {
                                v = "";
                            }
                            else
                            {
                                int t = Convert.ToInt32(o);
                                v = t.ToString(format);
                            }
                        }
                        else if (field.property.PropertyType == typeof(double))
                        {
                            if (o.Equals(""))
                            {
                                v = "";
                            }
                            else
                            {
                                double t = (double)field.convert(o);
                                v = t.ToString(format);
                            }
                        }
                        else
                        {
                            v = o.ToString();
                        }
                    }
                    else
                    {
                        v = o.ToString();
                    }
                }
                c.Text = HTMLUtils.toHTMLText(v);
            }
            else
            {
                c.Text = "";
            }
        }
Exemplo n.º 2
0
 public void toObject(DataRow row, DBObject o)
 {
     DBUtils.ConvertDataRowToDBObject(row, o, fields);
 }