Ejemplo n.º 1
0
        public List<Customer> searchCusAll()
        {
            List<Customer> cusList = new List<Customer>();

            string sqlStr = dbUtil.getSqlStatement("SQL_Cus_SearchAll");
            DataSet searchResult = null;
            try
            {
                searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, null);
                foreach (DataTable dt in searchResult.Tables)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        Customer cus = new Customer();
                        cus.CustomId = dr["CusID"].ToString();
                        cus.Name = dr["CusName"].ToString();
                        cus.CompanyName = dr["CusCompName"].ToString();
                        cus.CusTypeId = dr["CusTypeID"].ToString();
                        cus.TelNum1 = dr["Tel1"].ToString();
                        cus.TelNum2 = dr["Tel2"].ToString();
                        cus.ZipCode = dr["ZipCode"].ToString();
                        cus.Address = dr["CusAddress"].ToString();
                        cus.RebateTypeId = dr["RebateTypeID"].ToString();
                        cusList.Add(cus);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return cusList;
        }
Ejemplo n.º 2
0
 public void Save(Customer cus)
 {
 }
Ejemplo n.º 3
0
        public Customer getCustomer(string cusId)
        {
            Customer cus = new Customer();
            try
            {
                cus = cusDAO.searchCusByCusId(cusId);
            }
            catch (Exception ex)
            {

            }
            return cus;
        }
Ejemplo n.º 4
0
        public List<Customer> searchCusByMultiFilter(Hashtable hashTable)
        {
            List<Customer> cusList = new List<Customer>();

            string sqlStr = dbUtil.getSqlStatement("SQL_Cus_SearchByMultiFilter");

            ArrayList listParms = new ArrayList();

            UtilService utilService = new UtilService();

            if (hashTable.Contains("@CusID"))
            {
                sqlStr = utilService.validSearchFilter(sqlStr, "@CusID");
                listParms.Add(new SqlParameter("@CusID", SqlDbType.VarChar, 20));
            }

            if (hashTable.Contains("@CusName"))
            {
                sqlStr = utilService.validSearchFilter(sqlStr, "@CusName");
                listParms.Add(new SqlParameter("@CusName", SqlDbType.NVarChar, 100));
            }

            if (hashTable.Contains("@CusCompName"))
            {
                sqlStr = utilService.validSearchFilter(sqlStr, "@CusCompName");
                listParms.Add(new SqlParameter("@CusCompName", SqlDbType.NVarChar, 100));
            }

            if (hashTable.Contains("@TelNum"))
            {
                sqlStr = utilService.validSearchFilter(sqlStr, "@TelNum");
                listParms.Add(new SqlParameter("@TelNum", SqlDbType.VarChar, 20));
            }

            if (hashTable.Contains("@CusTypeID"))
            {
                sqlStr = utilService.validSearchFilter(sqlStr, "@CusTypeID");
                listParms.Add(new SqlParameter("@CusTypeID", SqlDbType.VarChar, 20));
            }

            SqlParameter[] sqlParms = (SqlParameter[])listParms.ToArray(typeof(SqlParameter));

            foreach (SqlParameter parm in sqlParms)
            {
                parm.Value = hashTable[parm.ParameterName];
            }

            DataSet searchResult = null;
            try
            {
                searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms);
                foreach (DataTable dt in searchResult.Tables)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        Customer cus = new Customer();
                        cus.CustomId = dr["CusID"].ToString();
                        cus.Name = dr["CusName"].ToString();
                        cus.CompanyName = dr["CusCompName"].ToString();
                        cus.CusTypeId = dr["CusTypeID"].ToString();
                        cus.TelNum1 = dr["Tel1"].ToString();
                        cus.TelNum2 = dr["Tel2"].ToString();
                        cus.ZipCode = dr["ZipCode"].ToString();
                        cus.Address = dr["CusAddress"].ToString();
                        cus.RebateTypeId = dr["RebateTypeID"].ToString();
                        cusList.Add(cus);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return cusList;
        }