Exemplo n.º 1
0
 //اگر کد برابر صفر باشد تنها مقادیر مربوط به دیتای کاربر فعلی را می گیرد.
 public bool GetData(int code = 0, int userCode = -1)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         if (code == 0)
         {
             DB.setQuery("select top 1 * from AVLCash where  userCode=" + userCode);
         }
         else
         {
             DB.setQuery("select top 1 * from AVLCash where code=" + code + " AND userCode=" + userCode);
         }
         DB.Query_DataReader();
         if (DB.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, DB.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemplo n.º 2
0
 public JFactorItem(int pFactorCode)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         DB.setQuery("select top 1 * from AccFactorItem where Factorcode=" + pFactorCode);
         DB.Query_DataReader();
         if (DB.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, DB.DataReader);
         }
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemplo n.º 3
0
 public bool GetData(string deviceCode, int personcode, string name)
 {
     ClassLibrary.JDataBase db = ClassLibrary.JGlobal.MainFrame.GetDBO();
     try
     {
         db.setQuery("SELECT top 1 * FROM [AVLArea] WHERE [deviceCode]=" + deviceCode + " and personCode=" + personcode + " and [Name]=N'" + name + "'");
         if (db.Query_DataReader() && db.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, db.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         db.Dispose();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// If isGeofence was FALSE, it will return all the lines
 /// If isGeofence was TRUE, it will return all the geofence areas
 /// </summary>
 /// <param name="IsGeofence"></param>
 /// <returns></returns>
 public bool GetAreas(bool IsGeofence = false)
 {
     ClassLibrary.JDataBase db = ClassLibrary.JGlobal.MainFrame.GetDBO();
     try
     {
         db.setQuery("SELECT * FROM [AVLArea] WHERE [IsGeofence] = '" + IsGeofence + "'");
         if (db.Query_DataReader() && db.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, db.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         db.Dispose();
     }
 }
Exemplo n.º 5
0
 public bool GetData(string whereClause)
 {
     ClassLibrary.JDataBase db = ClassLibrary.JGlobal.MainFrame.GetDBO();
     try
     {
         db.setQuery("SELECT top 1 * FROM [AVLJoinDevice] WHERE " + whereClause);
         if (db.Query_DataReader() && db.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, db.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         db.Dispose();
     }
 }
Exemplo n.º 6
0
 public bool GetData(int currentUserCode)
 {
     ClassLibrary.JDataBase db = ClassLibrary.JGlobal.MainFrame.GetDBO();
     try
     {
         db.setQuery("SELECT * FROM [AVLSubUserObjects] WHERE  AND [userCode]=" + currentUserCode);
         if (db.Query_DataReader() && db.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, db.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         db.Dispose();
     }
 }
Exemplo n.º 7
0
 public static Int64 GetCash(int userCode)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         DB.setQuery("select top 1 paid from AVLCash where  userCode=" + userCode);
         DB.Query_DataReader();
         if (DB.DataReader.Read())
         {
             Int64 t = Convert.ToInt64(DB.DataReader[0]);
             return(t);
         }
         return(0);
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemplo n.º 8
0
 public bool PerformGetData(string query)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         DB.setQuery(query);
         DB.Query_DataReader();
         if (DB.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, DB.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemplo n.º 9
0
 public bool GetData(string pCode)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         DB.setQuery("select top 1 * from avlsite_com_1.dbo.TransactionCars where CarID=" + pCode);
         DB.Query_DataReader();
         if (DB.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, DB.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemplo n.º 10
0
 public bool GetDataByFactorCode(int FactorCode)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         DB.setQuery("select top 1 * from AVLPaid where FactorCode=" + FactorCode);
         DB.Query_DataReader();
         if (DB.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, DB.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemplo n.º 11
0
 public bool GetData(string Code)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         DB.setQuery("select top 1 * from AVLDeviceModel where Code=" + Code);
         DB.Query_DataReader();
         if (DB.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, DB.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemplo n.º 12
0
 public bool GetData(string domain)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         DB.setQuery("select top 1 * from AVLResellerDomain where domain='" + domain + "'");
         DB.Query_DataReader();
         if (DB.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, DB.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemplo n.º 13
0
 public bool GetData(string where)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         DB.setQuery("select * from AVLPurchasePlan where " + where);
         DB.Query_DataReader();
         if (DB.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, DB.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemplo n.º 14
0
 public bool GetData(string pCode)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         // Need to use a faster query. Prefered using row_number().
         DB.setQuery("select top 1 * from AVLGeofenceData where Code=" + pCode);
         DB.Query_DataReader();
         if (DB.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, DB.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// Returns latest gateaway invoice inserted.
        /// </summary>
        /// <returns></returns>
        public static JAVLPaid GetLatestGateawayInvoice(int userCode)
        {
            JAVLPaid paid = new JAVLPaid();

            ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
            try
            {
                DB.setQuery("select top 1 * from AVLPaid where invoiceNumber='g' AND State=0 AND type='G'  AND userCode=" + userCode + " AND documentDateTime BETWEEN '" + DateTime.Now.AddMinutes(-15) + "' AND '" + DateTime.Now.ToString() + "'");
                DB.Query_DataReader();
                if (DB.DataReader.Read())
                {
                    ClassLibrary.JTable.SetToClassProperty(paid, DB.DataReader);
                }
                return(paid);
            }
            finally
            {
                DB.Dispose();
            }
        }
Exemplo n.º 16
0
 public bool GetData(int PCode)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         DB.setQuery("select * from AUTBazRasService where code=" + PCode);
         if (DB.Query_DataReader())
         {
             if (DB.DataReader.Read())
             {
                 ClassLibrary.JTable.SetToClassProperty(this, DB.DataReader);
                 return(true);
             }
         }
     }
     finally
     {
         DB.Dispose();
     }
     return(false);
 }
Exemplo n.º 17
0
 public bool GetData(string code, string pCode)
 {
     ClassLibrary.JDataBase db = ClassLibrary.JGlobal.MainFrame.GetDBO();
     try
     {
         db.setQuery("SELECT * FROM [AVLArea] WHERE [code] = " + code + " AND [personCode]=" + pCode);
         if (code == "0")
         {
             db.setQuery("SELECT * FROM [AVLArea] WHERE  [personCode]=" + pCode);
         }
         if (db.Query_DataReader() && db.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, db.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         db.Dispose();
     }
 }
Exemplo n.º 18
0
 public static bool Set(string KeyName, object KeyValue)
 {
     ClassLibrary.JDataBase db = new ClassLibrary.JDataBase();
     try
     {
         db.setQuery("Select * from AUTSettings Where KeyName = N'" + KeyName + "'");
         if (db.Query_DataReader() && db.DataReader.Read())
         {
             db.setQuery("Update AUTSettings SET KeyValue = N'" + KeyValue + "' Where KeyName=N'" + KeyName + "'");
         }
         else
         {
             db.setQuery("Insert into AUTSettings (KeyName, KeyValue) VALUES(N'" + KeyName + "', N'" + KeyValue + "')");
         }
         db.DataReader.Close();
         return(db.Query_Execute() >= 0 ? true : false);
     }
     finally
     {
         db.Dispose();
     }
 }
Exemplo n.º 19
0
 public bool GetData(int Code, int userCode = -1)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         DB.setQuery("select top 1 * from AccFactor where Code=" + Code + " AND userCode=" + userCode);
         if (userCode == -1)
         {
             DB.setQuery("select top 1 * from AccFactor where Code=" + Code);
         }
         DB.Query_DataReader();
         if (DB.DataReader.Read())
         {
             ClassLibrary.JTable.SetToClassProperty(this, DB.DataReader);
             return(true);
         }
         return(false);
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemplo n.º 20
0
        public bool GetData(int Code = 0, string MethodName = "", string TableName = "", int DeviceModelCode = 0)
        {
            ClassLibrary.JDataBase db = ClassLibrary.JGlobal.MainFrame.GetDBO();
            try
            {
                string query = "SELECT * FROM [AVLDataKeeper] WHERE 1=1 ";
                if (Code != 0)
                {
                    query += " AND Code=" + Code;
                }
                if (!string.IsNullOrEmpty(MethodName))
                {
                    query += " AND ExtractorMethod=" + MethodName;
                }
                if (!string.IsNullOrEmpty(TableName))
                {
                    query += " AND TableName=" + TableName;
                }
                if (DeviceModelCode != 0)
                {
                    query += " AND DeviceModelCode=" + DeviceModelCode;
                }


                db.setQuery(query);
                if (db.Query_DataReader() && db.DataReader.Read())
                {
                    ClassLibrary.JTable.SetToClassProperty(this, db.DataReader);
                    return(true);
                }
                return(false);
            }
            finally
            {
                db.Dispose();
            }
        }