Exemple #1
0
 private void LookupAccepted(IFormInterface form)
 {
     if
     (
         !ReadOnly &&
         (Source != null) &&
         (Source.DataView != null) &&
         (form.MainSource != null) &&
         (form.MainSource.DataView != null) &&
         !form.MainSource.DataView.IsEmpty()
     )
     {
         int      index         = -1;
         string[] targetColumns = GetColumnNames().Split(DAE.Client.DataView.ColumnNameDelimiters);
         foreach (string sourceColumnName in GetLookupColumnNames().Split(DAE.Client.DataView.ColumnNameDelimiters))
         {
             ++index;
             DAE.Client.DataField source = form.MainSource.DataView.Fields[sourceColumnName.Trim()];
             DAE.Client.DataField target = Source.DataSource.DataSet.Fields[targetColumns[index].Trim()];
             if (!source.HasValue())
             {
                 target.ClearValue();
             }
             else
             {
                 target.Value = source.Value;
             }
         }
     }
 }
Exemple #2
0
        // IWebPrehandler

        public virtual void PreprocessRequest(HttpContext AContext)
        {
            if (!ReadOnly && IsDataViewActive())
            {
                string LValue    = AContext.Request.Form[ID];
                string LHasValue = AContext.Request.Form[FHasValueID];
                if ((LValue != null) && ((LHasValue == null) || ((LHasValue != null) && (String.Compare(LHasValue, "true", true) == 0))))
                {
                    DAE.Client.DataField LField = Source.DataView.Fields[ColumnName];
                    if ((LValue == String.Empty) && FNilIfBlank)
                    {
                        LField.ClearValue();
                    }
                    else
                    {
                        Source.DataView.Edit();
                        if (LField.AsString != LValue)
                        {
                            LField.AsString = LValue;
                        }
                    }
                }
            }
        }