Exemplo n.º 1
0
        public DataTable getCities(out THC_Library.Error error)
        {
            error = null;
            DataTable            addrTable = null;
            IList <SqlParameter> paraList  = new System.Collections.Generic.List <SqlParameter>();
            string strSQL = "select distinct city,sec from taiwan_map order by sec";

            THC_Library.DataBase.DataBaseControl dbCtl = new THC_Library.DataBase.DataBaseControl();
            try
            {
                dbCtl.Open();
                addrTable = dbCtl.GetDataTable(strSQL, paraList);
            }
            catch (Exception ex)
            {
                error              = new Error();
                error.Number       = 100;
                error.ErrorMessage = "系統錯誤";
            }
            finally
            {
                dbCtl.Close();
            }
            return(addrTable);
        }
Exemplo n.º 2
0
        public DataTable getRoad(string city, string town, out THC_Library.Error error)
        {
            error = null;
            DataTable            addrTable = null;
            IList <SqlParameter> paraList  = new System.Collections.Generic.List <SqlParameter>();
            string strSQL = "select road from taiwan_map where city=@city and town=@town order by road";

            THC_Library.DataBase.DataBaseControl dbCtl = new THC_Library.DataBase.DataBaseControl();
            try
            {
                dbCtl.Open();
                paraList.Add(new SqlParameter("@city", city));
                paraList.Add(new SqlParameter("@town", town));
                addrTable = dbCtl.GetDataTable(strSQL, paraList);
            }
            catch (Exception ex)
            {
                error              = new Error();
                error.Number       = 100;
                error.ErrorMessage = "系統錯誤";
            }
            finally
            {
                dbCtl.Close();
            }
            return(addrTable);
        }
Exemplo n.º 3
0
        public bool checkLocalAccount(string account, out Error error)
        {
            error = null;
            bool bExisted = false;

            IList <SqlParameter> paraList = new System.Collections.Generic.List <SqlParameter>();
            string strSQL = "select CM002 from consumer_member where CM002=@CM002";

            paraList.Add(new  SqlParameter("@CM002", account));
            DataBaseControl dbCtl = new DataBaseControl();

            try
            {
                dbCtl.Open();
                IDataReader dataReader = dbCtl.GetReader(strSQL, paraList);
                if (dataReader.Read())
                {
                    bExisted = true;
                }
                dataReader.Close();
            }
            catch (Exception ex)
            {
                error              = new THC_Library.Error();
                error.Number       = THC_Library.THCException.SYSTEM_ERROR;
                error.ErrorMessage = ex.Message;
            }
            finally
            {
                dbCtl.Close();
            }

            return(bExisted);
        }