예제 #1
0
        public frm_GasEmissions()
        {
            InitializeComponent();
            col_Day.AspectGetter = delegate(object x)
            {
                return(SynapseForm.GetLabel("labels." + ((o_GasEmission)x).Date.DayOfWeek.ToString()) + " " + ((o_GasEmission)x).Date.ToString("dd/MM/yyyy"));
            };
            col_Date.AspectGetter = delegate(object x)
            {
                return(((o_GasEmission)x).Date.AddDays(1).ToString("dd/MM/yyyy"));
            };
            col_Dirty.AspectGetter = delegate(object x)
            {
                return("");// (((o_GasEmission)x).GasVolume != 0 || ((o_GasEmission)x).GasEmission != 0) ? ((o_GasEmission)x).IsDirty : false;
            };
            col_Dirty.ImageGetter = delegate(object x)
            {
                o_GasEmission item  = (o_GasEmission)x;
                string        state = "st_empty";
                if (item.GasEmission != 0 || item.GasEmission != 0)
                {
                    state = "st_data";

                    if (item.Valid)
                    {
                        state = "st_valid";
                    }
                    if (item.IsDirty)
                    {
                        state = "st_edit";
                    }
                }
                return(state);
            };
            col_GazDischarge.AspectGetter = delegate(object x)
            {
                return(((o_GasEmission)x).GasEmission.ToString("0.000E+00"));
            };
            col_GazDischarge.AspectPutter = delegate(object x, object newval)
            {
                double t;
                if (double.TryParse(newval.ToString(), out t))
                {
                    ((o_GasEmission)x).GasEmission = t;
                }
            };
            col_GazVolume.AspectGetter = delegate(object x)
            {
                return(((o_GasEmission)x).GasVolume.ToString("0.000E+00"));
            };
            col_GazVolume.AspectPutter = delegate(object x, object newval)
            {
                double t;
                if (double.TryParse(newval.ToString(), out t))
                {
                    ((o_GasEmission)x).GasVolume = t;
                }
            };
        }
        public frm_GasEmissionDetails(o_GasEmission obj)
        {
            InitializeComponent();
            txt_EncodedBy.Text = obj.EncodedBy != null?SynapseCore.Entities.SynapseUser.LoadByUserID(obj.EncodedBy).ToString() + " (" + obj.EncodedBy + ")" : "---";

            txt_EncodedDate.Text = obj.EncodedDate != null?obj.EncodedDate.ToString("dd/MM/yyyy HH:mm") : "---";

            txt_ValidatedBy.Text = obj.ValidationBy != null?SynapseCore.Entities.SynapseUser.LoadByUserID(obj.ValidationBy).ToString() + " (" + obj.ValidationBy + ")" : "---";

            txt_ValidatedDate.Text = obj.ValidationDate != null?obj.ValidationDate.ToString("dd/MM/yyyy HH:mm") : "---";
        }