Exemple #1
0
 public void _SetForm()
 {
     if (Code > 0)
     {
         ClassLibrary.JDataBase db = new ClassLibrary.JDataBase();
         db.setQuery(@"select Code,Text from entSharePriceText where Code = " + Code);
         System.Data.DataTable Dt = new System.Data.DataTable();
         Dt = db.Query_DataTable();
         if (Dt.Rows.Count > 0)
         {
             txtText.Text = Dt.Rows[0]["Text"].ToString();
         }
     }
 }
Exemple #2
0
 public static void DeleteByGroupName(int pPostCode, string pGroupName)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         DB.setQuery("delete from refGroupname where postCode=" + pPostCode + " and Groupname=N'" + pGroupName + "'");
         DB.Query_Execute();
     }
     catch
     {
     }
     finally
     {
         DB.Dispose();
     }
 }
 public bool Save()
 {
     ClassLibrary.JDataBase db = new ClassLibrary.JDataBase();
     db.setQuery(@"insert into ShareMessage([Code]
                                       ,[SenderCode]
                                       ,[ReceiverCode]
                                       ,[sDate]
                                       ,[Title]
                                       ,[Body]
                                       ,[Type]) values((select max(code)+1 from ShareMessage)," + WebClassLibrary.SessionManager.Current.MainFrame.CurrentPersonCode + @",
                                         " + ((WebControllers.MainControls.JCustomListSelectorControl)JSearchPersonControlInstaller).Code + @"
                                         ,'" + ClassLibrary.JDateTime.FarsiDate(DateTime.Now).ToString() + @"'
                                         ,'" + txtSubject.Text + @"'
                                          ,'" + txtBody.Text + @"',2)");
     return(db.Query_Execute() >= 0 ? true : false);
 }
Exemple #4
0
 public bool Proceced(int Code)
 {
     ClassLibrary.JDataBase db = ClassLibrary.JGlobal.MainFrame.GetDBO();
     try
     {
         db.setQuery("UPDATE [AVLArea] SET [IsProceced]='true' WHERE [Code] = " + Code);
         if (db.Query_Execute() >= 0)
         {
             return(true);
         }
         return(false);
     }
     finally
     {
         db.Dispose();
     }
 }
Exemple #5
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();
     }
 }
Exemple #6
0
        public static System.Data.DataTable GetDataTablePoints(string devicecode = "0", string fromDate = "1/1/1", string toDate = "1/1/1", string StartRow = "0", string LastRow = "", bool checkPermission = true)
        {
            bool haspermission = true;

            if (checkPermission)
            {
                haspermission = (ClassLibrary.JPermission.CheckPermission("AVL.Coordinate.Traditional.JTransactionCars.GetDataTablePoints"));
            }
            if (!haspermission)
            {
                return(null);
            }
            ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
            try
            {
                string query = @"select * from (SELECT 
                                row_number() over(order by [DeviceSendDateTime]  ) as Row, *
                                FROM [AVLCoordinate] where 
                                lat IS NOT NULL 
                                AND lng IS NOT NULL 
                                AND   DeviceSendDateTime BETWEEN '" + fromDate +
                               "' AND '" + toDate +
                               "' AND  DeviceCode = " + devicecode;

                if (!string.IsNullOrEmpty(LastRow))
                {
                    query += string.Format(" ) a WHERE a.Row BETWEEN  {0} AND {1}", StartRow, LastRow);
                }
                else
                {
                    query += ") a";
                }
                query += " order by DeviceSendDateTime";
                DB.setQuery(query);
                return(DB.Query_DataTable());
            }
            catch (Exception ex)
            {
                ClassLibrary.JSystem.Except.AddException(ex);
                return(null);
            }
            finally
            {
                DB.Dispose();
            }
        }
Exemple #7
0
 public static DataTable GetBusDetails(string BusSerial)
 {
     ClassLibrary.JDataBase db = new ClassLibrary.JDataBase();
     try
     {
         db.setQuery(@"select B.Code, B.BUSNumber, A.Capacity, A.Plaque, PO.Name OwnerName, PO.Fam OwnerFam from AUTBus B
                     left join AUTAutomobile A on A.code = B.CarCode
                     left join AUTBusOwner O on O.BusCode = B.Code
                     left join clsPerson PO on PO.Code = O.CodePerson
                     where BUSNumber = " + BusSerial);
         return(db.Query_DataTable());
     }
     finally
     {
         db.Dispose();
     }
 }
Exemple #8
0
 public bool Remove()
 {
     ClassLibrary.JDataBase db = ClassLibrary.JGlobal.MainFrame.GetDBO();
     try
     {
         db.setQuery("DELETE FROM [AVLArea] WHERE [code] = " + this.code + " AND personCode=" + this.personCode);
         if (db.Query_Execute() > 0)
         {
             return(true);
         }
         return(false);
     }
     finally
     {
         db.Dispose();
     }
 }
Exemple #9
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();
     }
 }
Exemple #10
0
 public static DataTable GetDataTable(int lineCode = 0, int PathType = 0)
 {
     string where = "";
     if (lineCode > 0)
     {
         where = " Where LineCode=" + lineCode + " and PathType = " + PathType;
     }
     ClassLibrary.JDataBase db = new ClassLibrary.JDataBase();
     try
     {
         db.setQuery("Select * From AUTFleetLinePoints " + where + " Order By OrderNo ASC");
         return(db.Query_DataTable());
     }
     finally
     {
         db.Dispose();
     }
 }
Exemple #11
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();
     }
 }
Exemple #12
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();
     }
 }
Exemple #13
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();
     }
 }
Exemple #14
0
        public static System.Data.DataTable GetDataTablePoints(string id = "0", string fromDate = "1/1/1", string toDate = "1/1/1", string StartRow = "0", string LastRow = "")
        {
            if (!ClassLibrary.JPermission.CheckPermission("AVL.Coordinate.Traditional.JTransactionCars.GetDataTablePoints"))
            {
                return(null);
            }
            ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
            try
            {
                string query = @"select * from (SELECT 
row_number() over(order by [DateSend]  ) as Row, [TransactionID]
      ,[CarID]
      ,[Longitude]
      ,[Latitude]
      ,[Altitude]
      ,[DateSend]
      ,[DateReceive]
  FROM [avlsite_com_1].[dbo].[TransactionCars] where Latitude IS NOT NULL 
AND Longitude IS NOT NULL 
AND   DateSend BETWEEN '" + fromDate +
                               "' AND '" + toDate +
                               "' AND  CarID=" + id;

                //  query +=  " AND "+ClassLibrary.JPermission.getObjectSql("AVL.Coordinate.Traditional.JTransactionCars.GetDataTablePoints", "TransactionCars.CarID");


                if (!string.IsNullOrEmpty(LastRow))
                {
                    query += string.Format(" ) a WHERE a.Row BETWEEN  {0} AND {1}", StartRow, LastRow);
                }

                DB.setQuery(query);
                return(DB.Query_DataTable());
            }
            catch (Exception ex)
            {
                ClassLibrary.JSystem.Except.AddException(ex);
                return(null);
            }
            finally
            {
                DB.Dispose();
            }
        }
Exemple #15
0
        public static System.Data.DataTable GetDataTable(bool checkpermission, string pParameters, int pCode = 0)
        {
            bool haspermission = true;

            if (checkpermission)
            {
                haspermission = ClassLibrary.JPermission.CheckPermission("AVL.RegisterDeivce.JRegisterDevices.GetDataTable");
            }
            if (!haspermission)
            {
                return(null);
            }
            ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
            string parameters         = "";

            try
            {
                parameters = pParameters;
            }
            catch { parameters = ""; }
            try
            {
                string query = string.Format(@"SELECT * FROM AVLDevice WHERE 1=1 {0} ", parameters);
                if (pCode > 0)
                {
                    query += " AND personCode=" + pCode;
                }
                // + " WHERE " + ClassLibrary.JPermission.getObjectSql("AVL.RegisterDeivce.JRegisterDevices.GetDataTable", "AVLRegisterDevice.Code");


                DB.setQuery(query);
                return(DB.Query_DataTable());
            }
            catch (Exception ex)
            {
                ClassLibrary.JSystem.Except.AddException(ex);
                return(null);
            }
            finally
            {
                DB.Dispose();
            }
        }
Exemple #16
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();
     }
 }
Exemple #17
0
 public static System.Data.DataTable GetUserAllDevices(string imei)
 {
     ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
     try
     {
         string query = string.Format(@"SELECT *  FROM [AVLDB].[dbo].[AVLDevice] where personCode=(select top 1 personCode from AVLDevice WHERE IMEI='" + imei + "')");
         DB.setQuery(query);
         return(DB.Query_DataTable());
     }
     catch (Exception ex)
     {
         ClassLibrary.JSystem.Except.AddException(ex);
         return(null);
     }
     finally
     {
         DB.Dispose();
     }
 }
Exemple #18
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();
     }
 }
Exemple #19
0
        public bool Updateit1() //update insert field of database in autbazrasservice for bazrasservicereport
        {
            ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
            try
            {
                DB.setQuery(@"
                    update AUTBazRasService Set InsertDate=getdate()
                    where code=" + Code + "");
                DB.Query_Execute();
            }
            finally
            {
                DB.Dispose();
            }
            JBazRasServiceTable BST = new JBazRasServiceTable();

            BST.SetValueProperty(this);
            return(BST.Update());
        }
Exemple #20
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();
     }
 }
Exemple #21
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();
     }
 }
Exemple #22
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();
     }
 }
Exemple #23
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();
     }
 }
Exemple #24
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();
     }
 }
Exemple #25
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();
     }
 }
Exemple #26
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();
            }
        }
Exemple #27
0
 public static DataTable GetDataTableNew(int lineCode = 0, int PathType = 0)
 {
     string where = "";
     if (lineCode > 0)
     {
         where = "and  als.LineCode=" + lineCode + " and IsBack = " + PathType;
     }
     ClassLibrary.JDataBase db = new ClassLibrary.JDataBase();
     try
     {
         db.setQuery(@"select ats.Lat latitude,ats.Lng longitude from autlinestation als 
                      left join autstation ats on als.StationCode = ats.Code
                      where linecode not in(select LineCode from AUTFleetLinePoints where pathtype=" + PathType + "+1) " + where + " Order By Priority");
         return(db.Query_DataTable());
     }
     finally
     {
         db.Dispose();
     }
 }
Exemple #28
0
        public static System.Data.DataTable GetDataTableToday(int pCode)
        {
            if (!ClassLibrary.JPermission.CheckPermission("AVL.ObjectList.JObjectList.GetDataTable"))
            {
                return(null);
            }
            ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
            try
            {
                string query;
                try
                {
                    //string parameters = WebClassLibrary.SessionManager.Current.Session["OnlineMapLastFilter"].ToString();
                }
                catch { }
                query = @"SELECT ol.* FROM AVLObjectList ol inner join AVLCash c On c.userCode=ol.personCode "
                        + " WHERE ol.personCode=" + pCode + " AND  ol.lastSendDate > DATEADD(hour,-24,getdate()) AND (c.paid>0) ";// ";//" AND " + ClassLibrary.JPermission.getObjectSql("AVL.ObjectList.JObjectList.GetDataTable", "AVLObjectList.Code");



                AVL.SubUserObjects.jSubUserObjects user = new SubUserObjects.jSubUserObjects();
                user.GetData(WebClassLibrary.SessionManager.Current.MainFrame.CurrentUserCode);
                if (user.Code > 0)
                {
                    string parentObjects = user.objects.Remove(user.objects.Length - 1);
                    query += "   OR Code IN ( " + parentObjects + ")";
                }

                DB.setQuery(query);
                return(DB.Query_DataTable());
            }
            catch (Exception ex)
            {
                ClassLibrary.JSystem.Except.AddException(ex);
                return(null);
            }
            finally
            {
                DB.Dispose();
            }
        }
Exemple #29
0
 public bool UpdateDetails(string IMEI, string Factory, string Model, string OsVersion)
 {
     ClassLibrary.JDataBase db = ClassLibrary.JGlobal.MainFrame.GetDBO();
     try
     {
         db.setQuery(string.Format("UPDATE [AVLDevice] SET Factory={0},Model={1},OSVersion={2} WHERE [IMEI] = {3}",
                                   Factory,
                                   Model,
                                   OsVersion,
                                   IMEI));
         if (db.Query_Execute() >= 0)
         {
             return(true);
         }
         return(false);
     }
     finally
     {
         db.Dispose();
     }
 }
Exemple #30
0
        public static System.Data.DataTable GetDataTable()
        {
            ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
            try
            {
                string query = @"SELECT * FROM [AVLTSIPAndroidSocket]"
                               + " WHERE  [IsProceced]='false'";

                DB.setQuery(query);
                return(DB.Query_DataTable());
            }
            catch (Exception ex)
            {
                ClassLibrary.JSystem.Except.AddException(ex);
                return(null);
            }
            finally
            {
                DB.Dispose();
            }
        }