Esempio n. 1
0
        public void SetObject <T>(T item)
        {
            foreach (lInputCtrl ctrl in m_inputsCtrls)
            {
                PropertyInfo property = GetProperty(typeof(T), ctrl.m_fieldName);

                if (property != null)
                {
                    ctrl.Text = property.GetValue(item).ToString();
                    return;
                }

                FieldInfo field = typeof(T).GetField(ctrl.m_fieldName);
                if (field != null)
                {
                    var obj = field.GetValue(item);
                    if (obj != null)
                    {
                        if (ctrl.m_type == lSearchCtrl.ctrlType.dateTime)
                        {
                            ctrl.Text = Convert.ToDateTime(obj).ToString(ConfigMng.GetDisplayDateFormat());
                        }
                        else
                        {
                            ctrl.Text = obj.ToString();
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public lInputCtrlDate(string fieldName, string alias, ctrlType type, Point pos, Size size)
            : base(fieldName, alias, type, pos, size)
        {
#if fit_txt_size
            int w = ConfigMng.getWidth(ConfigMng.getDateFormat()) + 20;
#else
            int w = 100;
#endif
            m_date.Width        = w;
            m_date.Format       = DateTimePickerFormat.Custom;
            m_date.CustomFormat = ConfigMng.GetDisplayDateFormat();
            m_date.Font         = ConfigMng.GetFont();

            m_panel.Controls.AddRange(new Control[] { m_label, m_date });
        }