Exemplo n.º 1
0
        private void LoadComboQueryRecordset(string _query, dynamic oComboBox, string fieldValue, string fieldDesc, SAPbobsCOM.Company oCompany)
        {
            //oApp = (SAPbouiCOM.Application)Application.SBO_Application;
            //oCompany = (SAPbobsCOM.Company)oApp.Company.GetDICompany();

            SAPbobsCOM.Recordset businessObject = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            businessObject.DoQuery(_query);
            SAPbouiCOM.ValidValues validValues = oComboBox.ValidValues;

            CleanComboBox(oComboBox);

            if (!string.Equals(fieldDesc, string.Empty))
            {
                while (!businessObject.EoF)
                {
                    validValues.Add((dynamic)businessObject.Fields.Item(fieldValue).Value, (dynamic)businessObject.Fields.Item(fieldDesc).Value);
                    businessObject.MoveNext();
                }
            }
            else
            {
                while (!businessObject.EoF)
                {
                    validValues.Add((dynamic)businessObject.Fields.Item(fieldValue).Value, "");
                    businessObject.MoveNext();
                }
            }
        }
Exemplo n.º 2
0
 public static void LoadComboQuery(string _query, ref SAPbouiCOM.ComboBox oComboBox, string fieldValue, string fieldDesc, SAPbobsCOM.Company oCompany)
 {
     SAPbobsCOM.Recordset businessObject = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
     businessObject.DoQuery(_query);
     SAPbouiCOM.ValidValues validValues = oComboBox.ValidValues;
     while (oComboBox.ValidValues.Count > 0)
     {
         oComboBox.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
     }
     if (!string.Equals(fieldDesc, string.Empty))
     {
         while (!businessObject.EoF)
         {
             validValues.Add((dynamic)businessObject.Fields.Item(fieldValue).Value, (dynamic)businessObject.Fields.Item(fieldDesc).Value);
             businessObject.MoveNext();
         }
     }
     else
     {
         while (!businessObject.EoF)
         {
             validValues.Add((dynamic)businessObject.Fields.Item(fieldValue).Value, "");
             businessObject.MoveNext();
         }
     }
 }