예제 #1
0
        public JCS_DataInterface.Models.Administration.PaymentType dbGet(string collection_type_code)
        {
            List <DbParameter> parameters = new List <DbParameter>();

            parameters.Add(_sqlConn.GetParameter("payment_type_code", this._paymentTypeCode));
            JCS_DataInterface.Models.Administration.PaymentType result = new JCS_DataInterface.Models.Administration.PaymentType();


            try
            {
                using (DbDataReader dataReader = _sqlConn.GetDataReader("SELECT payment_type_code,pt_display_name ,pt_description ,check_flag ,added_by FROM payment_type where payment_type_code =@payment_type_code;", parameters, System.Data.CommandType.Text))
                {
                    while (dataReader.Read())
                    {
                        result._paymentTypeCode = (string)dataReader["payment_type_code"];
                        result._ptDisplayName   = (string)dataReader["pt_display_name"];
                        result._ptDescription   = (string)dataReader["pt_description"];
                        result._checkFlag       = (string)dataReader["check_flag"];
                        result._addedBy         = (string)dataReader["added_by"];


                        return(result);
                    }
                }
            }
            catch (Exception ex)
            {
                result._ptDisplayName = "Error on JCS_DataInterface.iPaymentType.dbGet :=> " + ex.Message.ToString();
                return(result);
            }


            result._ptDisplayName = "No Records Found";
            return(result);
        }
예제 #2
0
        public List <JCS_DataInterface.Models.Administration.PaymentType> dbSearch(string searchKey)
        {
            List <DbParameter> parameters = new List <DbParameter>();

            parameters.Add(_sqlConn.GetParameter("pt_display_name", searchKey));
            parameters.Add(_sqlConn.GetParameter("pt_description", searchKey));


            List <JCS_DataInterface.Models.Administration.PaymentType> result = new List <JCS_DataInterface.Models.Administration.PaymentType>();

            JCS_DataInterface.Models.Administration.PaymentType resultItem = new JCS_DataInterface.Models.Administration.PaymentType();


            try
            {
                using (DbDataReader dataReader = _sqlConn.GetDataReader("SELECT payment_type_code,pt_display_name ,pt_description ,check_flag ,added_by FROM payment_type where pt_display_name like '%'+@pt_display_name+'%' or pt_description like '%'+@pt_description+'%'", parameters, System.Data.CommandType.Text))
                {
                    while (dataReader.Read())
                    {
                        resultItem = new Models.Administration.PaymentType();
                        resultItem._paymentTypeCode = dataReader["payment_type_code"].ToString();
                        resultItem._ptDisplayName   = dataReader["pt_display_name"].ToString();
                        resultItem._ptDescription   = dataReader["pt_description"].ToString();
                        resultItem._checkFlag       = dataReader["check_flag"].ToString();
                        resultItem._addedBy         = dataReader["added_by"].ToString();


                        result.Add(resultItem);
                    }
                    return(result);
                }
            }
            catch (Exception ex)
            {
                resultItem._ptDisplayName = "Error on JCS_DataInterface.iPaymentType.dbSearch :=> " + ex.Message.ToString();
                result.Add(resultItem);
                return(result);
            }
        }