Пример #1
0
 public bool CheckIDStatus(int id)
 {
     using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Connection.CnnVal("ATMDb")))
     {
         dataReader = connection.ExecuteReader("dbo.CheckIDStatus " + id);
         return(dataReader.Read() ? true : false);
     }
 }
Пример #2
0
 public int CheckLastNumber(string name)
 {
     using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Connection.CnnVal("ATMDb")))
     {
         if (string.IsNullOrEmpty(name))
         {
             return(0);
         }
         dataReader = connection.ExecuteReader("dbo.CheckLastNumber " + name);
         return(dataReader.Read() ? dataReader.GetInt32(0) : 0);
     }
 }
Пример #3
0
 public int CheckIDATM(string name)  // returns 0 if there is no record in ATM or record ID, if any
 {
     using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Connection.CnnVal("ATMDb")))
     {
         if (string.IsNullOrEmpty(name))
         {
             return(0);
         }
         dataReader = connection.ExecuteReader("dbo.CheckIDATM " + name);
         return(dataReader.Read() ? dataReader.GetInt32(0) : 0);
     }
 }
Пример #4
0
 /// <summary>
 /// 透過SiteID 與 PageNO取得上層的MenuID 與 DataType
 /// </summary>
 /// <param name="SiteID"></param>
 /// <param name="PageNo"></param>
 void GetMenuIDAndDataType(long SiteID, long PageNo)
 {
     using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(WebInfo.Conn))
     {
         string    sql   = $"select MenuID,Menus.DataType from Pages inner join Menus on Menus.ID=Pages.MenuID where Pages.SiteID={SiteID} and Pages.[No]={PageNo}";
         var       query = conn.ExecuteReader(sql);
         DataTable dt    = new DataTable();
         dt.Load(query);
         if (dt.Rows.Count > 0)
         {
             DataRow dr = dt.Rows[0];
             _MenuID   = (long)dr["MenuID"];
             _DataType = dr["DataType"] != null ? dr["DataType"].ToString().Trim() : string.Empty;
         }
     }
 }
Пример #5
0
        /// <summary>
        /// 查詢廣告的menu id
        /// </summary>
        /// <param name="SiteID"></param>
        /// <returns></returns>
        public static long GetAdvertisementMenuID(long SiteID)
        {
            long result = 0;

            using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(WebInfo.Conn))
            {
                string    sql   = $"select * from Menus where SN='Advertisement' and SiteID={SiteID}";
                var       query = conn.ExecuteReader(sql);
                DataTable dt    = new DataTable();
                dt.Load(query);
                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    return((long)dr["ID"]);
                }
            }

            return(result);
        }