Exemplo n.º 1
0
        /// <summary>
        /// Receives a ReturnField, SearchExpression and field to be searched a as parameters. The function
        /// looks up a value and returns the value of the ReturnField on a successful
        /// search. The function maintains the last Order() of the view.
        /// Please note that unlike the VFP Lookup() command this one receives the ReturnField and SearchField as strings.
        /// </summary>
        /// <example>
        /// string cCustomer = vfpData.Lookup("cname", "60", "iid", oView)
        /// </example>
        /// <param name="tcReturnField"></param>
        /// <param name="tcSearchExpression"></param>
        /// <param name="tcSearchedField"></param>
        /// <returns></returns>
        public static string Lookup(string tcReturnField, string tcSearchExpression, string tcSearchedField, DataView toView)
        {
            string cRetVal = "";

            //Capture the current order
            string cOrder = VfpData.Order(toView);

            try
            {
                //Set the order to the search order
                VfpData.SetOrderTo(tcSearchedField, toView);

                int nFoundRec = VfpData.Seek(tcSearchExpression, toView);

                //If we find a record then get the return value
                if (nFoundRec != -1)
                {
                    cRetVal        = toView.Table.Rows[nFoundRec][tcReturnField].ToString();
                    VfpData._Found = true;
                }
            }
            finally
            {
                //Cleanup to reset the old order
                toView.Sort = cOrder;
            }
            return(cRetVal);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Deletes all the records in the DataView
 /// </summary>
 /// <example>
 /// DeleteAll(toView);
 /// </example>
 /// <param name="toView"></param>
 public static void DeleteAll(DataView toView)
 {
     //Forward the call to delete for with a blank filter condition
     VfpData.DeleteFor("");
 }
Exemplo n.º 3
0
 public static int IndexSeek(string tcExpression)
 {
     return(VfpData.IndexSeek(tcExpression, VfpData.oView));
 }
Exemplo n.º 4
0
 /// <summary>
 /// As ADO.NET does not support current position of cursors.
 /// This functions performs the same action as that of a seek
 /// </summary>
 /// <param name="tcExpression"></param>
 /// <param name="toView"></param>
 /// <returns></returns>
 public static int IndexSeek(string tcExpression, DataView toView)
 {
     return(VfpData.Seek(tcExpression, toView));
 }
Exemplo n.º 5
0
 public static bool Descending()
 {
     return(VfpData.Descending(VfpData.oView));
 }
Exemplo n.º 6
0
 public static string Lookup(string tcReturnField, string tcSearchExpression, string tcSearchedField)
 {
     return(VfpData.Lookup(tcReturnField, tcSearchExpression, tcSearchedField, VfpData.oView));
 }