private static void BindingExceptionHandlerImpl(IDataBinding dataBinding, BindingEventArgs bindingEventArgs)
 {
     if (bindingEventArgs.Exception != null)
     {
         Tracer.Error(bindingEventArgs.Exception.Message);
     }
 }
Beispiel #2
0
        private void CellDetail8_EvaluateBinding(object sender, BindingEventArgs e)
        {
            XRTableCell cell = (sender as XRTableCell);

            cell.ForeColor = Color.Black; //default

            if (e.Value != null && !String.IsNullOrWhiteSpace(e.Value.ToString()))
            {
                switch (e.Value.ToString().ToLower())
                {
                case "good":
                    cell.ForeColor = Color.Green;

                    break;

                case "overtime":
                    cell.ForeColor = Color.Purple;

                    break;

                case "short":
                    cell.ForeColor = Color.Red;

                    break;

                default:
                    cell.ForeColor = Color.Black;

                    break;
                }
            }
        }
Beispiel #3
0
        private void xrTableCell11_EvaluateBinding(object sender, BindingEventArgs e)
        {
            Venta vent =
                new EmpeñosDC(new clsConeccionDB().StringConn()).Ventas.Single(c => c.Clave == Convert.ToInt32(e.Value));

            e.Value = vent.Saldo - vent.PagosVentas.Where(pv => pv.Estado).Sum(pv => pv.Abono);
        }
        private void ElementHeaderTitle_EvaluateBinding(object sender, BindingEventArgs e)
        {
            XRLabel mainServiceTitle = sender as XRLabel;

            if (mainServiceTitle == null || !(e.Value is PEMR_Translated))
            {
                return;
            }

            PEMR_PatientMedicalRecordReportElement_rpt elementReport = new PEMR_PatientMedicalRecordReportElement_rpt();
            PEMR_PatientMedicalRecordReportElement_VisionRefraction_rpt elementReport_VisionRefraction =
                new PEMR_PatientMedicalRecordReportElement_VisionRefraction_rpt();
            PEMR_Translated translated = e.Value as PEMR_Translated;

            elementReport.Initialize(translated.List_PEMR_Element_Translated);
            elementSubReport.ReportSource = elementReport;
            //if (translated.List_PEMR_Element_Translated != null && translated.List_PEMR_Element_Translated.Count > 0)
            //{
            //	if (!translated.IsEyeRelatedType)
            //	{
            //		elementReport.Initialize(translated.List_PEMR_Element_Translated);
            //		elementSubReport.ReportSource = elementReport;
            //	}
            //	else
            //	{
            //		elementReport_VisionRefraction.Initialize(translated.List_PEMR_Element_Translated);
            //		elementSubReport.ReportSource = elementReport_VisionRefraction;
            //	}
            //}
        }
Beispiel #5
0
 private void PercentageFormatter(Object sender, BindingEventArgs e)
 {
     if (e.Value.ToString().Contains("."))
     {
         e.Value  = String.Format("{0:0.00}", e.Value);
         e.Value += "%";
     }
 }
Beispiel #6
0
 private void xrCheckBox2_EvaluateBinding(object sender, BindingEventArgs e)
 {
     numric++;
     if (numric == 0)
     {
         Make();
     }
     e.Value = a[numric];
 }
Beispiel #7
0
        /// <summary>
        /// 如果绑定的时候值为0,则不绑定任何值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void xrTableCell_EvaluateBinding(object sender, BindingEventArgs e)
        {
            decimal value = ObjectHelper.GetDefaultDecimal(e.Value);

            if (value == 0)
            {
                e.Value = null;
            }
        }
        /// <summary>
        ///     Raises the <see cref="BindingUpdated" /> event.
        /// </summary>
        protected void RaiseBindingUpdated(BindingEventArgs args)
        {
            var handler = BindingUpdated;

            if (handler != null)
            {
                handler(this, args);
            }
        }
        private static void OnBindingUpdated(IDataBinding sender, BindingEventArgs args)
        {
            IBindingErrorProvider errorProvider = BindingServiceProvider.ErrorProvider;

            if (errorProvider != null)
            {
                SetErrors(errorProvider, sender, Empty.Array <object>());
            }
        }
        public void RaiseBindingUpdated(BindingEventArgs e)
        {
            var handler = BindingUpdated;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #11
0
 private void DateTaken_EvaluateBinding(object sender, BindingEventArgs e)
 {
     try{
         if (e.Value != null)
         {
             e.Value = Convert.ToDateTime(e.Value).ToString("dd-MMM-yyyy hh:mm tt");
         }
     }
     catch (Exception ex) {}
 }
Beispiel #12
0
 private void FormatDate(Object sender, BindingEventArgs e)
 {
     try {
         if (e.Value != null)
         {
             e.Value = String.Format("<div style='font-size:25px;font-family:Times New Roman;'><center><i>has on <b>{0}</b></i></center></dib>", e.Value);
         }
     }
     catch (Exception ex) {
     }
 }
Beispiel #13
0
        protected virtual async void OnViewModelPropertyChanged(object sender, BindingEventArgs e)
        {
            var control = Controls.AsEnumerable().FirstOrDefault(x => x.Name == e.ControlName);

            if (control == null)
            {
                return;
            }
            //TODO: throw new MvfException($"Could not bind {e.Property.Name} property because related control is not found");

            await BindingDispatcher.BindControl(control, e.Property, e.Converter, e.Type);
        }
Beispiel #14
0
        private void FormatZeroValues(object sender, BindingEventArgs e)
        {
            int  num;
            bool success = Int32.TryParse(Convert.ToString(e.Value), out num);

            if (success)
            {
                if (num == 0)
                {
                    e.Value = "";
                }
            }
        }
Beispiel #15
0
    private void PorpertyChanged(object sender, BindingEventArgs e)
    {
        if (_bindings.Keys.Contains(e.Name))
        {
            _bindings[e.Name] = e.Binding;
        }
        else
        {
            _bindings.Add(e.Name, e.Binding);
        }

        OnBindingUpdated.Invoke(this, e);
    }
Beispiel #16
0
        private void OnBindingException(object sender, BindingEventArgs args)
        {
            if (args.Exception == null)
            {
                return;
            }
            var dataBinding = sender as IDataBinding;

            if (dataBinding != null && args.Action == BindingAction.UpdateSource)
            {
                SetDefaultValue(dataBinding);
            }
        }
Beispiel #17
0
 private void OnBindingException(IDataBinding sender, BindingEventArgs args)
 {
     if (args.Exception == null || args.OriginalException == null)
     {
         return;
     }
     UpdateErrors(new object[]
     {
         ValidatesOnExceptionsBehavior.ShowOriginalException
             ? args.OriginalException.Message
             : args.Exception.Message
     }, null);
 }
Beispiel #18
0
        private void DateTimeFormatting_EvaluateBinding(object sender, BindingEventArgs e)
        {
            XRTableCell cell = (sender as XRTableCell);

            if (e.Value != null && !String.IsNullOrWhiteSpace(e.Value.ToString()))
            {
                DateTime?value = Convert.ToDateTime(e.Value);
                value = DateTimeToLocal.Convert(value, GetCurrentTimeZone());

                string formattedDate = value.Value.ToString("dd/MM/yyyy HH:mm");

                e.Value = formattedDate;
            }
        }
        /// <summary>
        /// 格式化部门名称
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbDepartment_EvaluateBinding(object sender, BindingEventArgs e)
        {
            var id  = this.GetCurrentColumnValue <string>("DepartmentId");
            var dep = this.departments.Find(r => r.Id == id);

            if (dep == null)
            {
                e.Value = "";
            }
            else
            {
                e.Value = dep.Name;
            }
        }
Beispiel #20
0
        private void ElementHeaderTitle_EvaluateBinding(object sender, BindingEventArgs e)
        {
            PEMR_Translated mainTranslated = e.Value as PEMR_Translated;

            if (mainTranslated == null)
            {
                return;
            }
            mainTranslated.ElementName = "Patient Electronic Medical Record";
            PEMR_PatientMedicalRecordReportSub_rpt subReport = new PEMR_PatientMedicalRecordReportSub_rpt();

            subReport.Initialize((e.Value as PEMR_Translated).List_PEMR_Element_Translated);
            elementSubReport.ReportSource = subReport;
        }
Beispiel #21
0
        protected void RaiseBindingException(Exception exception, Exception originalException, BindingAction action)
        {
            BindingEventArgs args = null;
            var handler           = BindingUpdated;

            if (handler != null)
            {
                args = new BindingEventArgs(action, exception, originalException);
                handler(this, args);
            }
            if (BindingServiceProvider.BindingExceptionHandler != null)
            {
                BindingServiceProvider.RaiseBindingException(this, args ?? new BindingEventArgs(action, exception, originalException));
            }
        }
Beispiel #22
0
 private static void OnBindingUpdated(IDataBinding sender, BindingEventArgs args)
 {
     if (args.Exception == null)
     {
         IBindingErrorProvider errorProvider = BindingServiceProvider.ErrorProvider;
         if (errorProvider != null)
         {
             SetErrors(errorProvider, sender, Empty.Array <object>(), null);
         }
     }
     else
     {
         IBindingErrorProvider errorProvider = BindingServiceProvider.ErrorProvider;
         if (errorProvider != null)
         {
             SetErrors(errorProvider, sender,
                       new object[] { ShowOriginalException?args.OriginalException.Message: args.Exception.Message }, null);
         }
     }
 }
Beispiel #23
0
        public BindingEventArgs GetBindingEventArgs(MethodBase methodBase)
        {
            var property = methodBase.DeclaringType?.GetProperty(methodBase.Name.Remove(0, 4));

            if (property == null)
            {
                throw new MvfException($"Could not bind {methodBase.Name}. {nameof(RaisePropertyChanged)} must be called from property.");
            }

            var bindingAttribute = property.GetAttributeOrDefault <MvfBindable>();

            if (bindingAttribute == null)
            {
                throw new MvfException($"Could not bind {methodBase.Name}. The property does not have {nameof(MvfBindable)} attribute");
            }

            var bindingEventArgs = new BindingEventArgs(bindingAttribute.ControlPropertyName, bindingAttribute.ControlName,
                                                        property.GetValue(this, null), property, bindingAttribute.Type, bindingAttribute.ConverterType);

            return(bindingEventArgs);
        }
        private void ElementHeaderTitle_EvaluateBinding(object sender, BindingEventArgs e)
        {
            XRLabel mainServiceTitle = sender as XRLabel;

            if (mainServiceTitle == null || !(e.Value is PEMR_Translated))
            {
                return;
            }

            switch (PEMR_Element)
            {
            case DB_PEMR_ElementType.VisitTiming_Medications:
                PEMR_Element_Medications_A5_rpt elementReport = new PEMR_Element_Medications_A5_rpt();
                PEMR_Translated translated = e.Value as PEMR_Translated;
                if (translated.List_PEMR_Element_Translated != null &&
                    translated.List_PEMR_Element_Translated.Count > 0)
                {
                    elementReport.Initialize(translated.List_PEMR_Element_Translated);
                    elementSubReport.ReportSource = elementReport;
                }

                break;
            }
        }
 private void xrTableCell11_EvaluateBinding(object sender, BindingEventArgs e)
 {
     Venta vent =
         new EmpeñosDC(new clsConeccionDB().StringConn()).Ventas.Single(c => c.Clave == Convert.ToInt32(e.Value));
     e.Value = vent.Saldo-vent.PagosVentas.Where(pv=>pv.Estado).Sum(pv=>pv.Abono);
 }
Beispiel #26
0
 private void xrItemCode_EvaluateBinding(object sender, BindingEventArgs e)
 {
 }
 private void xrCheckBox1_EvaluateBinding(object sender, BindingEventArgs e)
 {
     e.Value = true;
 }
Beispiel #28
0
 protected void RaiseBindingUpdated(BindingEventArgs args)
 {
     BindingUpdated?.Invoke(this, args);
 }
 public static void RaiseBindingException(IDataBinding binding, BindingEventArgs args)
 {
     BindingExceptionHandler?.Invoke(binding, args);
 }